Some prelim work on builder api.
[librarian.git] / src / librarian / elements / themes / motyw.py
index 51042c6..efb7c71 100644 (file)
@@ -1,14 +1,27 @@
+# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
+#
 from ..base import WLElement
 
 
 class Motyw(WLElement):
 from ..base import WLElement
 
 
 class Motyw(WLElement):
+    ASIDE = True
+    HTML_TAG = "a"
+
     def txt_build(self, builder):
         pass
 
     def txt_build(self, builder):
         pass
 
+    def html_build(self, builder):
+        if builder.with_themes:
+            super(Motyw, self).html_build(builder)
+
+    def get_html_attr(self, builder):
+        fid = self.attrib.get('id', '')[1:]
+        return {
+            "class": "theme-begin",
+            "fid": fid,
+            "name": "m" + fid,
+        }
 
 
-    def feed_to(self, builder):
-        assert not len(self)
-        themes = [
-            normalize_text(t.strip()) for t in self.text.split(',')
-        ]
-        builder.set_themes(self.attrib['id'], themes)
+    def epub_build(self, builder):
+        pass