From 81c8f986cdc94676fc808831a9e7fda2a8323ba7 Mon Sep 17 00:00:00 2001 From: iury Date: Sat, 23 Apr 2016 00:38:30 -0300 Subject: [PATCH 1/5] implementing some models of ooxml shared_math --- pydocx/openxml/shared_math/__init__.py | 76 +++++++++++++++++++ pydocx/openxml/shared_math/accent.py | 18 +++++ .../openxml/shared_math/accent_properties.py | 17 +++++ pydocx/openxml/shared_math/align.py | 11 +++ pydocx/openxml/shared_math/align_scripts.py | 11 +++ .../shared_math/argument_properties.py | 15 ++++ pydocx/openxml/shared_math/argument_size.py | 11 +++ pydocx/openxml/shared_math/bar.py | 17 +++++ pydocx/openxml/shared_math/bar_properties.py | 16 ++++ pydocx/openxml/shared_math/base.py | 16 ++++ .../openxml/shared_math/base_justification.py | 11 +++ pydocx/openxml/shared_math/border_box.py | 18 +++++ .../shared_math/border_box_properties.py | 26 +++++++ pydocx/openxml/shared_math/box.py | 18 +++++ pydocx/openxml/shared_math/box_properties.py | 22 ++++++ .../openxml/shared_math/control_properties.py | 19 +++++ pydocx/openxml/shared_math/degree.py | 53 +++++++++++++ .../openxml/shared_math/delimiter_function.py | 17 +++++ .../shared_math/delimiter_properties.py | 13 ++++ pydocx/openxml/shared_math/denominator.py | 15 ++++ .../shared_math/equation_array_function.py | 18 +++++ .../shared_math/equation_array_properties.py | 24 ++++++ .../openxml/shared_math/fraction_function.py | 17 +++++ .../shared_math/function_apply_function.py | 23 ++++++ pydocx/openxml/shared_math/function_name.py | 53 +++++++++++++ .../shared_math/function_properties.py | 15 ++++ .../shared_math/group_character_function.py | 17 +++++ .../shared_math/group_character_properties.py | 18 +++++ pydocx/openxml/shared_math/limit.py | 57 ++++++++++++++ .../shared_math/lower_limit_function.py | 22 ++++++ .../shared_math/lower_limit_properties.py | 15 ++++ pydocx/openxml/shared_math/matrix_function.py | 18 +++++ .../openxml/shared_math/matrix_properties.py | 21 +++++ .../shared_math/maximum_distribution.py | 11 +++ .../shared_math/nary_operator_function.py | 21 +++++ pydocx/openxml/shared_math/nary_properties.py | 12 +++ pydocx/openxml/shared_math/numerator.py | 17 +++++ .../shared_math/object_distribution.py | 11 +++ pydocx/openxml/shared_math/omath.py | 20 +++++ .../openxml/shared_math/phantom_function.py | 18 +++++ pydocx/openxml/shared_math/row_spacing.py | 11 +++ .../openxml/shared_math/row_spacing_rule.py | 11 +++ pydocx/openxml/shared_math/subscript.py | 15 ++++ pydocx/openxml/shared_math/superscript.py | 17 +++++ .../shared_math/superscript_function.py | 17 +++++ .../shared_math/upper_limit_function.py | 23 ++++++ .../shared_math/upper_limit_properties.py | 15 ++++ pydocx/openxml/wordprocessing/paragraph.py | 2 + 48 files changed, 959 insertions(+) create mode 100644 pydocx/openxml/shared_math/__init__.py create mode 100644 pydocx/openxml/shared_math/accent.py create mode 100644 pydocx/openxml/shared_math/accent_properties.py create mode 100644 pydocx/openxml/shared_math/align.py create mode 100644 pydocx/openxml/shared_math/align_scripts.py create mode 100644 pydocx/openxml/shared_math/argument_properties.py create mode 100644 pydocx/openxml/shared_math/argument_size.py create mode 100644 pydocx/openxml/shared_math/bar.py create mode 100644 pydocx/openxml/shared_math/bar_properties.py create mode 100644 pydocx/openxml/shared_math/base.py create mode 100644 pydocx/openxml/shared_math/base_justification.py create mode 100644 pydocx/openxml/shared_math/border_box.py create mode 100644 pydocx/openxml/shared_math/border_box_properties.py create mode 100644 pydocx/openxml/shared_math/box.py create mode 100644 pydocx/openxml/shared_math/box_properties.py create mode 100644 pydocx/openxml/shared_math/control_properties.py create mode 100644 pydocx/openxml/shared_math/degree.py create mode 100644 pydocx/openxml/shared_math/delimiter_function.py create mode 100644 pydocx/openxml/shared_math/delimiter_properties.py create mode 100644 pydocx/openxml/shared_math/denominator.py create mode 100644 pydocx/openxml/shared_math/equation_array_function.py create mode 100644 pydocx/openxml/shared_math/equation_array_properties.py create mode 100644 pydocx/openxml/shared_math/fraction_function.py create mode 100644 pydocx/openxml/shared_math/function_apply_function.py create mode 100644 pydocx/openxml/shared_math/function_name.py create mode 100644 pydocx/openxml/shared_math/function_properties.py create mode 100644 pydocx/openxml/shared_math/group_character_function.py create mode 100644 pydocx/openxml/shared_math/group_character_properties.py create mode 100644 pydocx/openxml/shared_math/limit.py create mode 100644 pydocx/openxml/shared_math/lower_limit_function.py create mode 100644 pydocx/openxml/shared_math/lower_limit_properties.py create mode 100644 pydocx/openxml/shared_math/matrix_function.py create mode 100644 pydocx/openxml/shared_math/matrix_properties.py create mode 100644 pydocx/openxml/shared_math/maximum_distribution.py create mode 100644 pydocx/openxml/shared_math/nary_operator_function.py create mode 100644 pydocx/openxml/shared_math/nary_properties.py create mode 100644 pydocx/openxml/shared_math/numerator.py create mode 100644 pydocx/openxml/shared_math/object_distribution.py create mode 100644 pydocx/openxml/shared_math/omath.py create mode 100644 pydocx/openxml/shared_math/phantom_function.py create mode 100644 pydocx/openxml/shared_math/row_spacing.py create mode 100644 pydocx/openxml/shared_math/row_spacing_rule.py create mode 100644 pydocx/openxml/shared_math/subscript.py create mode 100644 pydocx/openxml/shared_math/superscript.py create mode 100644 pydocx/openxml/shared_math/superscript_function.py create mode 100644 pydocx/openxml/shared_math/upper_limit_function.py create mode 100644 pydocx/openxml/shared_math/upper_limit_properties.py diff --git a/pydocx/openxml/shared_math/__init__.py b/pydocx/openxml/shared_math/__init__.py new file mode 100644 index 00000000..1953b078 --- /dev/null +++ b/pydocx/openxml/shared_math/__init__.py @@ -0,0 +1,76 @@ +from pydocx.openxml.shared_math.accent import Accent +from pydocx.openxml.shared_math.accent_properties import AccentProperties +from pydocx.openxml.shared_math.align import Align +from pydocx.openxml.shared_math.align_scripts import AlignScripts +from pydocx.openxml.shared_math.argument_properties import ArgumentProperties +from pydocx.openxml.shared_math.argument_size import ArgumentSize +from pydocx.openxml.shared_math.bar import Bar +from pydocx.openxml.shared_math.bar_properties import BarProperties +from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.base_justification import BaseJustification +from pydocx.openxml.shared_math.border_box import BorderBox +from pydocx.openxml.shared_math.border_box_properties import BorderBoxProperties +from pydocx.openxml.shared_math.box import Box +from pydocx.openxml.shared_math.box_properties import BoxProperties +from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.degree import Degree +from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.delimiter_properties import DelimiterProperties +from pydocx.openxml.shared_math.denominator import Denominator +from pydocx.openxml.shared_math.equation_array_function import EquationArrayFunction +from pydocx.openxml.shared_math.equation_array_properties import EquationArrayProperties +from pydocx.openxml.shared_math.fraction_function import FractionFunction +from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction # noqa +from pydocx.openxml.shared_math.nary_properties import NaryProperties +from pydocx.openxml.shared_math.numerator import Numerator +from pydocx.openxml.shared_math.matrix_function import MatrixFunction +from pydocx.openxml.shared_math.maximum_distribution import MaximumDistribution +from pydocx.openxml.shared_math.object_distribution import ObjectDistribution +from pydocx.openxml.shared_math.omath import OMath +from pydocx.openxml.shared_math.phantom_function import PhantomFunction +from pydocx.openxml.shared_math.row_spacing import RowSpacing +from pydocx.openxml.shared_math.row_spacing_rule import RowSpacingRule +from pydocx.openxml.shared_math.subscript import Subscript +from pydocx.openxml.shared_math.superscript import Superscript +from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction + +Base.children.types.add(FractionFunction) + + +__all__ = [ + 'Accent', + 'AccentProperties', + 'Align', + 'AlignScripts', + 'ArgumentProperties', + 'ArgumentSize', + 'Bar', + 'BarProperties', + 'Base', + 'BaseJustification', + 'BorderBox', + 'BorderBoxProperties', + 'Box', + 'BoxProperties', + 'ControlProperties', + 'Degree', + 'DelimiterFunction', + 'DelimiterProperties', + 'Denominator', + 'EquationArrayFunction', + 'EquationArrayProperties', + 'FractionFunction' + 'NaryOperatorFunction', + 'NaryProperties', + 'Numerator', + 'MatrixFunction', + 'MaximumDistribution', + 'ObjectDistribution', + 'OMath', + 'PhantomFunction', + 'RowSpacing', + 'RowSpacingRule', + 'Subscript', + 'Superscript', + 'SuperscriptFunction' +] diff --git a/pydocx/openxml/shared_math/accent.py b/pydocx/openxml/shared_math/accent.py new file mode 100644 index 00000000..67e25eb6 --- /dev/null +++ b/pydocx/openxml/shared_math/accent.py @@ -0,0 +1,18 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.accent_properties import AccentProperties +from pydocx.openxml.shared_math import base + + +class Accent(XmlModel): + + XML_TAG = 'acc' + children = XmlCollection( + AccentProperties, + base.Base + ) diff --git a/pydocx/openxml/shared_math/accent_properties.py b/pydocx/openxml/shared_math/accent_properties.py new file mode 100644 index 00000000..ab5b8811 --- /dev/null +++ b/pydocx/openxml/shared_math/accent_properties.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.control_properties import ControlProperties + + +class AccentProperties(XmlModel): + XML_TAG = 'accPr' + + chr = XmlChild(name='chr', attrname='val') + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/align.py b/pydocx/openxml/shared_math/align.py new file mode 100644 index 00000000..2ba865dc --- /dev/null +++ b/pydocx/openxml/shared_math/align.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class Align(XmlModel): + XML_TAG = 'aln' diff --git a/pydocx/openxml/shared_math/align_scripts.py b/pydocx/openxml/shared_math/align_scripts.py new file mode 100644 index 00000000..2163984c --- /dev/null +++ b/pydocx/openxml/shared_math/align_scripts.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class AlignScripts(XmlModel): + XML_TAG = 'alnScr' diff --git a/pydocx/openxml/shared_math/argument_properties.py b/pydocx/openxml/shared_math/argument_properties.py new file mode 100644 index 00000000..1c56beff --- /dev/null +++ b/pydocx/openxml/shared_math/argument_properties.py @@ -0,0 +1,15 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.argument_size import ArgumentSize + + +class ArgumentProperties(XmlModel): + XML_TAG = 'argPr' + children = XmlCollection( + ArgumentSize + ) diff --git a/pydocx/openxml/shared_math/argument_size.py b/pydocx/openxml/shared_math/argument_size.py new file mode 100644 index 00000000..dde71d51 --- /dev/null +++ b/pydocx/openxml/shared_math/argument_size.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class ArgumentSize(XmlModel): + XML_TAG = 'argSz' diff --git a/pydocx/openxml/shared_math/bar.py b/pydocx/openxml/shared_math/bar.py new file mode 100644 index 00000000..c50e1038 --- /dev/null +++ b/pydocx/openxml/shared_math/bar.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.bar_properties import BarProperties +from pydocx.openxml.shared_math.base import Base + + +class Bar(XmlModel): + XML_TAG = 'bar' + children = XmlCollection( + BarProperties, + Base + ) diff --git a/pydocx/openxml/shared_math/bar_properties.py b/pydocx/openxml/shared_math/bar_properties.py new file mode 100644 index 00000000..f87181b3 --- /dev/null +++ b/pydocx/openxml/shared_math/bar_properties.py @@ -0,0 +1,16 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.control_properties import ControlProperties + + +class BarProperties(XmlModel): + XML_TAG = 'barPr' + pos = XmlChild(name='pos', attrname='val') + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/base.py b/pydocx/openxml/shared_math/base.py new file mode 100644 index 00000000..d07a4041 --- /dev/null +++ b/pydocx/openxml/shared_math/base.py @@ -0,0 +1,16 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.wordprocessing.run import Run + + +class Base(XmlModel): + XML_TAG = 'e' + + children = XmlCollection( + Run + ) diff --git a/pydocx/openxml/shared_math/base_justification.py b/pydocx/openxml/shared_math/base_justification.py new file mode 100644 index 00000000..70f85be2 --- /dev/null +++ b/pydocx/openxml/shared_math/base_justification.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class BaseJustification(XmlModel): + XML_TAG = 'baseJc' diff --git a/pydocx/openxml/shared_math/border_box.py b/pydocx/openxml/shared_math/border_box.py new file mode 100644 index 00000000..d48a59fe --- /dev/null +++ b/pydocx/openxml/shared_math/border_box.py @@ -0,0 +1,18 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.border_box_properties import BorderBoxProperties + + +class BorderBox(XmlModel): + + XML_TAG = 'borderBox' + children = XmlCollection( + Base, + BorderBoxProperties, + ) diff --git a/pydocx/openxml/shared_math/border_box_properties.py b/pydocx/openxml/shared_math/border_box_properties.py new file mode 100644 index 00000000..c3f4a4ad --- /dev/null +++ b/pydocx/openxml/shared_math/border_box_properties.py @@ -0,0 +1,26 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.control_properties import ControlProperties + + +class BorderBoxProperties(XmlModel): + + XML_TAG = 'borderBoxPr' + + hide_top = XmlChild(name='hideTop', attrname='val') + hide_bot = XmlChild(name='hideBot', attrname='val') + hide_left = XmlChild(name='hideLeft', attrname='val') + hide_right = XmlChild(name='hideRight', attrname='val') + strike_h = XmlChild(name='strikeH', attrname='val') + strike_v = XmlChild(name='strikeV', attrname='val') + strike_bltr = XmlChild(name='strikeBLTR', attrname='val') + strike_tlbr = XmlChild(name='strikeTLBR', attrname='val') + + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/box.py b/pydocx/openxml/shared_math/box.py new file mode 100644 index 00000000..436838f8 --- /dev/null +++ b/pydocx/openxml/shared_math/box.py @@ -0,0 +1,18 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.box_properties import BoxProperties + + +class Box(XmlModel): + + XML_TAG = 'box' + children = XmlCollection( + Base, + BoxProperties + ) diff --git a/pydocx/openxml/shared_math/box_properties.py b/pydocx/openxml/shared_math/box_properties.py new file mode 100644 index 00000000..7a0dd63c --- /dev/null +++ b/pydocx/openxml/shared_math/box_properties.py @@ -0,0 +1,22 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.control_properties import ControlProperties + + +class BoxProperties(XmlModel): + + XML_TAG = 'boxPr' + + op_emu = XmlChild(name='opEmu', attrname='val') + no_break = XmlChild(name='noBreak', attrname='val') + diff = XmlChild(name='diff', attrname='val') + brk = XmlChild(name='brk', attrname='val') + aln = XmlChild(name='aln', attrname='val') + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/control_properties.py b/pydocx/openxml/shared_math/control_properties.py new file mode 100644 index 00000000..6b9a3442 --- /dev/null +++ b/pydocx/openxml/shared_math/control_properties.py @@ -0,0 +1,19 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.wordprocessing.deleted_run import DeletedRun +from pydocx.openxml.wordprocessing.inserted_run import InsertedRun +from pydocx.openxml.wordprocessing.run_properties import RunProperties + + +class ControlProperties(XmlModel): + XML_TAG = 'ctrlPr' + children = XmlCollection( + DeletedRun, + InsertedRun, + RunProperties + ) diff --git a/pydocx/openxml/shared_math/degree.py b/pydocx/openxml/shared_math/degree.py new file mode 100644 index 00000000..af17e3d1 --- /dev/null +++ b/pydocx/openxml/shared_math/degree.py @@ -0,0 +1,53 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.accent import Accent +from pydocx.openxml.shared_math.bar import Bar +from pydocx.openxml.shared_math.box import Box +from pydocx.openxml.shared_math.border_box import BorderBox +from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.equation_array_function import EquationArrayFunction +from pydocx.openxml.shared_math.fraction_function import FractionFunction +from pydocx.openxml.shared_math.function_apply_function import FunctionApplyFunction +from pydocx.openxml.shared_math.group_character_function import GroupCharacterFunction +from pydocx.openxml.shared_math.lower_limit_function import LowerLimitFunction +from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction +from pydocx.openxml.shared_math.matrix_function import MatrixFunction +from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction +from pydocx.openxml.shared_math.phantom_function import PhantomFunction +# from pydocx.openxml.shared_math.radical_function import RadicalFunction +# from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +# from pydocx.openxml.shared_math.subscript_function import SubScriptFunction +# from pydocx.openxml.shared_math.sub_superscript_function import SubSuperScriptFunction +# from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction +from pydocx.openxml.wordprocessing.run import Run + + +class Degree(XmlModel): + XML_TAG = 'deg' + children = XmlCollection( + Accent, + Bar, + Box, + BorderBox, + DelimiterFunction, + EquationArrayFunction, + FractionFunction, + FunctionApplyFunction, + GroupCharacterFunction, + LowerLimitFunction, + UpperLimitFunction, + MatrixFunction, + NaryOperatorFunction, + PhantomFunction, + # RadicalFunction, + # PreSubSuperscriptFunction, + # SubScriptFunction, + # SubSuperScriptFunction, + # SuperscriptFunction, + Run + ) diff --git a/pydocx/openxml/shared_math/delimiter_function.py b/pydocx/openxml/shared_math/delimiter_function.py new file mode 100644 index 00000000..af2a0ab8 --- /dev/null +++ b/pydocx/openxml/shared_math/delimiter_function.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.delimiter_properties import DelimiterProperties + + +class DelimiterFunction(XmlModel): + XML_TAG = 'd' + children = XmlCollection( + Base, + DelimiterProperties + ) diff --git a/pydocx/openxml/shared_math/delimiter_properties.py b/pydocx/openxml/shared_math/delimiter_properties.py new file mode 100644 index 00000000..4bcafa73 --- /dev/null +++ b/pydocx/openxml/shared_math/delimiter_properties.py @@ -0,0 +1,13 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlChild + + +class DelimiterProperties(XmlModel): + XML_TAG = 'dPr' + beg_chr = XmlChild(name='begChr', attrname='val') + end_chr = XmlChild(name='endChr', attrname='val') diff --git a/pydocx/openxml/shared_math/denominator.py b/pydocx/openxml/shared_math/denominator.py new file mode 100644 index 00000000..3d9d1d4b --- /dev/null +++ b/pydocx/openxml/shared_math/denominator.py @@ -0,0 +1,15 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.wordprocessing.run import Run + + +class Denominator(XmlModel): + XML_TAG = 'den' + children = XmlCollection( + Run + ) diff --git a/pydocx/openxml/shared_math/equation_array_function.py b/pydocx/openxml/shared_math/equation_array_function.py new file mode 100644 index 00000000..c6bb7cc2 --- /dev/null +++ b/pydocx/openxml/shared_math/equation_array_function.py @@ -0,0 +1,18 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.equation_array_properties import EquationArrayProperties + + +class EquationArrayFunction(XmlModel): + XML_TAG = 'eqArr' + + children = XmlCollection( + Base, + EquationArrayProperties + ) diff --git a/pydocx/openxml/shared_math/equation_array_properties.py b/pydocx/openxml/shared_math/equation_array_properties.py new file mode 100644 index 00000000..d99ceda6 --- /dev/null +++ b/pydocx/openxml/shared_math/equation_array_properties.py @@ -0,0 +1,24 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base_justification import BaseJustification +from pydocx.openxml.shared_math.maximum_distribution import MaximumDistribution +from pydocx.openxml.shared_math.object_distribution import ObjectDistribution +from pydocx.openxml.shared_math.row_spacing_rule import RowSpacingRule +from pydocx.openxml.shared_math.row_spacing import RowSpacing + + +class EquationArrayProperties(XmlModel): + XML_TAG = 'eqArrPr' + + children = XmlCollection( + BaseJustification, + MaximumDistribution, + ObjectDistribution, + RowSpacing, + RowSpacingRule + ) diff --git a/pydocx/openxml/shared_math/fraction_function.py b/pydocx/openxml/shared_math/fraction_function.py new file mode 100644 index 00000000..bc2f63e2 --- /dev/null +++ b/pydocx/openxml/shared_math/fraction_function.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.numerator import Numerator +from pydocx.openxml.shared_math.denominator import Denominator + + +class FractionFunction(XmlModel): + XML_TAG = 'f' + children = XmlCollection( + Numerator, + Denominator + ) diff --git a/pydocx/openxml/shared_math/function_apply_function.py b/pydocx/openxml/shared_math/function_apply_function.py new file mode 100644 index 00000000..55d160fa --- /dev/null +++ b/pydocx/openxml/shared_math/function_apply_function.py @@ -0,0 +1,23 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.function_properties import FunctionProperties + + +class FunctionApplyFunction(XmlModel): + XML_TAG = 'func' + children = XmlCollection( + FunctionProperties, + Base + ) + + +# solves circular import +from pydocx.openxml.shared_math.function_name import FunctionName # noqa + +FunctionApplyFunction.children.types.add(FunctionName) diff --git a/pydocx/openxml/shared_math/function_name.py b/pydocx/openxml/shared_math/function_name.py new file mode 100644 index 00000000..dec0dd44 --- /dev/null +++ b/pydocx/openxml/shared_math/function_name.py @@ -0,0 +1,53 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.accent import Accent +from pydocx.openxml.shared_math.bar import Bar +from pydocx.openxml.shared_math.box import Box +from pydocx.openxml.shared_math.border_box import BorderBox +from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.equation_array_function import EquationArrayFunction +from pydocx.openxml.shared_math.fraction_function import FractionFunction +from pydocx.openxml.shared_math.function_apply_function import FunctionApplyFunction +from pydocx.openxml.shared_math.group_character_function import GroupCharacterFunction +from pydocx.openxml.shared_math.lower_limit_function import LowerLimitFunction +from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction +from pydocx.openxml.shared_math.matrix_function import MatrixFunction +from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction +from pydocx.openxml.shared_math.phantom_function import PhantomFunction +# from pydocx.openxml.shared_math.radical_function import RadicalFunction +# from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +# from pydocx.openxml.shared_math.subscript_function import SubscriptFunction +# from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction +# from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction +from pydocx.openxml.wordprocessing.run import Run + + +class FunctionName(XmlModel): + XML_TAG = 'fName' + children = XmlCollection( + Accent, + Bar, + Box, + BorderBox, + DelimiterFunction, + EquationArrayFunction, + FractionFunction, + FunctionApplyFunction, + GroupCharacterFunction, + LowerLimitFunction, + UpperLimitFunction, + MatrixFunction, + NaryOperatorFunction, + PhantomFunction, + # RadicalFunction, + # PreSubSuperscriptFunction, + # SubscriptFunction, + # SubSuperscriptFunction, + # SuperscriptFunction, + Run + ) diff --git a/pydocx/openxml/shared_math/function_properties.py b/pydocx/openxml/shared_math/function_properties.py new file mode 100644 index 00000000..6e01f047 --- /dev/null +++ b/pydocx/openxml/shared_math/function_properties.py @@ -0,0 +1,15 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.control_properties import ControlProperties + + +class FunctionProperties(XmlModel): + XML_TAG = 'funcPr' + children = XmlCollection( + ControlProperties, + ) diff --git a/pydocx/openxml/shared_math/group_character_function.py b/pydocx/openxml/shared_math/group_character_function.py new file mode 100644 index 00000000..eb2b5bec --- /dev/null +++ b/pydocx/openxml/shared_math/group_character_function.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.group_character_properties import GroupCharacterProperties + + +class GroupCharacterFunction(XmlModel): + XML_TAG = 'groupChr' + children = XmlCollection( + Base, + GroupCharacterProperties + ) diff --git a/pydocx/openxml/shared_math/group_character_properties.py b/pydocx/openxml/shared_math/group_character_properties.py new file mode 100644 index 00000000..a25b4786 --- /dev/null +++ b/pydocx/openxml/shared_math/group_character_properties.py @@ -0,0 +1,18 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.control_properties import ControlProperties + + +class GroupCharacterProperties(XmlModel): + XML_TAG = 'groupChrPr' + chr = XmlChild(name='chr', attrname='val') + pos = XmlChild(name='pos', attrname='val') + vert_jc = XmlChild(name='vertJc', attrname='val') + children = XmlCollection( + ControlProperties, + ) diff --git a/pydocx/openxml/shared_math/limit.py b/pydocx/openxml/shared_math/limit.py new file mode 100644 index 00000000..3c4b256c --- /dev/null +++ b/pydocx/openxml/shared_math/limit.py @@ -0,0 +1,57 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.accent import Accent +from pydocx.openxml.shared_math.bar import Bar +from pydocx.openxml.shared_math.box import Box +from pydocx.openxml.shared_math.border_box import BorderBox +from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.equation_array_function import EquationArrayFunction +from pydocx.openxml.shared_math.fraction_function import FractionFunction +from pydocx.openxml.shared_math.function_apply_function import FunctionApplyFunction +from pydocx.openxml.shared_math.group_character_function import GroupCharacterFunction +from pydocx.openxml.shared_math.lower_limit_function import LowerLimitFunction +from pydocx.openxml.shared_math.matrix_function import MatrixFunction +from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction +from pydocx.openxml.shared_math.phantom_function import PhantomFunction +# from pydocx.openxml.shared_math.radical_function import RadicalFunction +# from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +# rom pydocx.openxml.shared_math.subscript_function import SubscriptFunction +# from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction +# from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction +from pydocx.openxml.wordprocessing.run import Run + + +class Limit(XmlModel): + XML_TAG = 'lim' + children = XmlCollection( + Accent, + Bar, + Box, + BorderBox, + DelimiterFunction, + EquationArrayFunction, + FractionFunction, + FunctionApplyFunction, + GroupCharacterFunction, + LowerLimitFunction, + MatrixFunction, + NaryOperatorFunction, + PhantomFunction, + # RadicalFunction, + # PreSubSuperscriptFunction, + # SubscriptFunction, + # SubSuperscriptFunction, + # SuperscriptFunction, + Run + ) + +# solves circular import + +from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction + +Limit.children.types.add(UpperLimitFunction) diff --git a/pydocx/openxml/shared_math/lower_limit_function.py b/pydocx/openxml/shared_math/lower_limit_function.py new file mode 100644 index 00000000..7640b9aa --- /dev/null +++ b/pydocx/openxml/shared_math/lower_limit_function.py @@ -0,0 +1,22 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.lower_limit_properties import LowerLimitProperties + + +class LowerLimitFunction(XmlModel): + XML_TAG = 'limLow' + children = XmlCollection( + Base, + LowerLimitProperties + ) + +# solves circular import +from pydocx.openxml.shared_math.limit import Limit # noqa + +LowerLimitFunction.children.types.add(Limit) diff --git a/pydocx/openxml/shared_math/lower_limit_properties.py b/pydocx/openxml/shared_math/lower_limit_properties.py new file mode 100644 index 00000000..29371255 --- /dev/null +++ b/pydocx/openxml/shared_math/lower_limit_properties.py @@ -0,0 +1,15 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.control_properties import ControlProperties + + +class LowerLimitProperties(XmlModel): + XML_TAG = 'limLowPr' + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/matrix_function.py b/pydocx/openxml/shared_math/matrix_function.py new file mode 100644 index 00000000..3fa6af5d --- /dev/null +++ b/pydocx/openxml/shared_math/matrix_function.py @@ -0,0 +1,18 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.matrix_properties import MatrixProperties +# from pydocx.openxml.shared_math.matrix_row import MatrixRow + + +class MatrixFunction(XmlModel): + + XML_TAG = 'm' + children = XmlCollection( + MatrixProperties, + # MatrixRow + ) diff --git a/pydocx/openxml/shared_math/matrix_properties.py b/pydocx/openxml/shared_math/matrix_properties.py new file mode 100644 index 00000000..37e193e1 --- /dev/null +++ b/pydocx/openxml/shared_math/matrix_properties.py @@ -0,0 +1,21 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +# incomplete +from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.control_properties import ControlProperties +# from pydocx.openxml.shared_math.matrix_columns import MatrixColumns +from pydocx.openxml.shared_math.row_spacing import RowSpacing + + +class MatrixProperties(XmlModel): + + XML_TAG = 'mPr' + base_jc = XmlChild(name='baseJc', attrname='val') + children = XmlCollection( + ControlProperties, + RowSpacing + ) diff --git a/pydocx/openxml/shared_math/maximum_distribution.py b/pydocx/openxml/shared_math/maximum_distribution.py new file mode 100644 index 00000000..ceb296e3 --- /dev/null +++ b/pydocx/openxml/shared_math/maximum_distribution.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class MaximumDistribution(XmlModel): + XML_TAG = 'maxDist' diff --git a/pydocx/openxml/shared_math/nary_operator_function.py b/pydocx/openxml/shared_math/nary_operator_function.py new file mode 100644 index 00000000..f746222e --- /dev/null +++ b/pydocx/openxml/shared_math/nary_operator_function.py @@ -0,0 +1,21 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.nary_properties import NaryProperties +from pydocx.openxml.shared_math.subscript import Subscript +from pydocx.openxml.shared_math.superscript import Superscript + + +class NaryOperatorFunction(XmlModel): + XML_TAG = 'nary' + children = XmlCollection( + Base, + NaryProperties, + Subscript, + Superscript + ) diff --git a/pydocx/openxml/shared_math/nary_properties.py b/pydocx/openxml/shared_math/nary_properties.py new file mode 100644 index 00000000..193e4e39 --- /dev/null +++ b/pydocx/openxml/shared_math/nary_properties.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlChild + + +class NaryProperties(XmlModel): + + chr = XmlChild(name='chr', attrname='val') diff --git a/pydocx/openxml/shared_math/numerator.py b/pydocx/openxml/shared_math/numerator.py new file mode 100644 index 00000000..bee4d0d4 --- /dev/null +++ b/pydocx/openxml/shared_math/numerator.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction + + +class Numerator(XmlModel): + XML_TAG = 'num' + children = XmlCollection( + DelimiterFunction, + SuperscriptFunction + ) diff --git a/pydocx/openxml/shared_math/object_distribution.py b/pydocx/openxml/shared_math/object_distribution.py new file mode 100644 index 00000000..0a1df4ab --- /dev/null +++ b/pydocx/openxml/shared_math/object_distribution.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class ObjectDistribution(XmlModel): + XML_TAG = 'objDist' diff --git a/pydocx/openxml/shared_math/omath.py b/pydocx/openxml/shared_math/omath.py new file mode 100644 index 00000000..9450bb3a --- /dev/null +++ b/pydocx/openxml/shared_math/omath.py @@ -0,0 +1,20 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.wordprocessing.run import Run +from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction + + +class OMath(XmlModel): + + XML_TAG = 'oMath' + children = XmlCollection( + DelimiterFunction, + NaryOperatorFunction, + Run + ) diff --git a/pydocx/openxml/shared_math/phantom_function.py b/pydocx/openxml/shared_math/phantom_function.py new file mode 100644 index 00000000..b499cabe --- /dev/null +++ b/pydocx/openxml/shared_math/phantom_function.py @@ -0,0 +1,18 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base import Base +# from pydocx.openxml.shared_math.phantom_properties import PhantomProperties + + +class PhantomFunction(XmlModel): + + XML_TAG = 'phant' + children = XmlCollection( + Base, + # PhantomProperties + ) diff --git a/pydocx/openxml/shared_math/row_spacing.py b/pydocx/openxml/shared_math/row_spacing.py new file mode 100644 index 00000000..91a41b41 --- /dev/null +++ b/pydocx/openxml/shared_math/row_spacing.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class RowSpacing(XmlModel): + XML_TAG = 'rSp' diff --git a/pydocx/openxml/shared_math/row_spacing_rule.py b/pydocx/openxml/shared_math/row_spacing_rule.py new file mode 100644 index 00000000..b3b1ace1 --- /dev/null +++ b/pydocx/openxml/shared_math/row_spacing_rule.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class RowSpacingRule(XmlModel): + XML_TAG = 'rSpRule' diff --git a/pydocx/openxml/shared_math/subscript.py b/pydocx/openxml/shared_math/subscript.py new file mode 100644 index 00000000..217b0aeb --- /dev/null +++ b/pydocx/openxml/shared_math/subscript.py @@ -0,0 +1,15 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.wordprocessing.run import Run + + +class Subscript(XmlModel): + XML_TAG = 'nary' + children = XmlCollection( + Run + ) diff --git a/pydocx/openxml/shared_math/superscript.py b/pydocx/openxml/shared_math/superscript.py new file mode 100644 index 00000000..1d33e192 --- /dev/null +++ b/pydocx/openxml/shared_math/superscript.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.wordprocessing.run import Run + + +class Superscript(XmlModel): + XML_TAG = 'nary' + children = XmlCollection( + DelimiterFunction, + Run + ) diff --git a/pydocx/openxml/shared_math/superscript_function.py b/pydocx/openxml/shared_math/superscript_function.py new file mode 100644 index 00000000..a46bea58 --- /dev/null +++ b/pydocx/openxml/shared_math/superscript_function.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.superscript import Superscript + + +class SuperscriptFunction(XmlModel): + XML_TAG = 'sSup' + children = XmlCollection( + Base, + Superscript + ) diff --git a/pydocx/openxml/shared_math/upper_limit_function.py b/pydocx/openxml/shared_math/upper_limit_function.py new file mode 100644 index 00000000..182fcdc8 --- /dev/null +++ b/pydocx/openxml/shared_math/upper_limit_function.py @@ -0,0 +1,23 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.upper_limit_properties import UpperLimitProperties + + +class UpperLimitFunction(XmlModel): + XML_TAG = 'limUpp' + children = XmlCollection( + Base, + UpperLimitProperties + ) + + +# solves circular import +from pydocx.openxml.shared_math.limit import Limit # noqa + +UpperLimitFunction.children.types.add(Limit) diff --git a/pydocx/openxml/shared_math/upper_limit_properties.py b/pydocx/openxml/shared_math/upper_limit_properties.py new file mode 100644 index 00000000..0120c8bd --- /dev/null +++ b/pydocx/openxml/shared_math/upper_limit_properties.py @@ -0,0 +1,15 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.control_properties import ControlProperties + + +class UpperLimitProperties(XmlModel): + XML_TAG = 'limUppPr' + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/wordprocessing/paragraph.py b/pydocx/openxml/wordprocessing/paragraph.py index af59dd7b..282b4069 100644 --- a/pydocx/openxml/wordprocessing/paragraph.py +++ b/pydocx/openxml/wordprocessing/paragraph.py @@ -6,6 +6,7 @@ ) from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math import OMath from pydocx.openxml.wordprocessing.hyperlink import Hyperlink from pydocx.openxml.wordprocessing.paragraph_properties import ParagraphProperties # noqa from pydocx.openxml.wordprocessing.run import Run @@ -24,6 +25,7 @@ class Paragraph(XmlModel): properties = XmlChild(type=ParagraphProperties) children = XmlCollection( + OMath, Run, Hyperlink, SmartTagRun, From a584bdb54c9b87b99e6baa1722555c90995a0e18 Mon Sep 17 00:00:00 2001 From: iury Date: Mon, 25 Apr 2016 23:52:44 -0300 Subject: [PATCH 2/5] more XmlModels --- pydocx/openxml/shared_math/__init__.py | 6 +- pydocx/openxml/shared_math/accent.py | 6 +- .../openxml/shared_math/accent_properties.py | 3 +- .../shared_math/argument_properties.py | 7 +-- pydocx/openxml/shared_math/bar.py | 4 +- pydocx/openxml/shared_math/bar_properties.py | 4 +- pydocx/openxml/shared_math/border_box.py | 6 +- .../shared_math/border_box_properties.py | 24 +++++--- pydocx/openxml/shared_math/box.py | 4 +- pydocx/openxml/shared_math/box_properties.py | 16 ++++-- .../shared_math/break_on_binary_operators.py | 12 ++++ .../break_on_binary_subtraction.py | 12 ++++ pydocx/openxml/shared_math/brk.py | 13 +++++ pydocx/openxml/shared_math/character.py | 17 ++++++ .../openxml/shared_math/control_properties.py | 1 + .../shared_math/default_justification.py | 12 ++++ pydocx/openxml/shared_math/degree.py | 21 +++---- .../delimiter_beginning_character.py | 12 ++++ .../shared_math/delimiter_ending_character.py | 12 ++++ .../openxml/shared_math/delimiter_function.py | 5 +- .../shared_math/delimiter_properties.py | 24 +++++++- pydocx/openxml/shared_math/denominator.py | 41 ++++++++++++++ pydocx/openxml/shared_math/differential.py | 12 ++++ pydocx/openxml/shared_math/element.py | 56 +++++++++++++++++++ .../shared_math/equation_array_function.py | 4 +- .../shared_math/equation_array_properties.py | 10 ++-- .../openxml/shared_math/fraction_function.py | 3 + .../shared_math/fraction_properties.py | 18 ++++++ .../shared_math/function_apply_function.py | 5 +- pydocx/openxml/shared_math/function_name.py | 21 +++---- .../shared_math/function_properties.py | 1 + .../shared_math/group_character_function.py | 4 +- .../shared_math/group_character_properties.py | 10 +++- pydocx/openxml/shared_math/grow.py | 13 +++++ pydocx/openxml/shared_math/hide_bottom.py | 13 +++++ pydocx/openxml/shared_math/hide_degree.py | 12 ++++ pydocx/openxml/shared_math/hide_left.py | 13 +++++ pydocx/openxml/shared_math/hide_right.py | 13 +++++ pydocx/openxml/shared_math/hide_top.py | 13 +++++ .../shared_math/integral_limit_locations.py | 13 +++++ .../shared_math/inter_equation_spacing.py | 13 +++++ pydocx/openxml/shared_math/limit.py | 24 ++++---- .../shared_math/lower_limit_function.py | 4 +- .../shared_math/matrix_column_count.py | 12 ++++ .../openxml/shared_math/matrix_column_gap.py | 12 ++++ .../shared_math/matrix_column_gap_rule.py | 12 ++++ .../shared_math/matrix_column_spacing.py | 12 ++++ pydocx/openxml/shared_math/matrix_function.py | 4 +- .../openxml/shared_math/matrix_properties.py | 6 +- .../shared_math/nary_operator_function.py | 4 +- pydocx/openxml/shared_math/nary_properties.py | 3 +- .../openxml/shared_math/phantom_function.py | 8 +-- .../pre_sub_superscript_function.py | 23 ++++++++ .../pre_sub_superscript_properties.py | 15 +++++ .../openxml/shared_math/radical_function.py | 19 +++++++ .../openxml/shared_math/radical_properties.py | 17 ++++++ pydocx/openxml/shared_math/strike_bltr.py | 12 ++++ pydocx/openxml/shared_math/strike_h.py | 12 ++++ pydocx/openxml/shared_math/strike_tlbr.py | 12 ++++ pydocx/openxml/shared_math/strike_v.py | 12 ++++ .../shared_math/sub_superscript_function.py | 21 +++++++ .../shared_math/sub_superscript_properties.py | 17 ++++++ .../openxml/shared_math/subscript_function.py | 19 +++++++ .../{base.py => subscript_properties.py} | 9 ++- .../shared_math/superscript_function.py | 4 +- .../shared_math/upper_limit_function.py | 6 +- .../shared_math/upper_limit_properties.py | 2 +- .../shared_math/use_display_math_defaults.py | 12 ++++ 68 files changed, 714 insertions(+), 108 deletions(-) create mode 100644 pydocx/openxml/shared_math/break_on_binary_operators.py create mode 100644 pydocx/openxml/shared_math/break_on_binary_subtraction.py create mode 100644 pydocx/openxml/shared_math/brk.py create mode 100644 pydocx/openxml/shared_math/character.py create mode 100644 pydocx/openxml/shared_math/default_justification.py create mode 100644 pydocx/openxml/shared_math/delimiter_beginning_character.py create mode 100644 pydocx/openxml/shared_math/delimiter_ending_character.py create mode 100644 pydocx/openxml/shared_math/differential.py create mode 100644 pydocx/openxml/shared_math/element.py create mode 100644 pydocx/openxml/shared_math/fraction_properties.py create mode 100644 pydocx/openxml/shared_math/grow.py create mode 100644 pydocx/openxml/shared_math/hide_bottom.py create mode 100644 pydocx/openxml/shared_math/hide_degree.py create mode 100644 pydocx/openxml/shared_math/hide_left.py create mode 100644 pydocx/openxml/shared_math/hide_right.py create mode 100644 pydocx/openxml/shared_math/hide_top.py create mode 100644 pydocx/openxml/shared_math/integral_limit_locations.py create mode 100644 pydocx/openxml/shared_math/inter_equation_spacing.py create mode 100644 pydocx/openxml/shared_math/matrix_column_count.py create mode 100644 pydocx/openxml/shared_math/matrix_column_gap.py create mode 100644 pydocx/openxml/shared_math/matrix_column_gap_rule.py create mode 100644 pydocx/openxml/shared_math/matrix_column_spacing.py create mode 100644 pydocx/openxml/shared_math/pre_sub_superscript_function.py create mode 100644 pydocx/openxml/shared_math/pre_sub_superscript_properties.py create mode 100644 pydocx/openxml/shared_math/radical_function.py create mode 100644 pydocx/openxml/shared_math/radical_properties.py create mode 100644 pydocx/openxml/shared_math/strike_bltr.py create mode 100644 pydocx/openxml/shared_math/strike_h.py create mode 100644 pydocx/openxml/shared_math/strike_tlbr.py create mode 100644 pydocx/openxml/shared_math/strike_v.py create mode 100644 pydocx/openxml/shared_math/sub_superscript_function.py create mode 100644 pydocx/openxml/shared_math/sub_superscript_properties.py create mode 100644 pydocx/openxml/shared_math/subscript_function.py rename pydocx/openxml/shared_math/{base.py => subscript_properties.py} (52%) create mode 100644 pydocx/openxml/shared_math/use_display_math_defaults.py diff --git a/pydocx/openxml/shared_math/__init__.py b/pydocx/openxml/shared_math/__init__.py index 1953b078..db6e10bc 100644 --- a/pydocx/openxml/shared_math/__init__.py +++ b/pydocx/openxml/shared_math/__init__.py @@ -6,7 +6,7 @@ from pydocx.openxml.shared_math.argument_size import ArgumentSize from pydocx.openxml.shared_math.bar import Bar from pydocx.openxml.shared_math.bar_properties import BarProperties -from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.base_justification import BaseJustification from pydocx.openxml.shared_math.border_box import BorderBox from pydocx.openxml.shared_math.border_box_properties import BorderBoxProperties @@ -34,7 +34,7 @@ from pydocx.openxml.shared_math.superscript import Superscript from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction -Base.children.types.add(FractionFunction) +Element.children.types.add(FractionFunction) __all__ = [ @@ -46,7 +46,7 @@ 'ArgumentSize', 'Bar', 'BarProperties', - 'Base', + 'Element', 'BaseJustification', 'BorderBox', 'BorderBoxProperties', diff --git a/pydocx/openxml/shared_math/accent.py b/pydocx/openxml/shared_math/accent.py index 67e25eb6..d31dd7a3 100644 --- a/pydocx/openxml/shared_math/accent.py +++ b/pydocx/openxml/shared_math/accent.py @@ -6,13 +6,13 @@ from pydocx.models import XmlModel, XmlCollection from pydocx.openxml.shared_math.accent_properties import AccentProperties -from pydocx.openxml.shared_math import base +from pydocx.openxml.shared_math.element import Element class Accent(XmlModel): - XML_TAG = 'acc' + children = XmlCollection( AccentProperties, - base.Base + Element ) diff --git a/pydocx/openxml/shared_math/accent_properties.py b/pydocx/openxml/shared_math/accent_properties.py index ab5b8811..3dca943b 100644 --- a/pydocx/openxml/shared_math/accent_properties.py +++ b/pydocx/openxml/shared_math/accent_properties.py @@ -5,13 +5,14 @@ ) from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.character import Character from pydocx.openxml.shared_math.control_properties import ControlProperties class AccentProperties(XmlModel): XML_TAG = 'accPr' - chr = XmlChild(name='chr', attrname='val') + chr = XmlChild(type=Character, attrname='val') children = XmlCollection( ControlProperties ) diff --git a/pydocx/openxml/shared_math/argument_properties.py b/pydocx/openxml/shared_math/argument_properties.py index 1c56beff..154301a0 100644 --- a/pydocx/openxml/shared_math/argument_properties.py +++ b/pydocx/openxml/shared_math/argument_properties.py @@ -4,12 +4,11 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlCollection +from pydocx.models import XmlModel, XmlChild from pydocx.openxml.shared_math.argument_size import ArgumentSize class ArgumentProperties(XmlModel): XML_TAG = 'argPr' - children = XmlCollection( - ArgumentSize - ) + + arg_sz = XmlChild(type=ArgumentSize, attrname='val') diff --git a/pydocx/openxml/shared_math/bar.py b/pydocx/openxml/shared_math/bar.py index c50e1038..d8628897 100644 --- a/pydocx/openxml/shared_math/bar.py +++ b/pydocx/openxml/shared_math/bar.py @@ -6,12 +6,12 @@ from pydocx.models import XmlModel, XmlCollection from pydocx.openxml.shared_math.bar_properties import BarProperties -from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.element import Element class Bar(XmlModel): XML_TAG = 'bar' children = XmlCollection( BarProperties, - Base + Element ) diff --git a/pydocx/openxml/shared_math/bar_properties.py b/pydocx/openxml/shared_math/bar_properties.py index f87181b3..50323192 100644 --- a/pydocx/openxml/shared_math/bar_properties.py +++ b/pydocx/openxml/shared_math/bar_properties.py @@ -6,11 +6,13 @@ from pydocx.models import XmlModel, XmlCollection, XmlChild from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.position import Position class BarProperties(XmlModel): XML_TAG = 'barPr' - pos = XmlChild(name='pos', attrname='val') + + pos = XmlChild(type=Position, attrname='val') children = XmlCollection( ControlProperties ) diff --git a/pydocx/openxml/shared_math/border_box.py b/pydocx/openxml/shared_math/border_box.py index d48a59fe..bfb9dac9 100644 --- a/pydocx/openxml/shared_math/border_box.py +++ b/pydocx/openxml/shared_math/border_box.py @@ -5,14 +5,14 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.shared_math.base import Base from pydocx.openxml.shared_math.border_box_properties import BorderBoxProperties +from pydocx.openxml.shared_math.element import Element class BorderBox(XmlModel): - XML_TAG = 'borderBox' + children = XmlCollection( - Base, BorderBoxProperties, + Element ) diff --git a/pydocx/openxml/shared_math/border_box_properties.py b/pydocx/openxml/shared_math/border_box_properties.py index c3f4a4ad..1e8fdfe8 100644 --- a/pydocx/openxml/shared_math/border_box_properties.py +++ b/pydocx/openxml/shared_math/border_box_properties.py @@ -6,20 +6,28 @@ from pydocx.models import XmlModel, XmlCollection, XmlChild from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.hide_bottom import HideBottom +from pydocx.openxml.shared_math.hide_left import HideLeft +from pydocx.openxml.shared_math.hide_right import HideRight +from pydocx.openxml.shared_math.hide_top import HideTop +from pydocx.openxml.shared_math.strike_h import StrikeH +from pydocx.openxml.shared_math.strike_v import StrikeV +from pydocx.openxml.shared_math.strike_bltr import StrikeBLTR +from pydocx.openxml.shared_math.strike_tlbr import StrikeTLBR class BorderBoxProperties(XmlModel): XML_TAG = 'borderBoxPr' - hide_top = XmlChild(name='hideTop', attrname='val') - hide_bot = XmlChild(name='hideBot', attrname='val') - hide_left = XmlChild(name='hideLeft', attrname='val') - hide_right = XmlChild(name='hideRight', attrname='val') - strike_h = XmlChild(name='strikeH', attrname='val') - strike_v = XmlChild(name='strikeV', attrname='val') - strike_bltr = XmlChild(name='strikeBLTR', attrname='val') - strike_tlbr = XmlChild(name='strikeTLBR', attrname='val') + hide_top = XmlChild(type=HideTop, attrname='val') + hide_bot = XmlChild(type=HideBottom, attrname='val') + hide_left = XmlChild(type=HideLeft, attrname='val') + hide_right = XmlChild(type=HideRight, attrname='val') + strike_h = XmlChild(type=StrikeH, attrname='val') + strike_v = XmlChild(type=StrikeV, attrname='val') + strike_bltr = XmlChild(type=StrikeBLTR, attrname='val') + strike_tlbr = XmlChild(type=StrikeTLBR, attrname='val') children = XmlCollection( ControlProperties diff --git a/pydocx/openxml/shared_math/box.py b/pydocx/openxml/shared_math/box.py index 436838f8..716dcf51 100644 --- a/pydocx/openxml/shared_math/box.py +++ b/pydocx/openxml/shared_math/box.py @@ -5,7 +5,7 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.box_properties import BoxProperties @@ -13,6 +13,6 @@ class Box(XmlModel): XML_TAG = 'box' children = XmlCollection( - Base, + Element, BoxProperties ) diff --git a/pydocx/openxml/shared_math/box_properties.py b/pydocx/openxml/shared_math/box_properties.py index 7a0dd63c..379b92c8 100644 --- a/pydocx/openxml/shared_math/box_properties.py +++ b/pydocx/openxml/shared_math/box_properties.py @@ -5,18 +5,22 @@ ) from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.align import Align +from pydocx.openxml.shared_math.brk import Break +from pydocx.openxml.shared_math.differential import Differential +from pydocx.openxml.shared_math.no_break import NoBreak +from pydocx.openxml.shared_math.operator_emulator import OperatorEmulator from pydocx.openxml.shared_math.control_properties import ControlProperties class BoxProperties(XmlModel): XML_TAG = 'boxPr' - - op_emu = XmlChild(name='opEmu', attrname='val') - no_break = XmlChild(name='noBreak', attrname='val') - diff = XmlChild(name='diff', attrname='val') - brk = XmlChild(name='brk', attrname='val') - aln = XmlChild(name='aln', attrname='val') + aln = XmlChild(type=Align, attrname='val') + brk = XmlChild(type=Break, attrname='val') + diff = XmlChild(type=Differential, attrname='val') + no_break = XmlChild(type=NoBreak, attrname='val') + op_emu = XmlChild(type=OperatorEmulator, attrname='val') children = XmlCollection( ControlProperties ) diff --git a/pydocx/openxml/shared_math/break_on_binary_operators.py b/pydocx/openxml/shared_math/break_on_binary_operators.py new file mode 100644 index 00000000..4617ed5b --- /dev/null +++ b/pydocx/openxml/shared_math/break_on_binary_operators.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class BreakOnBinaryOperators(XmlModel): + + XML_TAG = 'brkBin' diff --git a/pydocx/openxml/shared_math/break_on_binary_subtraction.py b/pydocx/openxml/shared_math/break_on_binary_subtraction.py new file mode 100644 index 00000000..edf470b7 --- /dev/null +++ b/pydocx/openxml/shared_math/break_on_binary_subtraction.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class BreakOnBinarySubtraction(XmlModel): + + XML_TAG = 'brkBinSub' diff --git a/pydocx/openxml/shared_math/brk.py b/pydocx/openxml/shared_math/brk.py new file mode 100644 index 00000000..7eee670c --- /dev/null +++ b/pydocx/openxml/shared_math/brk.py @@ -0,0 +1,13 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection + + +class Break(XmlModel): + + XML_TAG = 'brk' + children = XmlCollection() diff --git a/pydocx/openxml/shared_math/character.py b/pydocx/openxml/shared_math/character.py new file mode 100644 index 00000000..a49fe243 --- /dev/null +++ b/pydocx/openxml/shared_math/character.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class Character(XmlModel): + """ + Can be a accent character, + Group character or + n-ary operator character + """ + + XML_TAG = 'chr' diff --git a/pydocx/openxml/shared_math/control_properties.py b/pydocx/openxml/shared_math/control_properties.py index 6b9a3442..7d37d3fc 100644 --- a/pydocx/openxml/shared_math/control_properties.py +++ b/pydocx/openxml/shared_math/control_properties.py @@ -12,6 +12,7 @@ class ControlProperties(XmlModel): XML_TAG = 'ctrlPr' + children = XmlCollection( DeletedRun, InsertedRun, diff --git a/pydocx/openxml/shared_math/default_justification.py b/pydocx/openxml/shared_math/default_justification.py new file mode 100644 index 00000000..69f90e79 --- /dev/null +++ b/pydocx/openxml/shared_math/default_justification.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class DefaultJustification(XmlModel): + + XML_TAG = 'defJc' diff --git a/pydocx/openxml/shared_math/degree.py b/pydocx/openxml/shared_math/degree.py index af17e3d1..bb4ca055 100644 --- a/pydocx/openxml/shared_math/degree.py +++ b/pydocx/openxml/shared_math/degree.py @@ -19,16 +19,17 @@ from pydocx.openxml.shared_math.matrix_function import MatrixFunction from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction from pydocx.openxml.shared_math.phantom_function import PhantomFunction -# from pydocx.openxml.shared_math.radical_function import RadicalFunction -# from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction -# from pydocx.openxml.shared_math.subscript_function import SubScriptFunction -# from pydocx.openxml.shared_math.sub_superscript_function import SubSuperScriptFunction -# from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction +from pydocx.openxml.shared_math.radical_function import RadicalFunction +from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +from pydocx.openxml.shared_math.subscript_function import SubscriptFunction +from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction +from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction from pydocx.openxml.wordprocessing.run import Run class Degree(XmlModel): XML_TAG = 'deg' + children = XmlCollection( Accent, Bar, @@ -44,10 +45,10 @@ class Degree(XmlModel): MatrixFunction, NaryOperatorFunction, PhantomFunction, - # RadicalFunction, - # PreSubSuperscriptFunction, - # SubScriptFunction, - # SubSuperScriptFunction, - # SuperscriptFunction, + RadicalFunction, + PreSubSuperscriptFunction, + SubscriptFunction, + SubSuperscriptFunction, + SuperscriptFunction, Run ) diff --git a/pydocx/openxml/shared_math/delimiter_beginning_character.py b/pydocx/openxml/shared_math/delimiter_beginning_character.py new file mode 100644 index 00000000..39a445c8 --- /dev/null +++ b/pydocx/openxml/shared_math/delimiter_beginning_character.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class DelimiterBeginningCharacter(XmlModel): + + XML_TAG = 'begChr' diff --git a/pydocx/openxml/shared_math/delimiter_ending_character.py b/pydocx/openxml/shared_math/delimiter_ending_character.py new file mode 100644 index 00000000..db70e02d --- /dev/null +++ b/pydocx/openxml/shared_math/delimiter_ending_character.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class DelimiterEndingCharacter(XmlModel): + + XML_TAG = 'endChr' diff --git a/pydocx/openxml/shared_math/delimiter_function.py b/pydocx/openxml/shared_math/delimiter_function.py index af2a0ab8..6f93c5b2 100644 --- a/pydocx/openxml/shared_math/delimiter_function.py +++ b/pydocx/openxml/shared_math/delimiter_function.py @@ -5,13 +5,14 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.delimiter_properties import DelimiterProperties class DelimiterFunction(XmlModel): XML_TAG = 'd' + children = XmlCollection( - Base, + Element, DelimiterProperties ) diff --git a/pydocx/openxml/shared_math/delimiter_properties.py b/pydocx/openxml/shared_math/delimiter_properties.py index 4bcafa73..b84c6c64 100644 --- a/pydocx/openxml/shared_math/delimiter_properties.py +++ b/pydocx/openxml/shared_math/delimiter_properties.py @@ -4,10 +4,28 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlChild +from pydocx.models import XmlModel, XmlChild, XmlCollection +from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.delimiter_beginning_character import ( + DelimiterBeginningCharacter +) +from pydocx.openxml.shared_math.delimiter_separator_character import ( + DelimiterSeparatorCharacter +) +from pydocx.openxml.shared_math.delimiter_ending_character import DelimiterEndingCharacter +from pydocx.openxml.shared_math.grow import Grow +from pydocx.openxml.shared_math.shape import Shape class DelimiterProperties(XmlModel): XML_TAG = 'dPr' - beg_chr = XmlChild(name='begChr', attrname='val') - end_chr = XmlChild(name='endChr', attrname='val') + + beg_chr = XmlChild(type=DelimiterBeginningCharacter, attrname='val') + sep_chs = XmlChild(type=DelimiterSeparatorCharacter, attrname='val') + end_chr = XmlChild(type=DelimiterEndingCharacter, attrname='val') + grow = XmlChild(type=Grow, attrname='val') + shape = XmlChild(type=Shape, attrname='val') + + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/denominator.py b/pydocx/openxml/shared_math/denominator.py index 3d9d1d4b..86ab91fa 100644 --- a/pydocx/openxml/shared_math/denominator.py +++ b/pydocx/openxml/shared_math/denominator.py @@ -5,11 +5,52 @@ ) from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.argument_properties import ArgumentProperties +from pydocx.openxml.shared_math.accent import Accent +from pydocx.openxml.shared_math.bar import Bar +from pydocx.openxml.shared_math.box import Box +from pydocx.openxml.shared_math.border_box import BorderBox +from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.fraction_function import FractionFunction +from pydocx.openxml.shared_math.function_apply_function import FunctionApplyFunction +from pydocx.openxml.shared_math.group_character_function import GroupCharacterFunction +from pydocx.openxml.shared_math.lower_limit_function import LowerLimitFunction +from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction +from pydocx.openxml.shared_math.matrix_function import MatrixFunction +from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction +from pydocx.openxml.shared_math.phantom_function import PhantomFunction +from pydocx.openxml.shared_math.radical_function import RadicalFunction +from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +from pydocx.openxml.shared_math.subscript_function import SubscriptFunction +from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction +from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction from pydocx.openxml.wordprocessing.run import Run class Denominator(XmlModel): XML_TAG = 'den' + children = XmlCollection( + ArgumentProperties, + Accent, + Bar, + Box, + BorderBox, + ControlProperties, + DelimiterFunction, + FractionFunction, + FunctionApplyFunction, + GroupCharacterFunction, + LowerLimitFunction, + UpperLimitFunction, + MatrixFunction, + NaryOperatorFunction, + PhantomFunction, + RadicalFunction, + PreSubSuperscriptFunction, + SubscriptFunction, + SubSuperscriptFunction, + SuperscriptFunction, Run ) diff --git a/pydocx/openxml/shared_math/differential.py b/pydocx/openxml/shared_math/differential.py new file mode 100644 index 00000000..9d15645c --- /dev/null +++ b/pydocx/openxml/shared_math/differential.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class Differential(XmlModel): + + XML_TAG = 'diff' diff --git a/pydocx/openxml/shared_math/element.py b/pydocx/openxml/shared_math/element.py new file mode 100644 index 00000000..a4c61bda --- /dev/null +++ b/pydocx/openxml/shared_math/element.py @@ -0,0 +1,56 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.accent import Accent +from pydocx.openxml.shared_math.bar import Bar +from pydocx.openxml.shared_math.box import Box +from pydocx.openxml.shared_math.border_box import BorderBox +from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.equation_array_function import EquationArrayFunction +from pydocx.openxml.shared_math.fraction_function import FractionFunction +from pydocx.openxml.shared_math.function_apply_function import FunctionApplyFunction +from pydocx.openxml.shared_math.group_character_function import GroupCharacterFunction +from pydocx.openxml.shared_math.lower_limit_function import LowerLimitFunction +from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction +from pydocx.openxml.shared_math.matrix_function import MatrixFunction +from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction +from pydocx.openxml.shared_math.phantom_function import PhantomFunction +from pydocx.openxml.shared_math.radical_function import RadicalFunction +from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +from pydocx.openxml.shared_math.subscript_function import SubscriptFunction +from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction +from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction +from pydocx.openxml.wordprocessing.run import Run + + +class Element(XmlModel): + XML_TAG = 'e' + + children = XmlCollection( + Accent, + Bar, + Box, + BorderBox, + ControlProperties, + DelimiterFunction, + EquationArrayFunction, + FractionFunction, + FunctionApplyFunction, + GroupCharacterFunction, + LowerLimitFunction, + UpperLimitFunction, + MatrixFunction, + NaryOperatorFunction, + PhantomFunction, + RadicalFunction, + PreSubSuperscriptFunction, + SubscriptFunction, + SubSuperscriptFunction, + SuperscriptFunction, + Run + ) diff --git a/pydocx/openxml/shared_math/equation_array_function.py b/pydocx/openxml/shared_math/equation_array_function.py index c6bb7cc2..a4794883 100644 --- a/pydocx/openxml/shared_math/equation_array_function.py +++ b/pydocx/openxml/shared_math/equation_array_function.py @@ -5,7 +5,7 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.equation_array_properties import EquationArrayProperties @@ -13,6 +13,6 @@ class EquationArrayFunction(XmlModel): XML_TAG = 'eqArr' children = XmlCollection( - Base, + Element, EquationArrayProperties ) diff --git a/pydocx/openxml/shared_math/equation_array_properties.py b/pydocx/openxml/shared_math/equation_array_properties.py index d99ceda6..d331f39a 100644 --- a/pydocx/openxml/shared_math/equation_array_properties.py +++ b/pydocx/openxml/shared_math/equation_array_properties.py @@ -4,8 +4,9 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlCollection +from pydocx.models import XmlModel, XmlCollection, XmlChild from pydocx.openxml.shared_math.base_justification import BaseJustification +from pydocx.openxml.shared_math.control_properties import ControlProperties from pydocx.openxml.shared_math.maximum_distribution import MaximumDistribution from pydocx.openxml.shared_math.object_distribution import ObjectDistribution from pydocx.openxml.shared_math.row_spacing_rule import RowSpacingRule @@ -15,10 +16,11 @@ class EquationArrayProperties(XmlModel): XML_TAG = 'eqArrPr' + base_jc = XmlChild(type=BaseJustification, attrname='val') + rsp_rule = XmlChild(type=RowSpacingRule, attrname='val') + rsp = XmlChild(type=RowSpacing, attrname='val') children = XmlCollection( - BaseJustification, MaximumDistribution, ObjectDistribution, - RowSpacing, - RowSpacingRule + ControlProperties ) diff --git a/pydocx/openxml/shared_math/fraction_function.py b/pydocx/openxml/shared_math/fraction_function.py index bc2f63e2..df426787 100644 --- a/pydocx/openxml/shared_math/fraction_function.py +++ b/pydocx/openxml/shared_math/fraction_function.py @@ -5,13 +5,16 @@ ) from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.fraction_properties import FractionProperties from pydocx.openxml.shared_math.numerator import Numerator from pydocx.openxml.shared_math.denominator import Denominator class FractionFunction(XmlModel): XML_TAG = 'f' + children = XmlCollection( + FractionProperties, Numerator, Denominator ) diff --git a/pydocx/openxml/shared_math/fraction_properties.py b/pydocx/openxml/shared_math/fraction_properties.py new file mode 100644 index 00000000..fd0ef1ac --- /dev/null +++ b/pydocx/openxml/shared_math/fraction_properties.py @@ -0,0 +1,18 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.type import Type + + +class FractionProperties(XmlModel): + + XML_TAG = 'fPr' + type = XmlChild(type=Type, attrname='val') + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/function_apply_function.py b/pydocx/openxml/shared_math/function_apply_function.py index 55d160fa..6d70849e 100644 --- a/pydocx/openxml/shared_math/function_apply_function.py +++ b/pydocx/openxml/shared_math/function_apply_function.py @@ -5,15 +5,16 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.function_properties import FunctionProperties class FunctionApplyFunction(XmlModel): XML_TAG = 'func' + children = XmlCollection( FunctionProperties, - Base + Element ) diff --git a/pydocx/openxml/shared_math/function_name.py b/pydocx/openxml/shared_math/function_name.py index dec0dd44..f25e76d8 100644 --- a/pydocx/openxml/shared_math/function_name.py +++ b/pydocx/openxml/shared_math/function_name.py @@ -19,16 +19,17 @@ from pydocx.openxml.shared_math.matrix_function import MatrixFunction from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction from pydocx.openxml.shared_math.phantom_function import PhantomFunction -# from pydocx.openxml.shared_math.radical_function import RadicalFunction -# from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction -# from pydocx.openxml.shared_math.subscript_function import SubscriptFunction -# from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction -# from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction +from pydocx.openxml.shared_math.radical_function import RadicalFunction +from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +from pydocx.openxml.shared_math.subscript_function import SubscriptFunction +from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction +from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction from pydocx.openxml.wordprocessing.run import Run class FunctionName(XmlModel): XML_TAG = 'fName' + children = XmlCollection( Accent, Bar, @@ -44,10 +45,10 @@ class FunctionName(XmlModel): MatrixFunction, NaryOperatorFunction, PhantomFunction, - # RadicalFunction, - # PreSubSuperscriptFunction, - # SubscriptFunction, - # SubSuperscriptFunction, - # SuperscriptFunction, + RadicalFunction, + PreSubSuperscriptFunction, + SubscriptFunction, + SubSuperscriptFunction, + SuperscriptFunction, Run ) diff --git a/pydocx/openxml/shared_math/function_properties.py b/pydocx/openxml/shared_math/function_properties.py index 6e01f047..82e1294f 100644 --- a/pydocx/openxml/shared_math/function_properties.py +++ b/pydocx/openxml/shared_math/function_properties.py @@ -10,6 +10,7 @@ class FunctionProperties(XmlModel): XML_TAG = 'funcPr' + children = XmlCollection( ControlProperties, ) diff --git a/pydocx/openxml/shared_math/group_character_function.py b/pydocx/openxml/shared_math/group_character_function.py index eb2b5bec..69167702 100644 --- a/pydocx/openxml/shared_math/group_character_function.py +++ b/pydocx/openxml/shared_math/group_character_function.py @@ -5,13 +5,13 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.group_character_properties import GroupCharacterProperties class GroupCharacterFunction(XmlModel): XML_TAG = 'groupChr' children = XmlCollection( - Base, + Element, GroupCharacterProperties ) diff --git a/pydocx/openxml/shared_math/group_character_properties.py b/pydocx/openxml/shared_math/group_character_properties.py index a25b4786..4e99e4cb 100644 --- a/pydocx/openxml/shared_math/group_character_properties.py +++ b/pydocx/openxml/shared_math/group_character_properties.py @@ -5,14 +5,18 @@ ) from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.character import Character from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.position import Position +from pydocx.openxml.shared_math.vertical_justification import VerticalJustification class GroupCharacterProperties(XmlModel): XML_TAG = 'groupChrPr' - chr = XmlChild(name='chr', attrname='val') - pos = XmlChild(name='pos', attrname='val') - vert_jc = XmlChild(name='vertJc', attrname='val') + + chr = XmlChild(type=Character, attrname='val') + pos = XmlChild(type=Position, attrname='val') + vert_jc = XmlChild(type=VerticalJustification, attrname='val') children = XmlCollection( ControlProperties, ) diff --git a/pydocx/openxml/shared_math/grow.py b/pydocx/openxml/shared_math/grow.py new file mode 100644 index 00000000..41f1f6b3 --- /dev/null +++ b/pydocx/openxml/shared_math/grow.py @@ -0,0 +1,13 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection + + +class Grow(XmlModel): + + XML_TAG = 'grow' + children = XmlCollection() diff --git a/pydocx/openxml/shared_math/hide_bottom.py b/pydocx/openxml/shared_math/hide_bottom.py new file mode 100644 index 00000000..4826ec74 --- /dev/null +++ b/pydocx/openxml/shared_math/hide_bottom.py @@ -0,0 +1,13 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection + + +class HideBottom(XmlModel): + + XML_TAG = 'hideBot' + children = XmlCollection() diff --git a/pydocx/openxml/shared_math/hide_degree.py b/pydocx/openxml/shared_math/hide_degree.py new file mode 100644 index 00000000..56444462 --- /dev/null +++ b/pydocx/openxml/shared_math/hide_degree.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class HideDegree(XmlModel): + + XML_TAG = 'degHide' diff --git a/pydocx/openxml/shared_math/hide_left.py b/pydocx/openxml/shared_math/hide_left.py new file mode 100644 index 00000000..8011bcf2 --- /dev/null +++ b/pydocx/openxml/shared_math/hide_left.py @@ -0,0 +1,13 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection + + +class HideLeft(XmlModel): + + XML_TAG = 'hideLeft' + children = XmlCollection() diff --git a/pydocx/openxml/shared_math/hide_right.py b/pydocx/openxml/shared_math/hide_right.py new file mode 100644 index 00000000..9d2e7390 --- /dev/null +++ b/pydocx/openxml/shared_math/hide_right.py @@ -0,0 +1,13 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection + + +class HideRight(XmlModel): + + XML_TAG = 'hideRight' + children = XmlCollection() diff --git a/pydocx/openxml/shared_math/hide_top.py b/pydocx/openxml/shared_math/hide_top.py new file mode 100644 index 00000000..8098ce81 --- /dev/null +++ b/pydocx/openxml/shared_math/hide_top.py @@ -0,0 +1,13 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection + + +class HideTop(XmlModel): + + XML_TAG = 'hideTop' + children = XmlCollection() diff --git a/pydocx/openxml/shared_math/integral_limit_locations.py b/pydocx/openxml/shared_math/integral_limit_locations.py new file mode 100644 index 00000000..f5e624e3 --- /dev/null +++ b/pydocx/openxml/shared_math/integral_limit_locations.py @@ -0,0 +1,13 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection + + +class IntegralLimitLocations(XmlModel): + + XML_TAG = 'intLim' + children = XmlCollection() diff --git a/pydocx/openxml/shared_math/inter_equation_spacing.py b/pydocx/openxml/shared_math/inter_equation_spacing.py new file mode 100644 index 00000000..66002dc8 --- /dev/null +++ b/pydocx/openxml/shared_math/inter_equation_spacing.py @@ -0,0 +1,13 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection + + +class InterEquationSpacing(XmlModel): + + XML_TAG = 'interSp' + children = XmlCollection() diff --git a/pydocx/openxml/shared_math/limit.py b/pydocx/openxml/shared_math/limit.py index 3c4b256c..326b0fd3 100644 --- a/pydocx/openxml/shared_math/limit.py +++ b/pydocx/openxml/shared_math/limit.py @@ -18,11 +18,11 @@ from pydocx.openxml.shared_math.matrix_function import MatrixFunction from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction from pydocx.openxml.shared_math.phantom_function import PhantomFunction -# from pydocx.openxml.shared_math.radical_function import RadicalFunction -# from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction -# rom pydocx.openxml.shared_math.subscript_function import SubscriptFunction -# from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction -# from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction +from pydocx.openxml.shared_math.radical_function import RadicalFunction +from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +from pydocx.openxml.shared_math.subscript_function import SubscriptFunction +from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction +from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction from pydocx.openxml.wordprocessing.run import Run @@ -42,16 +42,14 @@ class Limit(XmlModel): MatrixFunction, NaryOperatorFunction, PhantomFunction, - # RadicalFunction, - # PreSubSuperscriptFunction, - # SubscriptFunction, - # SubSuperscriptFunction, - # SuperscriptFunction, + RadicalFunction, + PreSubSuperscriptFunction, + SubscriptFunction, + SubSuperscriptFunction, + SuperscriptFunction, Run ) -# solves circular import - -from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction +from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction # noqa Limit.children.types.add(UpperLimitFunction) diff --git a/pydocx/openxml/shared_math/lower_limit_function.py b/pydocx/openxml/shared_math/lower_limit_function.py index 7640b9aa..efdb1443 100644 --- a/pydocx/openxml/shared_math/lower_limit_function.py +++ b/pydocx/openxml/shared_math/lower_limit_function.py @@ -5,14 +5,14 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.lower_limit_properties import LowerLimitProperties class LowerLimitFunction(XmlModel): XML_TAG = 'limLow' children = XmlCollection( - Base, + Element, LowerLimitProperties ) diff --git a/pydocx/openxml/shared_math/matrix_column_count.py b/pydocx/openxml/shared_math/matrix_column_count.py new file mode 100644 index 00000000..49fc1775 --- /dev/null +++ b/pydocx/openxml/shared_math/matrix_column_count.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class MatrixColumnCount(XmlModel): + + XML_TAG = 'count' diff --git a/pydocx/openxml/shared_math/matrix_column_gap.py b/pydocx/openxml/shared_math/matrix_column_gap.py new file mode 100644 index 00000000..7189b80f --- /dev/null +++ b/pydocx/openxml/shared_math/matrix_column_gap.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class MatrixColumnGap(XmlModel): + + XML_TAG = 'cGp' diff --git a/pydocx/openxml/shared_math/matrix_column_gap_rule.py b/pydocx/openxml/shared_math/matrix_column_gap_rule.py new file mode 100644 index 00000000..3484e50c --- /dev/null +++ b/pydocx/openxml/shared_math/matrix_column_gap_rule.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class MatrixColumnGapRule(XmlModel): + + XML_TAG = 'cGpRule' diff --git a/pydocx/openxml/shared_math/matrix_column_spacing.py b/pydocx/openxml/shared_math/matrix_column_spacing.py new file mode 100644 index 00000000..7f56ce04 --- /dev/null +++ b/pydocx/openxml/shared_math/matrix_column_spacing.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class MatrixColumnSpacing(XmlModel): + + XML_TAG = 'Csp' diff --git a/pydocx/openxml/shared_math/matrix_function.py b/pydocx/openxml/shared_math/matrix_function.py index 3fa6af5d..1c0c1958 100644 --- a/pydocx/openxml/shared_math/matrix_function.py +++ b/pydocx/openxml/shared_math/matrix_function.py @@ -6,7 +6,7 @@ from pydocx.models import XmlModel, XmlCollection from pydocx.openxml.shared_math.matrix_properties import MatrixProperties -# from pydocx.openxml.shared_math.matrix_row import MatrixRow +from pydocx.openxml.shared_math.matrix_row import MatrixRow class MatrixFunction(XmlModel): @@ -14,5 +14,5 @@ class MatrixFunction(XmlModel): XML_TAG = 'm' children = XmlCollection( MatrixProperties, - # MatrixRow + MatrixRow ) diff --git a/pydocx/openxml/shared_math/matrix_properties.py b/pydocx/openxml/shared_math/matrix_properties.py index 37e193e1..e421c6a2 100644 --- a/pydocx/openxml/shared_math/matrix_properties.py +++ b/pydocx/openxml/shared_math/matrix_properties.py @@ -6,16 +6,18 @@ # incomplete from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.base_justification import BaseJustification from pydocx.openxml.shared_math.control_properties import ControlProperties -# from pydocx.openxml.shared_math.matrix_columns import MatrixColumns +from pydocx.openxml.shared_math.matrix_columns import MatrixColumns from pydocx.openxml.shared_math.row_spacing import RowSpacing class MatrixProperties(XmlModel): XML_TAG = 'mPr' - base_jc = XmlChild(name='baseJc', attrname='val') + base_jc = XmlChild(type=BaseJustification, attrname='val') children = XmlCollection( ControlProperties, + MatrixColumns, RowSpacing ) diff --git a/pydocx/openxml/shared_math/nary_operator_function.py b/pydocx/openxml/shared_math/nary_operator_function.py index f746222e..6b0ee811 100644 --- a/pydocx/openxml/shared_math/nary_operator_function.py +++ b/pydocx/openxml/shared_math/nary_operator_function.py @@ -5,7 +5,7 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.nary_properties import NaryProperties from pydocx.openxml.shared_math.subscript import Subscript from pydocx.openxml.shared_math.superscript import Superscript @@ -14,7 +14,7 @@ class NaryOperatorFunction(XmlModel): XML_TAG = 'nary' children = XmlCollection( - Base, + Element, NaryProperties, Subscript, Superscript diff --git a/pydocx/openxml/shared_math/nary_properties.py b/pydocx/openxml/shared_math/nary_properties.py index 193e4e39..2f3f9deb 100644 --- a/pydocx/openxml/shared_math/nary_properties.py +++ b/pydocx/openxml/shared_math/nary_properties.py @@ -5,8 +5,9 @@ ) from pydocx.models import XmlModel, XmlChild +from pydocx.openxml.shared_math.character import Character class NaryProperties(XmlModel): - chr = XmlChild(name='chr', attrname='val') + chr = XmlChild(type=Character, attrname='val') diff --git a/pydocx/openxml/shared_math/phantom_function.py b/pydocx/openxml/shared_math/phantom_function.py index b499cabe..d2e67f72 100644 --- a/pydocx/openxml/shared_math/phantom_function.py +++ b/pydocx/openxml/shared_math/phantom_function.py @@ -5,14 +5,14 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.shared_math.base import Base -# from pydocx.openxml.shared_math.phantom_properties import PhantomProperties +from pydocx.openxml.shared_math.element import Element +from pydocx.openxml.shared_math.phantom_properties import PhantomProperties class PhantomFunction(XmlModel): XML_TAG = 'phant' children = XmlCollection( - Base, - # PhantomProperties + Element, + PhantomProperties ) diff --git a/pydocx/openxml/shared_math/pre_sub_superscript_function.py b/pydocx/openxml/shared_math/pre_sub_superscript_function.py new file mode 100644 index 00000000..5f4cef98 --- /dev/null +++ b/pydocx/openxml/shared_math/pre_sub_superscript_function.py @@ -0,0 +1,23 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.element import Element +from pydocx.openxml.shared_math.pre_sub_superscript_properties import ( + PreSubSuperscriptProperties +) +from pydocx.openxml.shared_math.subscript import Subscript +from pydocx.openxml.shared_math.superscript import Superscript + + +class PreSubSuperscriptFunction(XmlModel): + XML_TAG = 'sPre' + children = XmlCollection( + Element, + PreSubSuperscriptProperties, + Subscript, + Superscript + ) diff --git a/pydocx/openxml/shared_math/pre_sub_superscript_properties.py b/pydocx/openxml/shared_math/pre_sub_superscript_properties.py new file mode 100644 index 00000000..30433337 --- /dev/null +++ b/pydocx/openxml/shared_math/pre_sub_superscript_properties.py @@ -0,0 +1,15 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.control_properties import ControlProperties + + +class PreSubSuperscriptProperties(XmlModel): + XML_TAG = 'sPrePr' + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/radical_function.py b/pydocx/openxml/shared_math/radical_function.py new file mode 100644 index 00000000..1286ef9c --- /dev/null +++ b/pydocx/openxml/shared_math/radical_function.py @@ -0,0 +1,19 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.degree import Degree +from pydocx.openxml.shared_math.element import Element +from pydocx.openxml.shared_math.radical_properties import RadicalProperties + + +class RadicalFunction(XmlModel): + XML_TAG = 'rad' + children = XmlCollection( + Degree, + Element, + RadicalProperties, + ) diff --git a/pydocx/openxml/shared_math/radical_properties.py b/pydocx/openxml/shared_math/radical_properties.py new file mode 100644 index 00000000..9c402844 --- /dev/null +++ b/pydocx/openxml/shared_math/radical_properties.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.hide_degree import HideDegree + + +class RadicalProperties(XmlModel): + XML_TAG = 'ctrlPr' + children = XmlCollection( + ControlProperties, + HideDegree + ) diff --git a/pydocx/openxml/shared_math/strike_bltr.py b/pydocx/openxml/shared_math/strike_bltr.py new file mode 100644 index 00000000..3b6c0c7e --- /dev/null +++ b/pydocx/openxml/shared_math/strike_bltr.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class StrikeBLTR(XmlModel): + + XML_TAG = 'strikeBLTR' diff --git a/pydocx/openxml/shared_math/strike_h.py b/pydocx/openxml/shared_math/strike_h.py new file mode 100644 index 00000000..c2bbfe03 --- /dev/null +++ b/pydocx/openxml/shared_math/strike_h.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class StrikeH(XmlModel): + + XML_TAG = 'strikeH' diff --git a/pydocx/openxml/shared_math/strike_tlbr.py b/pydocx/openxml/shared_math/strike_tlbr.py new file mode 100644 index 00000000..e2706812 --- /dev/null +++ b/pydocx/openxml/shared_math/strike_tlbr.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class StrikeTLBR(XmlModel): + + XML_TAG = 'strikeTLBR' diff --git a/pydocx/openxml/shared_math/strike_v.py b/pydocx/openxml/shared_math/strike_v.py new file mode 100644 index 00000000..47787102 --- /dev/null +++ b/pydocx/openxml/shared_math/strike_v.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class StrikeV(XmlModel): + + XML_TAG = 'strikeV' diff --git a/pydocx/openxml/shared_math/sub_superscript_function.py b/pydocx/openxml/shared_math/sub_superscript_function.py new file mode 100644 index 00000000..9dfd6b75 --- /dev/null +++ b/pydocx/openxml/shared_math/sub_superscript_function.py @@ -0,0 +1,21 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.element import Element +from pydocx.openxml.shared_math.subscript import Subscript +from pydocx.openxml.shared_math.superscript import Superscript +from pydocx.openxml.shared_math.sub_superscript_properties import SubSuperscriptProperties + + +class SubSuperscriptFunction(XmlModel): + XML_TAG = 'sSubSup' + children = XmlCollection( + Element, + Subscript, + Superscript, + SubSuperscriptProperties + ) diff --git a/pydocx/openxml/shared_math/sub_superscript_properties.py b/pydocx/openxml/shared_math/sub_superscript_properties.py new file mode 100644 index 00000000..2fe57f06 --- /dev/null +++ b/pydocx/openxml/shared_math/sub_superscript_properties.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.align_scripts import AlignScripts +from pydocx.openxml.shared_math.control_properties import ControlProperties + + +class SubSuperscriptProperties(XmlModel): + XML_TAG = 'sSubSupPr' + children = XmlCollection( + AlignScripts, + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/subscript_function.py b/pydocx/openxml/shared_math/subscript_function.py new file mode 100644 index 00000000..0e7dbafc --- /dev/null +++ b/pydocx/openxml/shared_math/subscript_function.py @@ -0,0 +1,19 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.element import Element +from pydocx.openxml.shared_math.subscript import Subscript +from pydocx.openxml.shared_math.subscript_properties import SubscriptProperties + + +class SubscriptFunction(XmlModel): + XML_TAG = 'sSub' + children = XmlCollection( + Element, + Subscript, + SubscriptProperties + ) diff --git a/pydocx/openxml/shared_math/base.py b/pydocx/openxml/shared_math/subscript_properties.py similarity index 52% rename from pydocx/openxml/shared_math/base.py rename to pydocx/openxml/shared_math/subscript_properties.py index d07a4041..8f855c97 100644 --- a/pydocx/openxml/shared_math/base.py +++ b/pydocx/openxml/shared_math/subscript_properties.py @@ -5,12 +5,11 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.wordprocessing.run import Run +from pydocx.openxml.shared_math.control_properties import ControlProperties -class Base(XmlModel): - XML_TAG = 'e' - +class SubscriptProperties(XmlModel): + XML_TAG = 'sSubPr' children = XmlCollection( - Run + ControlProperties ) diff --git a/pydocx/openxml/shared_math/superscript_function.py b/pydocx/openxml/shared_math/superscript_function.py index a46bea58..b6c4e1ad 100644 --- a/pydocx/openxml/shared_math/superscript_function.py +++ b/pydocx/openxml/shared_math/superscript_function.py @@ -5,13 +5,13 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.superscript import Superscript class SuperscriptFunction(XmlModel): XML_TAG = 'sSup' children = XmlCollection( - Base, + Element, Superscript ) diff --git a/pydocx/openxml/shared_math/upper_limit_function.py b/pydocx/openxml/shared_math/upper_limit_function.py index 182fcdc8..9820fc08 100644 --- a/pydocx/openxml/shared_math/upper_limit_function.py +++ b/pydocx/openxml/shared_math/upper_limit_function.py @@ -5,19 +5,19 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.shared_math.base import Base +from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.upper_limit_properties import UpperLimitProperties class UpperLimitFunction(XmlModel): XML_TAG = 'limUpp' children = XmlCollection( - Base, + Element, UpperLimitProperties ) # solves circular import -from pydocx.openxml.shared_math.limit import Limit # noqa +from pydocx.openxml.shared_math.limit import Limit # noqa UpperLimitFunction.children.types.add(Limit) diff --git a/pydocx/openxml/shared_math/upper_limit_properties.py b/pydocx/openxml/shared_math/upper_limit_properties.py index 0120c8bd..4aa1df65 100644 --- a/pydocx/openxml/shared_math/upper_limit_properties.py +++ b/pydocx/openxml/shared_math/upper_limit_properties.py @@ -4,7 +4,7 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.models import XmlModel, XmlCollection from pydocx.openxml.shared_math.control_properties import ControlProperties diff --git a/pydocx/openxml/shared_math/use_display_math_defaults.py b/pydocx/openxml/shared_math/use_display_math_defaults.py new file mode 100644 index 00000000..c50e75e4 --- /dev/null +++ b/pydocx/openxml/shared_math/use_display_math_defaults.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class UseDisplayMathDefaults(XmlModel): + + XML_TAG = 'dispDef' From aa421e5f67a3f55ea57dfb6bac6eb94800af519f Mon Sep 17 00:00:00 2001 From: iury Date: Sat, 30 Apr 2016 19:02:49 -0300 Subject: [PATCH 3/5] more shared_math models --- .../shared_math/group_character_function.py | 1 + pydocx/openxml/shared_math/grow.py | 3 +- pydocx/openxml/shared_math/hide_bottom.py | 3 +- pydocx/openxml/shared_math/hide_left.py | 3 +- pydocx/openxml/shared_math/hide_right.py | 3 +- pydocx/openxml/shared_math/hide_top.py | 3 +- .../shared_math/integral_limit_locations.py | 3 +- .../shared_math/inter_equation_spacing.py | 3 +- .../shared_math/intra_equation_spacing.py | 12 +++++ pydocx/openxml/shared_math/justification.py | 12 +++++ pydocx/openxml/shared_math/left_margin.py | 12 +++++ pydocx/openxml/shared_math/literal.py | 12 +++++ .../shared_math/lower_limit_function.py | 1 + .../shared_math/lower_limit_properties.py | 1 + pydocx/openxml/shared_math/math_font.py | 12 +++++ pydocx/openxml/shared_math/math_properties.py | 47 +++++++++++++++++++ pydocx/openxml/shared_math/matrix_column.py | 16 +++++++ .../matrix_column_justification.py | 11 +++++ .../shared_math/matrix_column_properties.py | 18 +++++++ pydocx/openxml/shared_math/matrix_columns.py | 16 +++++++ .../openxml/shared_math/matrix_properties.py | 13 ++++- pydocx/openxml/shared_math/matrix_row.py | 16 +++++++ .../shared_math/nary_limit_location.py | 12 +++++ pydocx/openxml/shared_math/nary_properties.py | 14 +++++- pydocx/openxml/shared_math/no_break.py | 12 +++++ pydocx/openxml/shared_math/normal_text.py | 12 +++++ pydocx/openxml/shared_math/numerator.py | 40 +++++++++++++++- pydocx/openxml/shared_math/omath.py | 37 ++++++++++++++- .../shared_math/upper_limit_function.py | 1 + .../shared_math/upper_limit_properties.py | 1 + 30 files changed, 331 insertions(+), 19 deletions(-) create mode 100644 pydocx/openxml/shared_math/intra_equation_spacing.py create mode 100644 pydocx/openxml/shared_math/justification.py create mode 100644 pydocx/openxml/shared_math/left_margin.py create mode 100644 pydocx/openxml/shared_math/literal.py create mode 100644 pydocx/openxml/shared_math/math_font.py create mode 100644 pydocx/openxml/shared_math/math_properties.py create mode 100644 pydocx/openxml/shared_math/matrix_column.py create mode 100644 pydocx/openxml/shared_math/matrix_column_justification.py create mode 100644 pydocx/openxml/shared_math/matrix_column_properties.py create mode 100644 pydocx/openxml/shared_math/matrix_columns.py create mode 100644 pydocx/openxml/shared_math/matrix_row.py create mode 100644 pydocx/openxml/shared_math/nary_limit_location.py create mode 100644 pydocx/openxml/shared_math/no_break.py create mode 100644 pydocx/openxml/shared_math/normal_text.py diff --git a/pydocx/openxml/shared_math/group_character_function.py b/pydocx/openxml/shared_math/group_character_function.py index 69167702..c4782d41 100644 --- a/pydocx/openxml/shared_math/group_character_function.py +++ b/pydocx/openxml/shared_math/group_character_function.py @@ -11,6 +11,7 @@ class GroupCharacterFunction(XmlModel): XML_TAG = 'groupChr' + children = XmlCollection( Element, GroupCharacterProperties diff --git a/pydocx/openxml/shared_math/grow.py b/pydocx/openxml/shared_math/grow.py index 41f1f6b3..3a881fb8 100644 --- a/pydocx/openxml/shared_math/grow.py +++ b/pydocx/openxml/shared_math/grow.py @@ -4,10 +4,9 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlCollection +from pydocx.models import XmlModel class Grow(XmlModel): XML_TAG = 'grow' - children = XmlCollection() diff --git a/pydocx/openxml/shared_math/hide_bottom.py b/pydocx/openxml/shared_math/hide_bottom.py index 4826ec74..9b438034 100644 --- a/pydocx/openxml/shared_math/hide_bottom.py +++ b/pydocx/openxml/shared_math/hide_bottom.py @@ -4,10 +4,9 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlCollection +from pydocx.models import XmlModel class HideBottom(XmlModel): XML_TAG = 'hideBot' - children = XmlCollection() diff --git a/pydocx/openxml/shared_math/hide_left.py b/pydocx/openxml/shared_math/hide_left.py index 8011bcf2..2fedfc5d 100644 --- a/pydocx/openxml/shared_math/hide_left.py +++ b/pydocx/openxml/shared_math/hide_left.py @@ -4,10 +4,9 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlCollection +from pydocx.models import XmlModel class HideLeft(XmlModel): XML_TAG = 'hideLeft' - children = XmlCollection() diff --git a/pydocx/openxml/shared_math/hide_right.py b/pydocx/openxml/shared_math/hide_right.py index 9d2e7390..7c37a887 100644 --- a/pydocx/openxml/shared_math/hide_right.py +++ b/pydocx/openxml/shared_math/hide_right.py @@ -4,10 +4,9 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlCollection +from pydocx.models import XmlModel class HideRight(XmlModel): XML_TAG = 'hideRight' - children = XmlCollection() diff --git a/pydocx/openxml/shared_math/hide_top.py b/pydocx/openxml/shared_math/hide_top.py index 8098ce81..885b7782 100644 --- a/pydocx/openxml/shared_math/hide_top.py +++ b/pydocx/openxml/shared_math/hide_top.py @@ -4,10 +4,9 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlCollection +from pydocx.models import XmlModel class HideTop(XmlModel): XML_TAG = 'hideTop' - children = XmlCollection() diff --git a/pydocx/openxml/shared_math/integral_limit_locations.py b/pydocx/openxml/shared_math/integral_limit_locations.py index f5e624e3..5e398b48 100644 --- a/pydocx/openxml/shared_math/integral_limit_locations.py +++ b/pydocx/openxml/shared_math/integral_limit_locations.py @@ -4,10 +4,9 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlCollection +from pydocx.models import XmlModel class IntegralLimitLocations(XmlModel): XML_TAG = 'intLim' - children = XmlCollection() diff --git a/pydocx/openxml/shared_math/inter_equation_spacing.py b/pydocx/openxml/shared_math/inter_equation_spacing.py index 66002dc8..8df639c2 100644 --- a/pydocx/openxml/shared_math/inter_equation_spacing.py +++ b/pydocx/openxml/shared_math/inter_equation_spacing.py @@ -4,10 +4,9 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlCollection +from pydocx.models import XmlModel class InterEquationSpacing(XmlModel): XML_TAG = 'interSp' - children = XmlCollection() diff --git a/pydocx/openxml/shared_math/intra_equation_spacing.py b/pydocx/openxml/shared_math/intra_equation_spacing.py new file mode 100644 index 00000000..eabeed71 --- /dev/null +++ b/pydocx/openxml/shared_math/intra_equation_spacing.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class IntraEquationSpacing(XmlModel): + + XML_TAG = 'intraSp' diff --git a/pydocx/openxml/shared_math/justification.py b/pydocx/openxml/shared_math/justification.py new file mode 100644 index 00000000..cbd78262 --- /dev/null +++ b/pydocx/openxml/shared_math/justification.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class Justification(XmlModel): + + XML_TAG = 'jc' diff --git a/pydocx/openxml/shared_math/left_margin.py b/pydocx/openxml/shared_math/left_margin.py new file mode 100644 index 00000000..db9d0148 --- /dev/null +++ b/pydocx/openxml/shared_math/left_margin.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class LeftMargin(XmlModel): + + XML_TAG = 'lMargin' diff --git a/pydocx/openxml/shared_math/literal.py b/pydocx/openxml/shared_math/literal.py new file mode 100644 index 00000000..1039bb24 --- /dev/null +++ b/pydocx/openxml/shared_math/literal.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class Literal(XmlModel): + + XML_TAG = 'lit' diff --git a/pydocx/openxml/shared_math/lower_limit_function.py b/pydocx/openxml/shared_math/lower_limit_function.py index efdb1443..7e82fb10 100644 --- a/pydocx/openxml/shared_math/lower_limit_function.py +++ b/pydocx/openxml/shared_math/lower_limit_function.py @@ -11,6 +11,7 @@ class LowerLimitFunction(XmlModel): XML_TAG = 'limLow' + children = XmlCollection( Element, LowerLimitProperties diff --git a/pydocx/openxml/shared_math/lower_limit_properties.py b/pydocx/openxml/shared_math/lower_limit_properties.py index 29371255..e783441e 100644 --- a/pydocx/openxml/shared_math/lower_limit_properties.py +++ b/pydocx/openxml/shared_math/lower_limit_properties.py @@ -10,6 +10,7 @@ class LowerLimitProperties(XmlModel): XML_TAG = 'limLowPr' + children = XmlCollection( ControlProperties ) diff --git a/pydocx/openxml/shared_math/math_font.py b/pydocx/openxml/shared_math/math_font.py new file mode 100644 index 00000000..1fb8e0b6 --- /dev/null +++ b/pydocx/openxml/shared_math/math_font.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class MathFont(XmlModel): + + XML_TAG = 'mathFont' diff --git a/pydocx/openxml/shared_math/math_properties.py b/pydocx/openxml/shared_math/math_properties.py new file mode 100644 index 00000000..2e2fb6bd --- /dev/null +++ b/pydocx/openxml/shared_math/math_properties.py @@ -0,0 +1,47 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.break_on_binary_operators import BreakOnBinaryOperators +from pydocx.openxml.shared_math.break_on_binary_subtraction import BreakOnBinarySubtraction +from pydocx.openxml.shared_math.default_justification import DefaultJustification +from pydocx.openxml.shared_math.inter_equation_spacing import InterEquationSpacing +from pydocx.openxml.shared_math.intra_equation_spacing import IntraEquationSpacing +from pydocx.openxml.shared_math.integral_limit_locations import IntegralLimitLocations +from pydocx.openxml.shared_math.small_fraction import SmallFraction +from pydocx.openxml.shared_math.left_margin import LeftMargin +from pydocx.openxml.shared_math.math_font import MathFont +from pydocx.openxml.shared_math.nary_limit_location import NaryLimitLocation +from pydocx.openxml.shared_math.pre_equation_spacing import PreEquationSpacing +from pydocx.openxml.shared_math.post_equation_spacing import PostEquationSpacing +from pydocx.openxml.shared_math.right_margin import RightMargin +from pydocx.openxml.shared_math.use_display_math_defaults import UseDisplayMathDefaults +from pydocx.openxml.shared_math.wrap_indent import WrapIndent +from pydocx.openxml.shared_math.wrap_right import WrapRight + + +class MathProperties(XmlModel): + + XML_TAG = 'mathPr' + + children = XmlCollection( + BreakOnBinaryOperators, + BreakOnBinarySubtraction, + DefaultJustification, + InterEquationSpacing, + IntraEquationSpacing, + IntegralLimitLocations, + SmallFraction, + LeftMargin, + MathFont, + NaryLimitLocation, + PreEquationSpacing, + PostEquationSpacing, + RightMargin, + UseDisplayMathDefaults, + WrapIndent, + WrapRight, + ) diff --git a/pydocx/openxml/shared_math/matrix_column.py b/pydocx/openxml/shared_math/matrix_column.py new file mode 100644 index 00000000..97976047 --- /dev/null +++ b/pydocx/openxml/shared_math/matrix_column.py @@ -0,0 +1,16 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.matrix_column_properties import MatrixColumnProperties + + +class MatrixColumn(XmlModel): + XML_TAG = 'mc' + + children = XmlCollection( + MatrixColumnProperties + ) diff --git a/pydocx/openxml/shared_math/matrix_column_justification.py b/pydocx/openxml/shared_math/matrix_column_justification.py new file mode 100644 index 00000000..8c938138 --- /dev/null +++ b/pydocx/openxml/shared_math/matrix_column_justification.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class MatrixColumnJustification(XmlModel): + XML_TAG = 'mcJc' diff --git a/pydocx/openxml/shared_math/matrix_column_properties.py b/pydocx/openxml/shared_math/matrix_column_properties.py new file mode 100644 index 00000000..6384814c --- /dev/null +++ b/pydocx/openxml/shared_math/matrix_column_properties.py @@ -0,0 +1,18 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.matrix_column_count import MatrixColumnCount +from pydocx.openxml.shared_math.matrix_column_justification import MatrixColumnJustification + + +class MatrixColumnProperties(XmlModel): + XML_TAG = 'mcPr' + + children = XmlCollection( + MatrixColumnCount, + MatrixColumnJustification + ) diff --git a/pydocx/openxml/shared_math/matrix_columns.py b/pydocx/openxml/shared_math/matrix_columns.py new file mode 100644 index 00000000..8f0a6257 --- /dev/null +++ b/pydocx/openxml/shared_math/matrix_columns.py @@ -0,0 +1,16 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.matrix_column import MatrixColumn + + +class MatrixColumns(XmlModel): + XML_TAG = 'mcs' + + children = XmlCollection( + MatrixColumn + ) diff --git a/pydocx/openxml/shared_math/matrix_properties.py b/pydocx/openxml/shared_math/matrix_properties.py index e421c6a2..3a8fb053 100644 --- a/pydocx/openxml/shared_math/matrix_properties.py +++ b/pydocx/openxml/shared_math/matrix_properties.py @@ -4,20 +4,29 @@ unicode_literals, ) -# incomplete from pydocx.models import XmlModel, XmlCollection, XmlChild from pydocx.openxml.shared_math.base_justification import BaseJustification from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.hide_placeholders import HidePlaceholders from pydocx.openxml.shared_math.matrix_columns import MatrixColumns +from pydocx.openxml.shared_math.matrix_column_spacing import MatrixColumnSpacing +from pydocx.openxml.shared_math.matrix_column_gap_rule import MatrixColumnGapRule +from pydocx.openxml.shared_math.matrix_column_gap import MatrixColumnGap from pydocx.openxml.shared_math.row_spacing import RowSpacing +from pydocx.openxml.shared_math.row_spacing_rule import RowSpacingRule class MatrixProperties(XmlModel): XML_TAG = 'mPr' base_jc = XmlChild(type=BaseJustification, attrname='val') + plc_hide = XmlChild(type=HidePlaceholders, attrname='val') + rsp_rule = XmlChild(type=RowSpacingRule, attrname='val') + cgp_rule = XmlChild(type=MatrixColumnGapRule, attrname='val') + rsp = XmlChild(type=RowSpacing, attrname='val') + csp = XmlChild(type=MatrixColumnSpacing, attrname='val') + cgp = XmlChild(type=MatrixColumnGap, attrname='val') children = XmlCollection( ControlProperties, MatrixColumns, - RowSpacing ) diff --git a/pydocx/openxml/shared_math/matrix_row.py b/pydocx/openxml/shared_math/matrix_row.py new file mode 100644 index 00000000..2a78ffc3 --- /dev/null +++ b/pydocx/openxml/shared_math/matrix_row.py @@ -0,0 +1,16 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.element import Element + + +class MatrixRow(XmlModel): + XML_TAG = 'mr' + + children = XmlCollection( + Element + ) diff --git a/pydocx/openxml/shared_math/nary_limit_location.py b/pydocx/openxml/shared_math/nary_limit_location.py new file mode 100644 index 00000000..c2a370f2 --- /dev/null +++ b/pydocx/openxml/shared_math/nary_limit_location.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class NaryLimitLocation(XmlModel): + + XML_TAG = 'limLoc' diff --git a/pydocx/openxml/shared_math/nary_properties.py b/pydocx/openxml/shared_math/nary_properties.py index 2f3f9deb..35c7eff0 100644 --- a/pydocx/openxml/shared_math/nary_properties.py +++ b/pydocx/openxml/shared_math/nary_properties.py @@ -4,10 +4,22 @@ unicode_literals, ) -from pydocx.models import XmlModel, XmlChild +from pydocx.models import XmlModel, XmlChild, XmlCollection from pydocx.openxml.shared_math.character import Character +from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.grow import Grow +from pydocx.openxml.shared_math.hide_subscript import HideSubscript +from pydocx.openxml.shared_math.hide_superscript import HideSuperscript +from pydocx.openxml.shared_math.nary_limit_location import NaryLimitLocation class NaryProperties(XmlModel): chr = XmlChild(type=Character, attrname='val') + lim_loc = XmlChild(type=NaryLimitLocation, attrname='val') + grow = XmlChild(type=Grow, attrname='val') + sub_hide = XmlChild(type=HideSubscript, attrname='val') + sup_hide = XmlChild(type=HideSuperscript, attrname='val') + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/no_break.py b/pydocx/openxml/shared_math/no_break.py new file mode 100644 index 00000000..567429f4 --- /dev/null +++ b/pydocx/openxml/shared_math/no_break.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class NoBreak(XmlModel): + + XML_TAG = 'noBreak' diff --git a/pydocx/openxml/shared_math/normal_text.py b/pydocx/openxml/shared_math/normal_text.py new file mode 100644 index 00000000..420ccd81 --- /dev/null +++ b/pydocx/openxml/shared_math/normal_text.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class NormalText(XmlModel): + + XML_TAG = 'nor' diff --git a/pydocx/openxml/shared_math/numerator.py b/pydocx/openxml/shared_math/numerator.py index bee4d0d4..b299e061 100644 --- a/pydocx/openxml/shared_math/numerator.py +++ b/pydocx/openxml/shared_math/numerator.py @@ -5,13 +5,51 @@ ) from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.accent import Accent +from pydocx.openxml.shared_math.bar import Bar +from pydocx.openxml.shared_math.box import Box +from pydocx.openxml.shared_math.border_box import BorderBox +from pydocx.openxml.shared_math.control_properties import ControlProperties from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.equation_array_function import EquationArrayFunction +from pydocx.openxml.shared_math.fraction_function import FractionFunction +from pydocx.openxml.shared_math.function_apply_function import FunctionApplyFunction +from pydocx.openxml.shared_math.group_character_function import GroupCharacterFunction +from pydocx.openxml.shared_math.lower_limit_function import LowerLimitFunction +from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction +from pydocx.openxml.shared_math.matrix_function import MatrixFunction +from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction +from pydocx.openxml.shared_math.phantom_function import PhantomFunction +from pydocx.openxml.shared_math.radical_function import RadicalFunction +from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +from pydocx.openxml.shared_math.subscript_function import SubscriptFunction +from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction +from pydocx.openxml.wordprocessing.run import Run class Numerator(XmlModel): XML_TAG = 'num' children = XmlCollection( + Accent, + Bar, + Box, + BorderBox, + ControlProperties, DelimiterFunction, - SuperscriptFunction + EquationArrayFunction, + FractionFunction, + FunctionApplyFunction, + GroupCharacterFunction, + LowerLimitFunction, + UpperLimitFunction, + MatrixFunction, + NaryOperatorFunction, + PhantomFunction, + RadicalFunction, + PreSubSuperscriptFunction, + SubscriptFunction, + SubSuperscriptFunction, + SuperscriptFunction, + Run ) diff --git a/pydocx/openxml/shared_math/omath.py b/pydocx/openxml/shared_math/omath.py index 9450bb3a..bafefc24 100644 --- a/pydocx/openxml/shared_math/omath.py +++ b/pydocx/openxml/shared_math/omath.py @@ -5,16 +5,51 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.wordprocessing.run import Run +from pydocx.openxml.shared_math.accent import Accent +from pydocx.openxml.shared_math.bar import Bar +from pydocx.openxml.shared_math.box import Box +from pydocx.openxml.shared_math.border_box import BorderBox from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.equation_array_function import EquationArrayFunction +from pydocx.openxml.shared_math.fraction_function import FractionFunction +from pydocx.openxml.shared_math.function_apply_function import FunctionApplyFunction +from pydocx.openxml.shared_math.group_character_function import GroupCharacterFunction +from pydocx.openxml.shared_math.lower_limit_function import LowerLimitFunction +from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction +from pydocx.openxml.shared_math.matrix_function import MatrixFunction from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction +from pydocx.openxml.shared_math.phantom_function import PhantomFunction +from pydocx.openxml.shared_math.radical_function import RadicalFunction +from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +from pydocx.openxml.shared_math.subscript_function import SubscriptFunction +from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction +from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction +from pydocx.openxml.wordprocessing.run import Run class OMath(XmlModel): XML_TAG = 'oMath' + children = XmlCollection( + Accent, + Bar, + Box, + BorderBox, DelimiterFunction, + EquationArrayFunction, + FractionFunction, + FunctionApplyFunction, + GroupCharacterFunction, + LowerLimitFunction, + UpperLimitFunction, + MatrixFunction, NaryOperatorFunction, + PhantomFunction, + RadicalFunction, + PreSubSuperscriptFunction, + SubscriptFunction, + SubSuperscriptFunction, + SuperscriptFunction, Run ) diff --git a/pydocx/openxml/shared_math/upper_limit_function.py b/pydocx/openxml/shared_math/upper_limit_function.py index 9820fc08..265dd2fc 100644 --- a/pydocx/openxml/shared_math/upper_limit_function.py +++ b/pydocx/openxml/shared_math/upper_limit_function.py @@ -11,6 +11,7 @@ class UpperLimitFunction(XmlModel): XML_TAG = 'limUpp' + children = XmlCollection( Element, UpperLimitProperties diff --git a/pydocx/openxml/shared_math/upper_limit_properties.py b/pydocx/openxml/shared_math/upper_limit_properties.py index 4aa1df65..65f9b4a8 100644 --- a/pydocx/openxml/shared_math/upper_limit_properties.py +++ b/pydocx/openxml/shared_math/upper_limit_properties.py @@ -10,6 +10,7 @@ class UpperLimitProperties(XmlModel): XML_TAG = 'limUppPr' + children = XmlCollection( ControlProperties ) From 152528fb7596381a38a61354741ca43393b7232b Mon Sep 17 00:00:00 2001 From: iury Date: Sun, 1 May 2016 14:54:03 -0300 Subject: [PATCH 4/5] finishing math xml models --- pydocx/openxml/shared_math/__init__.py | 199 ++++++++++++++++-- .../delimiter_separator_character.py | 12 ++ .../openxml/shared_math/hide_placeholders.py | 12 ++ .../shared_math/nary_operator_function.py | 5 +- pydocx/openxml/shared_math/nary_properties.py | 4 +- pydocx/openxml/shared_math/omath_paragraph.py | 19 ++ ...cript.py => omath_paragraph_properties.py} | 10 +- .../openxml/shared_math/operator_emulator.py | 12 ++ .../openxml/shared_math/phantom_function.py | 1 + .../openxml/shared_math/phantom_properties.py | 28 +++ pydocx/openxml/shared_math/position.py | 12 ++ .../shared_math/post_equation_spacing.py | 12 ++ .../shared_math/pre_equation_spacing.py | 12 ++ .../pre_sub_superscript_function.py | 5 +- .../openxml/shared_math/radical_properties.py | 3 +- pydocx/openxml/shared_math/right_margin.py | 12 ++ pydocx/openxml/shared_math/script.py | 12 ++ .../openxml/shared_math/shape_delimiters.py | 12 ++ pydocx/openxml/shared_math/show.py | 12 ++ pydocx/openxml/shared_math/small_fraction.py | 12 ++ pydocx/openxml/shared_math/style.py | 12 ++ pydocx/openxml/shared_math/sub.py | 56 +++++ pydocx/openxml/shared_math/sub_hide.py | 12 ++ .../shared_math/sub_superscript_function.py | 5 +- .../shared_math/sub_superscript_properties.py | 1 + .../openxml/shared_math/subscript_function.py | 5 +- .../shared_math/subscript_properties.py | 1 + pydocx/openxml/shared_math/sup.py | 57 +++++ pydocx/openxml/shared_math/sup_hide.py | 11 + .../shared_math/superscript_function.py | 5 +- .../shared_math/superscript_properties.py | 17 ++ pydocx/openxml/shared_math/transparent.py | 11 + pydocx/openxml/shared_math/type.py | 12 ++ .../shared_math/vertical_justification.py | 11 + pydocx/openxml/shared_math/wrap_indent.py | 11 + pydocx/openxml/shared_math/wrap_right.py | 11 + pydocx/openxml/shared_math/zero_ascent.py | 11 + pydocx/openxml/shared_math/zero_descent.py | 11 + pydocx/openxml/shared_math/zero_width.py | 11 + 39 files changed, 648 insertions(+), 29 deletions(-) create mode 100644 pydocx/openxml/shared_math/delimiter_separator_character.py create mode 100644 pydocx/openxml/shared_math/hide_placeholders.py create mode 100644 pydocx/openxml/shared_math/omath_paragraph.py rename pydocx/openxml/shared_math/{subscript.py => omath_paragraph_properties.py} (52%) create mode 100644 pydocx/openxml/shared_math/operator_emulator.py create mode 100644 pydocx/openxml/shared_math/phantom_properties.py create mode 100644 pydocx/openxml/shared_math/position.py create mode 100644 pydocx/openxml/shared_math/post_equation_spacing.py create mode 100644 pydocx/openxml/shared_math/pre_equation_spacing.py create mode 100644 pydocx/openxml/shared_math/right_margin.py create mode 100644 pydocx/openxml/shared_math/script.py create mode 100644 pydocx/openxml/shared_math/shape_delimiters.py create mode 100644 pydocx/openxml/shared_math/show.py create mode 100644 pydocx/openxml/shared_math/small_fraction.py create mode 100644 pydocx/openxml/shared_math/style.py create mode 100644 pydocx/openxml/shared_math/sub.py create mode 100644 pydocx/openxml/shared_math/sub_hide.py create mode 100644 pydocx/openxml/shared_math/sup.py create mode 100644 pydocx/openxml/shared_math/sup_hide.py create mode 100644 pydocx/openxml/shared_math/superscript_properties.py create mode 100644 pydocx/openxml/shared_math/transparent.py create mode 100644 pydocx/openxml/shared_math/type.py create mode 100644 pydocx/openxml/shared_math/vertical_justification.py create mode 100644 pydocx/openxml/shared_math/wrap_indent.py create mode 100644 pydocx/openxml/shared_math/wrap_right.py create mode 100644 pydocx/openxml/shared_math/zero_ascent.py create mode 100644 pydocx/openxml/shared_math/zero_descent.py create mode 100644 pydocx/openxml/shared_math/zero_width.py diff --git a/pydocx/openxml/shared_math/__init__.py b/pydocx/openxml/shared_math/__init__.py index db6e10bc..157351c7 100644 --- a/pydocx/openxml/shared_math/__init__.py +++ b/pydocx/openxml/shared_math/__init__.py @@ -1,3 +1,5 @@ +# coding: utf-8 + from pydocx.openxml.shared_math.accent import Accent from pydocx.openxml.shared_math.accent_properties import AccentProperties from pydocx.openxml.shared_math.align import Align @@ -6,35 +8,119 @@ from pydocx.openxml.shared_math.argument_size import ArgumentSize from pydocx.openxml.shared_math.bar import Bar from pydocx.openxml.shared_math.bar_properties import BarProperties -from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.base_justification import BaseJustification from pydocx.openxml.shared_math.border_box import BorderBox from pydocx.openxml.shared_math.border_box_properties import BorderBoxProperties from pydocx.openxml.shared_math.box import Box from pydocx.openxml.shared_math.box_properties import BoxProperties +from pydocx.openxml.shared_math.break_on_binary_operators import BreakOnBinaryOperators +from pydocx.openxml.shared_math.break_on_binary_subtraction import BreakOnBinarySubtraction +from pydocx.openxml.shared_math.brk import Break +from pydocx.openxml.shared_math.character import Character from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.default_justification import DefaultJustification from pydocx.openxml.shared_math.degree import Degree +from pydocx.openxml.shared_math.delimiter_beginning_character import DelimiterBeginningCharacter +from pydocx.openxml.shared_math.delimiter_ending_character import DelimiterEndingCharacter from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction from pydocx.openxml.shared_math.delimiter_properties import DelimiterProperties +from pydocx.openxml.shared_math.delimiter_separator_character import DelimiterSeparatorCharacter from pydocx.openxml.shared_math.denominator import Denominator +from pydocx.openxml.shared_math.differential import Differential +from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.equation_array_function import EquationArrayFunction from pydocx.openxml.shared_math.equation_array_properties import EquationArrayProperties from pydocx.openxml.shared_math.fraction_function import FractionFunction -from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction # noqa -from pydocx.openxml.shared_math.nary_properties import NaryProperties -from pydocx.openxml.shared_math.numerator import Numerator +from pydocx.openxml.shared_math.fraction_properties import FractionProperties +from pydocx.openxml.shared_math.function_apply_function import FunctionApplyFunction +from pydocx.openxml.shared_math.function_name import FunctionName +from pydocx.openxml.shared_math.function_properties import FunctionProperties +from pydocx.openxml.shared_math.group_character_function import GroupCharacterFunction +from pydocx.openxml.shared_math.group_character_properties import GroupCharacterProperties +from pydocx.openxml.shared_math.grow import Grow +from pydocx.openxml.shared_math.hide_bottom import HideBottom +from pydocx.openxml.shared_math.hide_degree import HideDegree +from pydocx.openxml.shared_math.hide_left import HideLeft +from pydocx.openxml.shared_math.hide_placeholders import HidePlaceholders +from pydocx.openxml.shared_math.hide_right import HideRight +from pydocx.openxml.shared_math.sub_hide import SubHide +from pydocx.openxml.shared_math.sup_hide import SupHide +from pydocx.openxml.shared_math.hide_top import HideTop +from pydocx.openxml.shared_math.integral_limit_locations import IntegralLimitLocations +from pydocx.openxml.shared_math.inter_equation_spacing import InterEquationSpacing +from pydocx.openxml.shared_math.intra_equation_spacing import IntraEquationSpacing +from pydocx.openxml.shared_math.justification import Justification +from pydocx.openxml.shared_math.left_margin import LeftMargin +from pydocx.openxml.shared_math.limit import Limit +from pydocx.openxml.shared_math.literal import Literal +from pydocx.openxml.shared_math.lower_limit_function import LowerLimitFunction +from pydocx.openxml.shared_math.lower_limit_properties import LowerLimitProperties +from pydocx.openxml.shared_math.math_font import MathFont +from pydocx.openxml.shared_math.math_properties import MathProperties +from pydocx.openxml.shared_math.matrix_column import MatrixColumn +from pydocx.openxml.shared_math.matrix_column_count import MatrixColumnCount +from pydocx.openxml.shared_math.matrix_column_gap import MatrixColumnGap +from pydocx.openxml.shared_math.matrix_column_gap_rule import MatrixColumnGapRule +from pydocx.openxml.shared_math.matrix_column_justification import MatrixColumnJustification +from pydocx.openxml.shared_math.matrix_column_properties import MatrixColumnProperties +from pydocx.openxml.shared_math.matrix_column_spacing import MatrixColumnSpacing +from pydocx.openxml.shared_math.matrix_columns import MatrixColumns from pydocx.openxml.shared_math.matrix_function import MatrixFunction +from pydocx.openxml.shared_math.matrix_properties import MatrixProperties +from pydocx.openxml.shared_math.matrix_row import MatrixRow from pydocx.openxml.shared_math.maximum_distribution import MaximumDistribution +from pydocx.openxml.shared_math.nary_limit_location import NaryLimitLocation +from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction +from pydocx.openxml.shared_math.nary_properties import NaryProperties +from pydocx.openxml.shared_math.no_break import NoBreak +from pydocx.openxml.shared_math.normal_text import NormalText +from pydocx.openxml.shared_math.numerator import Numerator from pydocx.openxml.shared_math.object_distribution import ObjectDistribution from pydocx.openxml.shared_math.omath import OMath +from pydocx.openxml.shared_math.omath_paragraph import OMathParagraph +from pydocx.openxml.shared_math.omath_paragraph_properties import OMathParagraphProperties +from pydocx.openxml.shared_math.operator_emulator import OperatorEmulator from pydocx.openxml.shared_math.phantom_function import PhantomFunction +from pydocx.openxml.shared_math.phantom_properties import PhantomProperties +from pydocx.openxml.shared_math.position import Position +from pydocx.openxml.shared_math.post_equation_spacing import PostEquationSpacing +from pydocx.openxml.shared_math.pre_equation_spacing import PreEquationSpacing +from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +from pydocx.openxml.shared_math.pre_sub_superscript_properties import PreSubSuperscriptProperties +from pydocx.openxml.shared_math.radical_function import RadicalFunction +from pydocx.openxml.shared_math.radical_properties import RadicalProperties +from pydocx.openxml.shared_math.right_margin import RightMargin from pydocx.openxml.shared_math.row_spacing import RowSpacing from pydocx.openxml.shared_math.row_spacing_rule import RowSpacingRule -from pydocx.openxml.shared_math.subscript import Subscript +from pydocx.openxml.shared_math.script import Script +from pydocx.openxml.shared_math.shape_delimiters import ShapeDelimiters +from pydocx.openxml.shared_math.show import Show +from pydocx.openxml.shared_math.small_fraction import SmallFraction +from pydocx.openxml.shared_math.strike_bltr import StrikeBLTR +from pydocx.openxml.shared_math.strike_h import StrikeH +from pydocx.openxml.shared_math.strike_tlbr import StrikeTLBR +from pydocx.openxml.shared_math.strike_v import StrikeV +from pydocx.openxml.shared_math.style import Style +from pydocx.openxml.shared_math.sub import Sub +from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction +from pydocx.openxml.shared_math.sub_superscript_properties import SubSuperscriptProperties +from pydocx.openxml.shared_math.subscript_function import SubscriptFunction +from pydocx.openxml.shared_math.subscript_properties import SubscriptProperties +from pydocx.openxml.shared_math.sup import Sup from pydocx.openxml.shared_math.superscript import Superscript from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction - -Element.children.types.add(FractionFunction) +from pydocx.openxml.shared_math.superscript_properties import SuperscriptProperties +from pydocx.openxml.shared_math.transparent import Transparent +from pydocx.openxml.shared_math.type import Type +from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction +from pydocx.openxml.shared_math.upper_limit_properties import UpperLimitProperties +from pydocx.openxml.shared_math.use_display_math_defaults import UseDisplayMathDefaults +from pydocx.openxml.shared_math.vertical_justification import VerticalJustification +from pydocx.openxml.shared_math.wrap_indent import WrapIndent +from pydocx.openxml.shared_math.wrap_right import WrapRight +from pydocx.openxml.shared_math.zero_ascent import ZeroAscent +from pydocx.openxml.shared_math.zero_descent import ZeroDescent +from pydocx.openxml.shared_math.zero_width import ZeroWidth __all__ = [ @@ -46,31 +132,118 @@ 'ArgumentSize', 'Bar', 'BarProperties', - 'Element', 'BaseJustification', 'BorderBox', 'BorderBoxProperties', 'Box', 'BoxProperties', + 'BreakOnBinaryOperators', + 'BreakOnBinarySubtraction', + 'Break', + 'Character', 'ControlProperties', + 'DefaultJustification', 'Degree', + 'DelimiterBeginningCharacter', + 'DelimiterEndingCharacter', 'DelimiterFunction', 'DelimiterProperties', + 'DelimiterSeparatorCharacter', 'Denominator', + 'Differential', + 'Element', 'EquationArrayFunction', 'EquationArrayProperties', - 'FractionFunction' + 'FractionFunction', + 'FractionProperties', + 'FunctionApplyFunction', + 'FunctionName', + 'FunctionProperties', + 'GroupCharacterFunction', + 'GroupCharacterProperties', + 'Grow', + 'HideBottom', + 'HideDegree', + 'HideLeft', + 'HidePlaceholders', + 'HideRight', + 'SubHide', + 'SupHide', + 'HideTop', + 'IntegralLimitLocations', + 'InterEquationSpacing', + 'IntraEquationSpacing', + 'Justification', + 'LeftMargin', + 'Limit', + 'Literal', + 'LowerLimitFunction', + 'LowerLimitProperties', + 'MathFont', + 'MathProperties', + 'MatrixColumn', + 'MatrixColumnCount', + 'MatrixColumnGap', + 'MatrixColumnGapRule', + 'MatrixColumnJustification', + 'MatrixColumnProperties', + 'MatrixColumnSpacing', + 'MatrixColumns', + 'MatrixFunction', + 'MatrixProperties', + 'MatrixRow', + 'MaximumDistribution', + 'NaryLimitLocation', 'NaryOperatorFunction', 'NaryProperties', + 'NoBreak', + 'NormalText', + 'Numerator', 'Numerator', - 'MatrixFunction', - 'MaximumDistribution', 'ObjectDistribution', 'OMath', + 'OMathParagraph', + 'OMathParagraphProperties', + 'OperatorEmulator', 'PhantomFunction', + 'PhantomProperties', + 'Position', + 'PostEquationSpacing', + 'PreEquationSpacing', + 'PreSubSuperscriptFunction', + 'PreSubSuperscriptProperties', + 'RadicalFunction', + 'RadicalProperties', + 'RightMargin', 'RowSpacing', 'RowSpacingRule', - 'Subscript', + 'Script', + 'ShapeDelimiters', + 'Show', + 'SmallFraction', + 'StrikeBLTR', + 'StrikeH', + 'StrikeTLBR', + 'StrikeV', + 'Style', + 'Sub', + 'SubSuperscriptFunction', + 'SubSuperscriptProperties', + 'SubscriptFunction', + 'SubscriptProperties', + 'Sup', 'Superscript', - 'SuperscriptFunction' + 'SuperscriptFunction', + 'SuperscriptProperties', + 'Transparent', + 'Type', + 'UpperLimitFunction', + 'UpperLimitProperties', + 'UseDisplayMathDefaults', + 'VerticalJustification', + 'WrapIndent', + 'WrapRight', + 'ZeroAscent', + 'ZeroDescent', + 'ZeroWidth' ] diff --git a/pydocx/openxml/shared_math/delimiter_separator_character.py b/pydocx/openxml/shared_math/delimiter_separator_character.py new file mode 100644 index 00000000..ea445f59 --- /dev/null +++ b/pydocx/openxml/shared_math/delimiter_separator_character.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class DelimiterSeparatorCharacter(XmlModel): + + XML_TAG = 'sepChr' diff --git a/pydocx/openxml/shared_math/hide_placeholders.py b/pydocx/openxml/shared_math/hide_placeholders.py new file mode 100644 index 00000000..39c8f9fd --- /dev/null +++ b/pydocx/openxml/shared_math/hide_placeholders.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class HidePlaceholders(XmlModel): + + XML_TAG = 'plcHide' diff --git a/pydocx/openxml/shared_math/nary_operator_function.py b/pydocx/openxml/shared_math/nary_operator_function.py index 6b0ee811..839d1ef2 100644 --- a/pydocx/openxml/shared_math/nary_operator_function.py +++ b/pydocx/openxml/shared_math/nary_operator_function.py @@ -7,15 +7,16 @@ from pydocx.models import XmlModel, XmlCollection from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.nary_properties import NaryProperties -from pydocx.openxml.shared_math.subscript import Subscript +from pydocx.openxml.shared_math.sub import Sub from pydocx.openxml.shared_math.superscript import Superscript class NaryOperatorFunction(XmlModel): XML_TAG = 'nary' + children = XmlCollection( Element, NaryProperties, - Subscript, + Sub, Superscript ) diff --git a/pydocx/openxml/shared_math/nary_properties.py b/pydocx/openxml/shared_math/nary_properties.py index 35c7eff0..61068ad4 100644 --- a/pydocx/openxml/shared_math/nary_properties.py +++ b/pydocx/openxml/shared_math/nary_properties.py @@ -8,8 +8,8 @@ from pydocx.openxml.shared_math.character import Character from pydocx.openxml.shared_math.control_properties import ControlProperties from pydocx.openxml.shared_math.grow import Grow -from pydocx.openxml.shared_math.hide_subscript import HideSubscript -from pydocx.openxml.shared_math.hide_superscript import HideSuperscript +from pydocx.openxml.shared_math.sub_hide import HideSubscript +from pydocx.openxml.shared_math.sup_hide import HideSuperscript from pydocx.openxml.shared_math.nary_limit_location import NaryLimitLocation diff --git a/pydocx/openxml/shared_math/omath_paragraph.py b/pydocx/openxml/shared_math/omath_paragraph.py new file mode 100644 index 00000000..4a27c00d --- /dev/null +++ b/pydocx/openxml/shared_math/omath_paragraph.py @@ -0,0 +1,19 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.omath import OMath +from pydocx.openxml.shared_math.omath_paragraph_properties import OMathParagraphProperties + + +class OMathParagraph(XmlModel): + + XML_TAG = 'mathPara' + + children = XmlCollection( + OMath, + OMathParagraphProperties + ) diff --git a/pydocx/openxml/shared_math/subscript.py b/pydocx/openxml/shared_math/omath_paragraph_properties.py similarity index 52% rename from pydocx/openxml/shared_math/subscript.py rename to pydocx/openxml/shared_math/omath_paragraph_properties.py index 217b0aeb..dfc92f32 100644 --- a/pydocx/openxml/shared_math/subscript.py +++ b/pydocx/openxml/shared_math/omath_paragraph_properties.py @@ -5,11 +5,13 @@ ) from pydocx.models import XmlModel, XmlCollection -from pydocx.openxml.wordprocessing.run import Run +from pydocx.openxml.shared_math.justification import Justification -class Subscript(XmlModel): - XML_TAG = 'nary' +class OMathParagraphProperties(XmlModel): + + XML_TAG = 'mathParaPr' + children = XmlCollection( - Run + Justification ) diff --git a/pydocx/openxml/shared_math/operator_emulator.py b/pydocx/openxml/shared_math/operator_emulator.py new file mode 100644 index 00000000..e03b517f --- /dev/null +++ b/pydocx/openxml/shared_math/operator_emulator.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class OperatorEmulator(XmlModel): + + XML_TAG = 'opEmu' diff --git a/pydocx/openxml/shared_math/phantom_function.py b/pydocx/openxml/shared_math/phantom_function.py index d2e67f72..e7936cae 100644 --- a/pydocx/openxml/shared_math/phantom_function.py +++ b/pydocx/openxml/shared_math/phantom_function.py @@ -12,6 +12,7 @@ class PhantomFunction(XmlModel): XML_TAG = 'phant' + children = XmlCollection( Element, PhantomProperties diff --git a/pydocx/openxml/shared_math/phantom_properties.py b/pydocx/openxml/shared_math/phantom_properties.py new file mode 100644 index 00000000..311e0fc6 --- /dev/null +++ b/pydocx/openxml/shared_math/phantom_properties.py @@ -0,0 +1,28 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection, XmlChild +from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.show import Show +from pydocx.openxml.shared_math.zero_width import ZeroWidth +from pydocx.openxml.shared_math.zero_ascent import ZeroAscent +from pydocx.openxml.shared_math.zero_descent import ZeroDescent +from pydocx.openxml.shared_math.transparent import Transparent + + +class PhantomProperties(XmlModel): + + XML_TAG = 'phantPr' + + show = XmlChild(type=Show, attrname='val') + zero_wid = XmlChild(type=ZeroWidth, attrname='val') + zero_asc = XmlChild(type=ZeroAscent, attrname='val') + zero_desc = XmlChild(type=ZeroDescent, attrname='val') + transp = XmlChild(type=Transparent, attrname='val') + + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/position.py b/pydocx/openxml/shared_math/position.py new file mode 100644 index 00000000..43cb4970 --- /dev/null +++ b/pydocx/openxml/shared_math/position.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class Position(XmlModel): + + XML_TAG = 'pos' diff --git a/pydocx/openxml/shared_math/post_equation_spacing.py b/pydocx/openxml/shared_math/post_equation_spacing.py new file mode 100644 index 00000000..2a3c57bf --- /dev/null +++ b/pydocx/openxml/shared_math/post_equation_spacing.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class PostEquationSpacing(XmlModel): + + XML_TAG = 'postSp' diff --git a/pydocx/openxml/shared_math/pre_equation_spacing.py b/pydocx/openxml/shared_math/pre_equation_spacing.py new file mode 100644 index 00000000..9d7ffd9a --- /dev/null +++ b/pydocx/openxml/shared_math/pre_equation_spacing.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class PreEquationSpacing(XmlModel): + + XML_TAG = 'preSp' diff --git a/pydocx/openxml/shared_math/pre_sub_superscript_function.py b/pydocx/openxml/shared_math/pre_sub_superscript_function.py index 5f4cef98..130a9a9a 100644 --- a/pydocx/openxml/shared_math/pre_sub_superscript_function.py +++ b/pydocx/openxml/shared_math/pre_sub_superscript_function.py @@ -9,15 +9,16 @@ from pydocx.openxml.shared_math.pre_sub_superscript_properties import ( PreSubSuperscriptProperties ) -from pydocx.openxml.shared_math.subscript import Subscript +from pydocx.openxml.shared_math.sub import Sub from pydocx.openxml.shared_math.superscript import Superscript class PreSubSuperscriptFunction(XmlModel): XML_TAG = 'sPre' + children = XmlCollection( Element, PreSubSuperscriptProperties, - Subscript, + Sub, Superscript ) diff --git a/pydocx/openxml/shared_math/radical_properties.py b/pydocx/openxml/shared_math/radical_properties.py index 9c402844..a224251f 100644 --- a/pydocx/openxml/shared_math/radical_properties.py +++ b/pydocx/openxml/shared_math/radical_properties.py @@ -10,7 +10,8 @@ class RadicalProperties(XmlModel): - XML_TAG = 'ctrlPr' + XML_TAG = 'radPr' + children = XmlCollection( ControlProperties, HideDegree diff --git a/pydocx/openxml/shared_math/right_margin.py b/pydocx/openxml/shared_math/right_margin.py new file mode 100644 index 00000000..2161ef5d --- /dev/null +++ b/pydocx/openxml/shared_math/right_margin.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class RightMargin(XmlModel): + + XML_TAG = 'rMargin' diff --git a/pydocx/openxml/shared_math/script.py b/pydocx/openxml/shared_math/script.py new file mode 100644 index 00000000..f4abb116 --- /dev/null +++ b/pydocx/openxml/shared_math/script.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class Script(XmlModel): + + XML_TAG = 'scr' diff --git a/pydocx/openxml/shared_math/shape_delimiters.py b/pydocx/openxml/shared_math/shape_delimiters.py new file mode 100644 index 00000000..f0b4728b --- /dev/null +++ b/pydocx/openxml/shared_math/shape_delimiters.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class ShapeDelimiters(XmlModel): + + XML_TAG = 'shp' diff --git a/pydocx/openxml/shared_math/show.py b/pydocx/openxml/shared_math/show.py new file mode 100644 index 00000000..69741c14 --- /dev/null +++ b/pydocx/openxml/shared_math/show.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class Show(XmlModel): + + XML_TAG = 'show' diff --git a/pydocx/openxml/shared_math/small_fraction.py b/pydocx/openxml/shared_math/small_fraction.py new file mode 100644 index 00000000..d0263f1c --- /dev/null +++ b/pydocx/openxml/shared_math/small_fraction.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class SmallFraction(XmlModel): + + XML_TAG = 'smallFrac' diff --git a/pydocx/openxml/shared_math/style.py b/pydocx/openxml/shared_math/style.py new file mode 100644 index 00000000..97f0b381 --- /dev/null +++ b/pydocx/openxml/shared_math/style.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class Style(XmlModel): + + XML_TAG = 'sty' diff --git a/pydocx/openxml/shared_math/sub.py b/pydocx/openxml/shared_math/sub.py new file mode 100644 index 00000000..80430d1b --- /dev/null +++ b/pydocx/openxml/shared_math/sub.py @@ -0,0 +1,56 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.accent import Accent +from pydocx.openxml.shared_math.bar import Bar +from pydocx.openxml.shared_math.box import Box +from pydocx.openxml.shared_math.border_box import BorderBox +from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.equation_array_function import EquationArrayFunction +from pydocx.openxml.shared_math.fraction_function import FractionFunction +from pydocx.openxml.shared_math.function_apply_function import FunctionApplyFunction +from pydocx.openxml.shared_math.group_character_function import GroupCharacterFunction +from pydocx.openxml.shared_math.lower_limit_function import LowerLimitFunction +from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction +from pydocx.openxml.shared_math.matrix_function import MatrixFunction +from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction +from pydocx.openxml.shared_math.phantom_function import PhantomFunction +from pydocx.openxml.shared_math.radical_function import RadicalFunction +from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +from pydocx.openxml.shared_math.subscript_function import SubscriptFunction +from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction +from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction +from pydocx.openxml.wordprocessing.run import Run + + +class Sub(XmlModel): + XML_TAG = 'sub' + + children = XmlCollection( + Accent, + Bar, + Box, + BorderBox, + ControlProperties, + DelimiterFunction, + EquationArrayFunction, + FractionFunction, + FunctionApplyFunction, + GroupCharacterFunction, + LowerLimitFunction, + UpperLimitFunction, + MatrixFunction, + NaryOperatorFunction, + PhantomFunction, + RadicalFunction, + PreSubSuperscriptFunction, + SubscriptFunction, + SubSuperscriptFunction, + SuperscriptFunction, + Run + ) diff --git a/pydocx/openxml/shared_math/sub_hide.py b/pydocx/openxml/shared_math/sub_hide.py new file mode 100644 index 00000000..f2ae6bf9 --- /dev/null +++ b/pydocx/openxml/shared_math/sub_hide.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class SubHide(XmlModel): + + XML_TAG = 'subHide' diff --git a/pydocx/openxml/shared_math/sub_superscript_function.py b/pydocx/openxml/shared_math/sub_superscript_function.py index 9dfd6b75..58c77584 100644 --- a/pydocx/openxml/shared_math/sub_superscript_function.py +++ b/pydocx/openxml/shared_math/sub_superscript_function.py @@ -6,16 +6,17 @@ from pydocx.models import XmlModel, XmlCollection from pydocx.openxml.shared_math.element import Element -from pydocx.openxml.shared_math.subscript import Subscript +from pydocx.openxml.shared_math.sub import Sub from pydocx.openxml.shared_math.superscript import Superscript from pydocx.openxml.shared_math.sub_superscript_properties import SubSuperscriptProperties class SubSuperscriptFunction(XmlModel): XML_TAG = 'sSubSup' + children = XmlCollection( Element, - Subscript, + Sub, Superscript, SubSuperscriptProperties ) diff --git a/pydocx/openxml/shared_math/sub_superscript_properties.py b/pydocx/openxml/shared_math/sub_superscript_properties.py index 2fe57f06..2727c6b5 100644 --- a/pydocx/openxml/shared_math/sub_superscript_properties.py +++ b/pydocx/openxml/shared_math/sub_superscript_properties.py @@ -11,6 +11,7 @@ class SubSuperscriptProperties(XmlModel): XML_TAG = 'sSubSupPr' + children = XmlCollection( AlignScripts, ControlProperties diff --git a/pydocx/openxml/shared_math/subscript_function.py b/pydocx/openxml/shared_math/subscript_function.py index 0e7dbafc..8f946266 100644 --- a/pydocx/openxml/shared_math/subscript_function.py +++ b/pydocx/openxml/shared_math/subscript_function.py @@ -6,14 +6,15 @@ from pydocx.models import XmlModel, XmlCollection from pydocx.openxml.shared_math.element import Element -from pydocx.openxml.shared_math.subscript import Subscript +from pydocx.openxml.shared_math.sub import Sub from pydocx.openxml.shared_math.subscript_properties import SubscriptProperties class SubscriptFunction(XmlModel): XML_TAG = 'sSub' + children = XmlCollection( Element, - Subscript, + Sub, SubscriptProperties ) diff --git a/pydocx/openxml/shared_math/subscript_properties.py b/pydocx/openxml/shared_math/subscript_properties.py index 8f855c97..fb50e331 100644 --- a/pydocx/openxml/shared_math/subscript_properties.py +++ b/pydocx/openxml/shared_math/subscript_properties.py @@ -10,6 +10,7 @@ class SubscriptProperties(XmlModel): XML_TAG = 'sSubPr' + children = XmlCollection( ControlProperties ) diff --git a/pydocx/openxml/shared_math/sup.py b/pydocx/openxml/shared_math/sup.py new file mode 100644 index 00000000..481ac547 --- /dev/null +++ b/pydocx/openxml/shared_math/sup.py @@ -0,0 +1,57 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.accent import Accent +from pydocx.openxml.shared_math.bar import Bar +from pydocx.openxml.shared_math.box import Box +from pydocx.openxml.shared_math.border_box import BorderBox +from pydocx.openxml.shared_math.control_properties import ControlProperties +from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction +from pydocx.openxml.shared_math.equation_array_function import EquationArrayFunction +from pydocx.openxml.shared_math.fraction_function import FractionFunction +from pydocx.openxml.shared_math.function_apply_function import FunctionApplyFunction +from pydocx.openxml.shared_math.group_character_function import GroupCharacterFunction +from pydocx.openxml.shared_math.lower_limit_function import LowerLimitFunction +from pydocx.openxml.shared_math.upper_limit_function import UpperLimitFunction +from pydocx.openxml.shared_math.matrix_function import MatrixFunction +from pydocx.openxml.shared_math.nary_operator_function import NaryOperatorFunction +from pydocx.openxml.shared_math.phantom_function import PhantomFunction +from pydocx.openxml.shared_math.radical_function import RadicalFunction +from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction +from pydocx.openxml.shared_math.subscript_function import SubscriptFunction +from pydocx.openxml.shared_math.sub_superscript_function import SubSuperscriptFunction +from pydocx.openxml.shared_math.superscript_function import SuperscriptFunction +from pydocx.openxml.wordprocessing.run import Run + + +class Sup(XmlModel): + XML_TAG = 'sup' + + children = XmlCollection( + Accent, + Bar, + Box, + BorderBox, + ControlProperties, + DelimiterFunction, + EquationArrayFunction, + FractionFunction, + FunctionApplyFunction, + GroupCharacterFunction, + LowerLimitFunction, + UpperLimitFunction, + MatrixFunction, + NaryOperatorFunction, + PhantomFunction, + RadicalFunction, + PreSubSuperscriptFunction, + SubscriptFunction, + SubSuperscriptFunction, + SuperscriptFunction, + Run + ) + diff --git a/pydocx/openxml/shared_math/sup_hide.py b/pydocx/openxml/shared_math/sup_hide.py new file mode 100644 index 00000000..25a1acf4 --- /dev/null +++ b/pydocx/openxml/shared_math/sup_hide.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class SupHide(XmlModel): + XML_TAG = 'supHide' diff --git a/pydocx/openxml/shared_math/superscript_function.py b/pydocx/openxml/shared_math/superscript_function.py index b6c4e1ad..817426d4 100644 --- a/pydocx/openxml/shared_math/superscript_function.py +++ b/pydocx/openxml/shared_math/superscript_function.py @@ -7,11 +7,14 @@ from pydocx.models import XmlModel, XmlCollection from pydocx.openxml.shared_math.element import Element from pydocx.openxml.shared_math.superscript import Superscript +from pydocx.openxml.shared_math.superscript_properties import SuperscriptProperties class SuperscriptFunction(XmlModel): XML_TAG = 'sSup' + children = XmlCollection( Element, - Superscript + Superscript, + SuperscriptProperties ) diff --git a/pydocx/openxml/shared_math/superscript_properties.py b/pydocx/openxml/shared_math/superscript_properties.py new file mode 100644 index 00000000..3cbc707e --- /dev/null +++ b/pydocx/openxml/shared_math/superscript_properties.py @@ -0,0 +1,17 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel, XmlCollection +from pydocx.openxml.shared_math.control_properties import ControlProperties + + +class SuperscriptProperties(XmlModel): + + XML_TAG = 'sSupPr' + + children = XmlCollection( + ControlProperties + ) diff --git a/pydocx/openxml/shared_math/transparent.py b/pydocx/openxml/shared_math/transparent.py new file mode 100644 index 00000000..2eb4dee1 --- /dev/null +++ b/pydocx/openxml/shared_math/transparent.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class Transparent(XmlModel): + XML_TAG = 'transp' diff --git a/pydocx/openxml/shared_math/type.py b/pydocx/openxml/shared_math/type.py new file mode 100644 index 00000000..ac3458ac --- /dev/null +++ b/pydocx/openxml/shared_math/type.py @@ -0,0 +1,12 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class Type(XmlModel): + XML_TAG = 'type' + diff --git a/pydocx/openxml/shared_math/vertical_justification.py b/pydocx/openxml/shared_math/vertical_justification.py new file mode 100644 index 00000000..6e19ce6c --- /dev/null +++ b/pydocx/openxml/shared_math/vertical_justification.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class VerticalJustification(XmlModel): + XML_TAG = 'vertJc' diff --git a/pydocx/openxml/shared_math/wrap_indent.py b/pydocx/openxml/shared_math/wrap_indent.py new file mode 100644 index 00000000..8bfe2639 --- /dev/null +++ b/pydocx/openxml/shared_math/wrap_indent.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class WrapIndent(XmlModel): + XML_TAG = 'wrapIndent' diff --git a/pydocx/openxml/shared_math/wrap_right.py b/pydocx/openxml/shared_math/wrap_right.py new file mode 100644 index 00000000..8259a92c --- /dev/null +++ b/pydocx/openxml/shared_math/wrap_right.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class WrapRight(XmlModel): + XML_TAG = 'wrapRight' diff --git a/pydocx/openxml/shared_math/zero_ascent.py b/pydocx/openxml/shared_math/zero_ascent.py new file mode 100644 index 00000000..130c9fb7 --- /dev/null +++ b/pydocx/openxml/shared_math/zero_ascent.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class ZeroAscent(XmlModel): + XML_TAG = 'zeroAsc' diff --git a/pydocx/openxml/shared_math/zero_descent.py b/pydocx/openxml/shared_math/zero_descent.py new file mode 100644 index 00000000..e0da903d --- /dev/null +++ b/pydocx/openxml/shared_math/zero_descent.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class ZeroDescent(XmlModel): + XML_TAG = 'zeroDesc' diff --git a/pydocx/openxml/shared_math/zero_width.py b/pydocx/openxml/shared_math/zero_width.py new file mode 100644 index 00000000..55a46f3b --- /dev/null +++ b/pydocx/openxml/shared_math/zero_width.py @@ -0,0 +1,11 @@ +from __future__ import ( + absolute_import, + print_function, + unicode_literals, +) + +from pydocx.models import XmlModel + + +class ZeroWidth(XmlModel): + XML_TAG = 'zeroWid' From 20f227fa85d625481f6e60c83b17d68963b8aa94 Mon Sep 17 00:00:00 2001 From: iury Date: Sun, 1 May 2016 15:02:14 -0300 Subject: [PATCH 5/5] pep8 --- pydocx/openxml/shared_math/__init__.py | 28 +++++++++++++++++++------- pydocx/openxml/shared_math/sup.py | 1 - pydocx/openxml/shared_math/type.py | 1 - 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/pydocx/openxml/shared_math/__init__.py b/pydocx/openxml/shared_math/__init__.py index 157351c7..b4ef1584 100644 --- a/pydocx/openxml/shared_math/__init__.py +++ b/pydocx/openxml/shared_math/__init__.py @@ -20,11 +20,17 @@ from pydocx.openxml.shared_math.control_properties import ControlProperties from pydocx.openxml.shared_math.default_justification import DefaultJustification from pydocx.openxml.shared_math.degree import Degree -from pydocx.openxml.shared_math.delimiter_beginning_character import DelimiterBeginningCharacter -from pydocx.openxml.shared_math.delimiter_ending_character import DelimiterEndingCharacter +from pydocx.openxml.shared_math.delimiter_beginning_character import ( + DelimiterBeginningCharacter +) +from pydocx.openxml.shared_math.delimiter_ending_character import ( + DelimiterEndingCharacter +) from pydocx.openxml.shared_math.delimiter_function import DelimiterFunction from pydocx.openxml.shared_math.delimiter_properties import DelimiterProperties -from pydocx.openxml.shared_math.delimiter_separator_character import DelimiterSeparatorCharacter +from pydocx.openxml.shared_math.delimiter_separator_character import ( + DelimiterSeparatorCharacter +) from pydocx.openxml.shared_math.denominator import Denominator from pydocx.openxml.shared_math.differential import Differential from pydocx.openxml.shared_math.element import Element @@ -78,15 +84,23 @@ from pydocx.openxml.shared_math.object_distribution import ObjectDistribution from pydocx.openxml.shared_math.omath import OMath from pydocx.openxml.shared_math.omath_paragraph import OMathParagraph -from pydocx.openxml.shared_math.omath_paragraph_properties import OMathParagraphProperties +from pydocx.openxml.shared_math.omath_paragraph_properties import ( + OMathParagraphProperties +) from pydocx.openxml.shared_math.operator_emulator import OperatorEmulator from pydocx.openxml.shared_math.phantom_function import PhantomFunction from pydocx.openxml.shared_math.phantom_properties import PhantomProperties from pydocx.openxml.shared_math.position import Position from pydocx.openxml.shared_math.post_equation_spacing import PostEquationSpacing -from pydocx.openxml.shared_math.pre_equation_spacing import PreEquationSpacing -from pydocx.openxml.shared_math.pre_sub_superscript_function import PreSubSuperscriptFunction -from pydocx.openxml.shared_math.pre_sub_superscript_properties import PreSubSuperscriptProperties +from pydocx.openxml.shared_math.pre_equation_spacing import ( + PreEquationSpacing +) +from pydocx.openxml.shared_math.pre_sub_superscript_function import ( + PreSubSuperscriptFunction +) +from pydocx.openxml.shared_math.pre_sub_superscript_properties import ( + PreSubSuperscriptProperties +) from pydocx.openxml.shared_math.radical_function import RadicalFunction from pydocx.openxml.shared_math.radical_properties import RadicalProperties from pydocx.openxml.shared_math.right_margin import RightMargin diff --git a/pydocx/openxml/shared_math/sup.py b/pydocx/openxml/shared_math/sup.py index 481ac547..7edbff93 100644 --- a/pydocx/openxml/shared_math/sup.py +++ b/pydocx/openxml/shared_math/sup.py @@ -54,4 +54,3 @@ class Sup(XmlModel): SuperscriptFunction, Run ) - diff --git a/pydocx/openxml/shared_math/type.py b/pydocx/openxml/shared_math/type.py index ac3458ac..888f6e5f 100644 --- a/pydocx/openxml/shared_math/type.py +++ b/pydocx/openxml/shared_math/type.py @@ -9,4 +9,3 @@ class Type(XmlModel): XML_TAG = 'type' -