Commit dc402a30 authored by R茅gis Witz's avatar R茅gis Witz
Browse files

馃悰 fix references ordering special case in source lexicon

parent 57d130df
......@@ -241,9 +241,6 @@ def write_html(config, records):
references_hid = getattr(source, FIELD_KEY, [])
if len(references_hid) > 0:
references = [all_references[hid] for hid in references_hid if all_references[hid].reference]
from functools import cmp_to_key
from html import compare_references
references.sort(key=cmp_to_key(compare_references))
references_vs_notices = dict()
keys_vs_references = dict()
for reference in references:
......@@ -264,7 +261,12 @@ def write_html(config, records):
in_notices.sort()
references_vs_notices[ref] = in_notices
keys_vs_references[key] = ref
for reference, in_notices in references_vs_notices.items():
from functools import cmp_to_key
from html import compare_references
references = list(references_vs_notices.keys())
references.sort(key=cmp_to_key(compare_references))
for reference in references:
in_notices = references_vs_notices[reference]
result += html.get_word_and_refs(reference, in_notices)
elif len(references_hid) < 1:
# if neither source nor any of its references is cited
......
......@@ -79,7 +79,7 @@ def compare_references(x, y):
return -1
if sx > sy:
return 1
return 0
return len(x) - len(y) # '1 41' > '1'
def list2str(records, identifiers, target, prefix='', formatter=None):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment