Stabilize article sorting by title in citeblocks and statistics page
This commit is contained in:
parent
f21213d673
commit
2e4f7f60a3
|
@ -182,7 +182,9 @@ class LexiconArticle:
|
||||||
"<a href=\"{1}.html\"{2}>{0}</a>".format(
|
"<a href=\"{1}.html\"{2}>{0}</a>".format(
|
||||||
title, utils.titleescape(title),
|
title, utils.titleescape(title),
|
||||||
"" if title in self.wcites else " class=\"phantom\"")
|
"" if title in self.wcites else " class=\"phantom\"")
|
||||||
for title in sorted(self.wcites | self.pcites)]
|
for title in sorted(
|
||||||
|
self.wcites | self.pcites,
|
||||||
|
key=lambda t: utils.titlesort(t))]
|
||||||
cites_str = " | ".join(cites_links)
|
cites_str = " | ".join(cites_links)
|
||||||
if len(cites_str) < 1: cites_str = "—"
|
if len(cites_str) < 1: cites_str = "—"
|
||||||
citeblock += "<p>Citations: {}</p>\n".format(cites_str)
|
citeblock += "<p>Citations: {}</p>\n".format(cites_str)
|
||||||
|
@ -190,7 +192,9 @@ class LexiconArticle:
|
||||||
citedby_links = [
|
citedby_links = [
|
||||||
"<a href=\"{1}.html\">{0}</a>".format(
|
"<a href=\"{1}.html\">{0}</a>".format(
|
||||||
title, utils.titleescape(title))
|
title, utils.titleescape(title))
|
||||||
for title in self.citedby]
|
for title in sorted(
|
||||||
|
self.citedby,
|
||||||
|
key=lambda t: utils.titlesort(t))]
|
||||||
citedby_str = " | ".join(citedby_links)
|
citedby_str = " | ".join(citedby_links)
|
||||||
if len(citedby_str) < 1: citedby_str = "—"
|
if len(citedby_str) < 1: citedby_str = "—"
|
||||||
citeblock += "<p>Cited by: {}</p>\n</div>\n".format(citedby_str)
|
citeblock += "<p>Cited by: {}</p>\n</div>\n".format(citedby_str)
|
||||||
|
|
|
@ -160,7 +160,11 @@ def build_statistics_page(articles, config):
|
||||||
citation_count = defaultdict(list)
|
citation_count = defaultdict(list)
|
||||||
for title, count in citation_tally: citation_count[count].append(title)
|
for title, count in citation_tally: citation_count[count].append(title)
|
||||||
content += "<br>\n".join(map(
|
content += "<br>\n".join(map(
|
||||||
lambda kv: "{0} – {1}".format(kv[0], "; ".join(kv[1])),
|
lambda kv: "{0} – {1}".format(
|
||||||
|
kv[0],
|
||||||
|
"; ".join(sorted(
|
||||||
|
kv[1],
|
||||||
|
key=lambda t: utils.titlesort(t)))),
|
||||||
sorted(citation_count.items(), reverse=True)[:3]))
|
sorted(citation_count.items(), reverse=True)[:3]))
|
||||||
content += "</p>\n"
|
content += "</p>\n"
|
||||||
content += "</div>\n"
|
content += "</div>\n"
|
||||||
|
|
Loading…
Reference in New Issue