wip change fb2 api
[librarian.git] / src / librarian / elements / styles / mat.py
index 68fcc3f..1512c32 100644 (file)
@@ -6,6 +6,8 @@ from ..base import WLElement
 
 
 class Mat(WLElement):
+    STRIP = True
+
     def html_build(self, builder):
         e = copy(self)
         e.tag = 'math'
@@ -15,3 +17,31 @@ class Mat(WLElement):
     def epub_build(self, builder):
         builder.start_element('img', {"src": builder.mathml(self)})
         builder.end_element()
+
+
+class M(WLElement):
+    STRIP = True
+
+
+class MRow(M):
+    pass
+
+
+class MFenced(M):
+    TXT_PREFIX = '('
+    TXT_SUFFIX = ')'
+
+
+class MFrac(M):
+    TXT_PREFIX = '('
+    TXT_SUFFIX = ')'
+
+    def txt_after_child(self, builder, child_count):
+        if child_count:
+            builder.push_text(') / (')
+
+
+class MSup(M):
+    def txt_after_child(self, builder, child_count):
+        if child_count:
+            builder.push_text(' ^ ')