From 28d85f12957a4b8609b4f419e70dd42a22b57765 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 4 Sep 2015 15:57:23 +0200 Subject: [PATCH] Added support for --- librarian/epub.py | 3 +++ librarian/epub/xsltScheme.xsl | 1 + librarian/fb2.py | 3 +++ librarian/html.py | 1 + librarian/parser.py | 4 ++-- librarian/pdf/wl2tex.xslt | 1 + librarian/xslt/book2html.xslt | 1 + librarian/xslt/book2txt.xslt | 1 + 8 files changed, 13 insertions(+), 2 deletions(-) diff --git a/librarian/epub.py b/librarian/epub.py index bf58a9f..6a1b2ce 100644 --- a/librarian/epub.py +++ b/librarian/epub.py @@ -501,6 +501,9 @@ def transform(wldoc, verbose=False, for flag in flags: document.edoc.getroot().set(flag, 'yes') + document.clean_ed_note() + document.clean_ed_note('abstrakt') + # add editors info editors = document.editors() if editors: diff --git a/librarian/epub/xsltScheme.xsl b/librarian/epub/xsltScheme.xsl index 1c066d9..bcb3d70 100644 --- a/librarian/epub/xsltScheme.xsl +++ b/librarian/epub/xsltScheme.xsl @@ -323,6 +323,7 @@ + diff --git a/librarian/fb2.py b/librarian/fb2.py index d979566..a1cece4 100644 --- a/librarian/fb2.py +++ b/librarian/fb2.py @@ -50,6 +50,9 @@ def transform(wldoc, verbose=False, for flag in flags: document.edoc.getroot().set(flag, 'yes') + document.clean_ed_note() + document.clean_ed_note('abstrakt') + style_filename = os.path.join(os.path.dirname(__file__), 'fb2/fb2.xslt') style = etree.parse(style_filename) diff --git a/librarian/html.py b/librarian/html.py index 6115b31..24d506f 100644 --- a/librarian/html.py +++ b/librarian/html.py @@ -50,6 +50,7 @@ def transform(wldoc, stylesheet='legacy', options=None, flags=None): document.edoc.getroot().set(flag, 'yes') document.clean_ed_note() + document.clean_ed_note('abstrakt') if not options: options = {} diff --git a/librarian/parser.py b/librarian/parser.py index e06c4d7..19ec32d 100644 --- a/librarian/parser.py +++ b/librarian/parser.py @@ -155,10 +155,10 @@ class WLDocument(object): return unmerged - def clean_ed_note(self): + def clean_ed_note(self, note_tag='nota_red'): """ deletes forbidden tags from nota_red """ - for node in self.edoc.xpath('|'.join('//nota_red//%s' % tag for tag in + for node in self.edoc.xpath('|'.join('//%s//%s' % (note_tag, tag) for tag in ('pa', 'pe', 'pr', 'pt', 'begin', 'end', 'motyw'))): tail = node.tail node.clear() diff --git a/librarian/pdf/wl2tex.xslt b/librarian/pdf/wl2tex.xslt index 4d7ff03..c278981 100644 --- a/librarian/pdf/wl2tex.xslt +++ b/librarian/pdf/wl2tex.xslt @@ -515,6 +515,7 @@ + diff --git a/librarian/xslt/book2html.xslt b/librarian/xslt/book2html.xslt index 9a2b771..ca7cdbd 100644 --- a/librarian/xslt/book2html.xslt +++ b/librarian/xslt/book2html.xslt @@ -354,6 +354,7 @@ + diff --git a/librarian/xslt/book2txt.xslt b/librarian/xslt/book2txt.xslt index a578492..a8bb9f1 100644 --- a/librarian/xslt/book2txt.xslt +++ b/librarian/xslt/book2txt.xslt @@ -342,6 +342,7 @@ + -- 2.20.1