X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/011b98a4661b754a0789ae78e145437b5b86e5fe..55fbc767e5592cad565cff0d16b9638d01b6706f:/src/librarian/elements/styles/mat.py diff --git a/src/librarian/elements/styles/mat.py b/src/librarian/elements/styles/mat.py index 68fcc3f..1512c32 100644 --- a/src/librarian/elements/styles/mat.py +++ b/src/librarian/elements/styles/mat.py @@ -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(' ^ ')