X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/685699c117c4a77c197fce9f327f4385fea9dbe4..ef5c6084426add3c818196a6adb92f37d1cf740c:/src/catalogue/api/tojson.py?ds=inline diff --git a/src/catalogue/api/tojson.py b/src/catalogue/api/tojson.py index 1fe055cad..2fddda974 100644 --- a/src/catalogue/api/tojson.py +++ b/src/catalogue/api/tojson.py @@ -82,7 +82,7 @@ tags = { 'begin': ('_ignore', True, {'class': 'reference'}, {'data-uri': 'href'}, False), 'end': ('_ignore', True, {'class': 'reference'}, {'data-uri': 'href'}, False), - 'motyw': ('a', True, {'class': 'theme'}, None, False), + 'motyw': ('_ignore', True, {'class': 'theme'}, None, False), 'pa': ('a', True, {'class': 'footnote footnote-pa'}, None, False), 'pe': ('a', True, {'class': 'footnote footnote-pe'}, None, False), @@ -97,7 +97,17 @@ id_prefixes = { 'pr': 'fn', 'pt': 'fn', 'ptrad': 'fn', - } + 'wers': 'f', + 'wers_wciety': 'f', + 'wers_cd': 'f', + 'wers_akap': 'f', + 'zastepnik_wersu': 'f', + 'wers_do_prawej': 'f', + 'wers_srodek': 'f', + 'akap': 'f', + 'akap_cd': 'f', + 'akap_dialog': 'f', +} #tree = etree.parse(argv[1]) @@ -133,9 +143,11 @@ def toj(elem, S): if 'dlugi_cytat' not in S['stack'] and 'poezja_cyt' not in S['stack']: S['vindex'] += 1 output['visibleNumber'] = S['vindex'] - id_prefix = id_prefixes.get(tag, 'i') + id_prefix = id_prefixes.get(elem.tag, 'i') S['id'][id_prefix] += 1 output['id'] = id_prefix + str(S['id'][id_prefix]) + if elem.attrib.get('id'): + output['id'] = 'wl-' + elem.attrib.get('id') if attrs: output['attr'] = attrs.copy() if attr_map: