Add snippets.
[librarian.git] / src / librarian / builders / html.py
index 5096e28..18a5b36 100644 (file)
@@ -18,12 +18,13 @@ class HtmlBuilder:
     with_footnotes = True
     with_nota_red = True
     no_externalities = False
     with_footnotes = True
     with_nota_red = True
     no_externalities = False
+    orphans = True
 
     def __init__(self, base_url=None):
         self._base_url = base_url
 
         self.tree = text = etree.Element('div', **{'id': 'book-text'})
 
     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.header = etree.Element('h1')
 
         self.footnotes = etree.Element('div', id='footnotes')
         self.footnote_counter = 0
 
         self.footnotes = etree.Element('div', id='footnotes')
         self.footnote_counter = 0
@@ -108,6 +109,9 @@ class HtmlBuilder:
         if self.with_toc:
             add_table_of_contents(self.tree)
 
         if self.with_toc:
             add_table_of_contents(self.tree)
 
+        if len(self.header):
+            self.tree.insert(0, self.header)
+            
         if self.footnote_counter:
             fnheader = etree.Element("h3")
             fnheader.text = _("Footnotes")
         if self.footnote_counter:
             fnheader = etree.Element("h3")
             fnheader.text = _("Footnotes")
@@ -182,6 +186,15 @@ class StandaloneHtmlBuilder(HtmlBuilder):
             )
 
 
             )
 
 
+class SnippetHtmlBuilder(HtmlBuilder):
+    with_anchors = False
+    with_themes = False
+    with_toc = False
+    with_footnotes = False
+    with_nota_red = False
+    with_refs = False
+
+            
 class DaisyHtmlBuilder(StandaloneHtmlBuilder):
     file_extension = 'xhtml'
     with_anchors = False
 class DaisyHtmlBuilder(StandaloneHtmlBuilder):
     file_extension = 'xhtml'
     with_anchors = False