X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/80ef0bd06bf9efdcd6a480319c14ca2597448fe1..25e29292e9cfecc260478aa9b094b8d37ff98eb5:/src/librarian/parser.py diff --git a/src/librarian/parser.py b/src/librarian/parser.py index b4e4c5c..ca9691a 100644 --- a/src/librarian/parser.py +++ b/src/librarian/parser.py @@ -192,19 +192,26 @@ class WLDocument: for node in self.edoc.xpath('|'.join( '//%s//%s' % (note_tag, tag) for tag in - ('pa', 'pe', 'pr', 'pt', 'begin', 'end', 'motyw'))): + ('pa', 'pe', 'pr', 'pt', 'ptrad', 'begin', 'end', 'motyw'))): tail = node.tail node.clear() node.tag = 'span' node.tail = tail def fix_pa_akap(self): - for pa in ('pa','pe','pr','pt'): + for pa in ('pa','pe','pr','pt', 'ptrad'): for akap in self.edoc.findall(f'//{pa}/akap'): akap.getparent().set('blocks', 'true') if not akap.getparent().index(akap): akap.set('inline', 'true') + def hebr_protect(self): + for s in self.edoc.findall('//slowo_obce'): + if not s.text and len(s) == 1 and s[0].tag == 'slowo_obce': + continue + if re.match(r'^[\s\u0590-\u05ff]+$', s.text): + s.attrib['protect'] = 'true' + def editors(self): """Returns a set of all editors for book and its children.