fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed MathML in EPUB.
[librarian.git]
/
src
/
librarian
/
builders
/
html.py
diff --git
a/src/librarian/builders/html.py
b/src/librarian/builders/html.py
index
165a265
..
ee50cb8
100644
(file)
--- a/
src/librarian/builders/html.py
+++ b/
src/librarian/builders/html.py
@@
-36,18
+36,14
@@
class HtmlBuilder:
'footnotes': self.footnotes,
'nota_red': self.nota_red,
}
'footnotes': self.footnotes,
'nota_red': self.nota_red,
}
- self.current_cursors = [
None
]
+ self.current_cursors = [
text
]
@property
def cursor(self):
@property
def cursor(self):
- return self.cursors[self.current_cursors[-1]]
-
- @cursor.setter
- def cursor(self, value):
- self.cursors[self.current_cursors[-1]] = value
+ return self.current_cursors[-1]
def enter_fragment(self, fragment):
def enter_fragment(self, fragment):
- self.current_cursors.append(
fragment
)
+ self.current_cursors.append(
self.cursors[fragment]
)
def exit_fragment(self):
self.current_cursors.pop()
def exit_fragment(self):
self.current_cursors.pop()
@@
-63,7
+59,7
@@
class HtmlBuilder:
document._compat_assign_ordered_ids()
document._compat_assign_section_ids()
document._compat_assign_ordered_ids()
document._compat_assign_section_ids()
- def build(self, document):
+ def build(self, document
, **kwargs
):
self.preprocess(document)
document.tree.getroot().html_build(self)
self.postprocess(document)
self.preprocess(document)
document.tree.getroot().html_build(self)
self.postprocess(document)
@@
-110,19
+106,16
@@
class HtmlBuilder:
self.tree.append(self.footnotes)
def start_element(self, tag, attrib=None):
self.tree.append(self.footnotes)
def start_element(self, tag, attrib=None):
- self.cur
sor =
etree.SubElement(
+ self.cur
rent_cursors.append(
etree.SubElement(
self.cursor,
tag,
**(attrib or {})
self.cursor,
tag,
**(attrib or {})
- )
+ )
)
def end_element(self):
def end_element(self):
- self.cur
sor = self.cursor.getparent
()
+ self.cur
rent_cursors.pop
()
def push_text(self, text):
def push_text(self, text):
- if text == 'Między nami nic nie było':
- print(self.cursors)
- print(self.current_cursors)
cursor = self.cursor
if len(cursor):
cursor[-1].tail = (cursor[-1].tail or '') + text
cursor = self.cursor
if len(cursor):
cursor[-1].tail = (cursor[-1].tail or '') + text