WIP
This commit is contained in:
parent
7afe78c1ae
commit
53ec386477
|
@ -55,8 +55,8 @@ a.new { color: red; }
|
||||||
<input type="hidden" value="{}" id="save-edits" name="edits">
|
<input type="hidden" value="{}" id="save-edits" name="edits">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div>There are {{ dab_list | count }} links in the article that need disambiguating.</div>
|
<div>There are {{ article.dab_list | count }} links in the article that need disambiguating.</div>
|
||||||
{% for dab in dab_list %}
|
{% for dab in article.dab_list %}
|
||||||
<div class="card p-1 m-2">
|
<div class="card p-1 m-2">
|
||||||
<h3 class="card-title" id="dab-card-title-{{ dab.num }}" onclick="return jump_to({{ dab.num }})">{{ dab.title }}</h3>
|
<h3 class="card-title" id="dab-card-title-{{ dab.num }}" onclick="return jump_to({{ dab.num }})">{{ dab.title }}</h3>
|
||||||
<div>
|
<div>
|
||||||
|
@ -71,7 +71,7 @@ a.new { color: red; }
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div id="article" class="pe-3">
|
<div id="article" class="pe-3">
|
||||||
<div>{{ text | safe }}</div>
|
<div>{{ article.get_html() | safe }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
14
web_view.py
14
web_view.py
|
@ -238,7 +238,6 @@ class Article:
|
||||||
self.dab_list: list[DabItem] = []
|
self.dab_list: list[DabItem] = []
|
||||||
self.dab_lookup: dict[int, str] = {}
|
self.dab_lookup: dict[int, str] = {}
|
||||||
self.dab_order: list[str] = []
|
self.dab_order: list[str] = []
|
||||||
# self.html_links: defaultdict[str, lxml.html.Element] = defaultdict(list)
|
|
||||||
|
|
||||||
def save_endpoint(self) -> str:
|
def save_endpoint(self) -> str:
|
||||||
"""Endpoint for saving changes."""
|
"""Endpoint for saving changes."""
|
||||||
|
@ -272,9 +271,7 @@ class Article:
|
||||||
self.dab_order.append(title)
|
self.dab_order.append(title)
|
||||||
self.dab_lookup[dab_num] = title
|
self.dab_lookup[dab_num] = title
|
||||||
|
|
||||||
# self.html_links[title].append(a)
|
def get_html(self) -> str:
|
||||||
|
|
||||||
def article_html(self) -> str:
|
|
||||||
"""Return the processed article HTML."""
|
"""Return the processed article HTML."""
|
||||||
html: str = lxml.html.tostring(self.root, encoding=str)
|
html: str = lxml.html.tostring(self.root, encoding=str)
|
||||||
return html
|
return html
|
||||||
|
@ -295,14 +292,7 @@ def article_page(enwiki: str) -> Response:
|
||||||
article.load()
|
article.load()
|
||||||
article.process_links()
|
article.process_links()
|
||||||
|
|
||||||
return flask.render_template(
|
return flask.render_template("article.html", article=article)
|
||||||
"article.html",
|
|
||||||
article=article,
|
|
||||||
text=article.article_html(),
|
|
||||||
links=article.links,
|
|
||||||
# html_links=article.html_links,
|
|
||||||
dab_list=article.dab_list,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue