fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
more meta
[librarian.git]
/
src
/
librarian
/
builders
/
html.py
diff --git
a/src/librarian/builders/html.py
b/src/librarian/builders/html.py
index
ee50cb8
..
5096e28
100644
(file)
--- a/
src/librarian/builders/html.py
+++ b/
src/librarian/builders/html.py
@@
-19,8
+19,8
@@
class HtmlBuilder:
with_nota_red = True
no_externalities = False
with_nota_red = True
no_externalities = False
- def __init__(self,
image_location='https://wolnelektury.pl/media/book/pictures/marcos-historia-kolorow/'
):
- self.
image_location = image_location
+ def __init__(self,
base_url=None
):
+ self.
_base_url = base_url
self.tree = text = etree.Element('div', **{'id': 'book-text'})
self.header = etree.SubElement(text, 'h1')
self.tree = text = etree.Element('div', **{'id': 'book-text'})
self.header = etree.SubElement(text, 'h1')
@@
-38,6
+38,13
@@
class HtmlBuilder:
}
self.current_cursors = [text]
}
self.current_cursors = [text]
+ @property
+ def base_url(self):
+ if self._base_url is not None:
+ return self._base_url
+ else:
+ return 'https://wolnelektury.pl/media/book/pictures/{}/'.format(self.document.meta.url.slug)
+
@property
def cursor(self):
return self.current_cursors[-1]
@property
def cursor(self):
return self.current_cursors[-1]
@@
-60,6
+67,8
@@
class HtmlBuilder:
document._compat_assign_section_ids()
def build(self, document, **kwargs):
document._compat_assign_section_ids()
def build(self, document, **kwargs):
+ self.document = document
+
self.preprocess(document)
document.tree.getroot().html_build(self)
self.postprocess(document)
self.preprocess(document)
document.tree.getroot().html_build(self)
self.postprocess(document)