X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/3a0c83394d5783715fab2be29fa1a9cfc3574e28..eb25cada3f68db8f58689bff431edd321620fd72:/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(' ^ ')