From 3efded0a638c8350af1422d54a47ca498721bd31 Mon Sep 17 00:00:00 2001 From: "Benjamin T. Milnes" Date: Wed, 30 Mar 2016 20:46:07 +0100 Subject: [PATCH] Minor improvements to constructors and MathMLLength --- MathML.Tests/MathMLGlyphTests.cs | 2 +- MathML.Tests/MathMLMultiscriptsTests.cs | 2 +- MathML.Tests/MathMLOperatorTests.cs | 2 +- MathML.Tests/MathMLPaddedTests.cs | 2 +- MathML.Tests/MathMLSpaceTests.cs | 2 +- MathML.Tests/MathMLStyleTests.cs | 2 +- .../MathMLSubscriptSuperscriptTests.cs | 2 +- MathML.Tests/MathMLSubscriptTests.cs | 2 +- MathML.Tests/MathMLSuperscriptTests.cs | 2 +- MathML/MathML.csproj | 4 +-- MathML/MathMLColor.cs | 2 +- MathML/MathMLEnclose.cs | 8 ++++++ MathML/MathMLGlyph.cs | 6 ++-- MathML/MathMLMath.cs | 10 +++++-- ...athMLLength.cs => MathMLMeasuredLength.cs} | 6 ++-- ...gthUnit.cs => MathMLMeasuredLengthUnit.cs} | 2 +- MathML/MathMLMultiscripts.cs | 4 +-- MathML/MathMLOperator.cs | 4 +-- MathML/MathMLOver.cs | 7 +++++ MathML/MathMLPadded.cs | 10 +++---- MathML/MathMLSerializer.cs | 4 +-- MathML/MathMLSpace.cs | 6 ++-- MathML/MathMLStyle.cs | 2 +- MathML/MathMLSubscript.cs | 2 +- MathML/MathMLSubscriptSuperscript.cs | 4 +-- MathML/MathMLSuperscript.cs | 2 +- MathML/MathMLTable.cs | 28 +++++++++++++++---- 27 files changed, 82 insertions(+), 47 deletions(-) rename MathML/{MathMLLength.cs => MathMLMeasuredLength.cs} (60%) rename MathML/{MathMLLengthUnit.cs => MathMLMeasuredLengthUnit.cs} (94%) diff --git a/MathML.Tests/MathMLGlyphTests.cs b/MathML.Tests/MathMLGlyphTests.cs index f70ab2d..6d89e2e 100644 --- a/MathML.Tests/MathMLGlyphTests.cs +++ b/MathML.Tests/MathMLGlyphTests.cs @@ -27,7 +27,7 @@ public void EmptyMathMLGlyphTest() [TestMethod] public void MathMLGlyphWithAllAttributesTest() { - Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLGlyph() { AlternativeText = "Some Text", Source = "somefile.png", Width = new MathMLLength(12, MathMLLengthUnit.Points), Height = new MathMLLength(14, MathMLLengthUnit.Millimeters), VerticalAlignment = new MathMLLength(16, MathMLLengthUnit.Pixels) })); + Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLGlyph() { AlternativeText = "Some Text", Source = "somefile.png", Width = new MathMLMeasuredLength(12, MathMLMeasuredLengthUnit.Points), Height = new MathMLMeasuredLength(14, MathMLMeasuredLengthUnit.Millimeters), VerticalAlignment = new MathMLMeasuredLength(16, MathMLMeasuredLengthUnit.Pixels) })); } } } diff --git a/MathML.Tests/MathMLMultiscriptsTests.cs b/MathML.Tests/MathMLMultiscriptsTests.cs index bde321a..0737768 100644 --- a/MathML.Tests/MathMLMultiscriptsTests.cs +++ b/MathML.Tests/MathMLMultiscriptsTests.cs @@ -27,7 +27,7 @@ public void EmptyMathMLMultiscriptsTest() [TestMethod] public void MathMLMultiscriptsWithAllAttributesTest() { - Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLMultiscripts() { SubscriptShift = new MathMLLength(4, MathMLLengthUnit.Points), SuperscriptShift = new MathMLLength(8, MathMLLengthUnit.Millimeters) })); + Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLMultiscripts() { SubscriptShift = new MathMLMeasuredLength(4, MathMLMeasuredLengthUnit.Points), SuperscriptShift = new MathMLMeasuredLength(8, MathMLMeasuredLengthUnit.Millimeters) })); } } } diff --git a/MathML.Tests/MathMLOperatorTests.cs b/MathML.Tests/MathMLOperatorTests.cs index c1ad24b..44e5512 100644 --- a/MathML.Tests/MathMLOperatorTests.cs +++ b/MathML.Tests/MathMLOperatorTests.cs @@ -38,7 +38,7 @@ public void MathMLOperatorWithContentTest() [TestMethod] public void MathMLOperatorWithAllAttributes() { - Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLOperator() { Accent = true, Fence = true, Form = MathMLOperatorForm.Postfix, LargeOperator = true, MovableLimits = true, Stretchy = true, Symmetric = true, LeftSpace = new MathMLLength(10, MathMLLengthUnit.Points), RightSpace = new MathMLLength(5, MathMLLengthUnit.Millimeters), TextDirection = MathMLTextDirection.RightToLeft, MathVariant = MathMLMathVariant.Bold })); + Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLOperator() { Accent = true, Fence = true, Form = MathMLOperatorForm.Postfix, LargeOperator = true, MovableLimits = true, Stretchy = true, Symmetric = true, LeftSpace = new MathMLMeasuredLength(10, MathMLMeasuredLengthUnit.Points), RightSpace = new MathMLMeasuredLength(5, MathMLMeasuredLengthUnit.Millimeters), TextDirection = MathMLTextDirection.RightToLeft, MathVariant = MathMLMathVariant.Bold })); } } } diff --git a/MathML.Tests/MathMLPaddedTests.cs b/MathML.Tests/MathMLPaddedTests.cs index 33f5ebf..66a6ba9 100644 --- a/MathML.Tests/MathMLPaddedTests.cs +++ b/MathML.Tests/MathMLPaddedTests.cs @@ -27,7 +27,7 @@ public void EmptyMathMLPaddedTest() [TestMethod] public void MathMLPaddedWithAllAttributes() { - Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLPadded() { Width = new MathMLLength(10, MathMLLengthUnit.Points), Height = new MathMLLength(5, MathMLLengthUnit.Millimeters), Depth = new MathMLLength(20, MathMLLengthUnit.Pixels), LeftSpace = new MathMLLength(1, MathMLLengthUnit.Inches), VerticalOffset = new MathMLLength(15, MathMLLengthUnit.Em) })); + Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLPadded() { Width = new MathMLMeasuredLength(10, MathMLMeasuredLengthUnit.Points), Height = new MathMLMeasuredLength(5, MathMLMeasuredLengthUnit.Millimeters), Depth = new MathMLMeasuredLength(20, MathMLMeasuredLengthUnit.Pixels), LeftSpace = new MathMLMeasuredLength(1, MathMLMeasuredLengthUnit.Inches), VerticalOffset = new MathMLMeasuredLength(15, MathMLMeasuredLengthUnit.Em) })); } } } diff --git a/MathML.Tests/MathMLSpaceTests.cs b/MathML.Tests/MathMLSpaceTests.cs index 94b90b1..40608ed 100644 --- a/MathML.Tests/MathMLSpaceTests.cs +++ b/MathML.Tests/MathMLSpaceTests.cs @@ -27,7 +27,7 @@ public void EmptyMathMLSpaceTest() [TestMethod] public void MathMLSpaceWithAllAttributesTest() { - Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLSpace() { Width = new MathMLLength(10, MathMLLengthUnit.Points), Height = new MathMLLength(5, MathMLLengthUnit.Millimeters), Depth = new MathMLLength(20, MathMLLengthUnit.Pixels), LineBreak = MathMLLineBreak.NewLine })); + Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLSpace() { Width = new MathMLMeasuredLength(10, MathMLMeasuredLengthUnit.Points), Height = new MathMLMeasuredLength(5, MathMLMeasuredLengthUnit.Millimeters), Depth = new MathMLMeasuredLength(20, MathMLMeasuredLengthUnit.Pixels), LineBreak = MathMLLineBreak.NewLine })); } } } diff --git a/MathML.Tests/MathMLStyleTests.cs b/MathML.Tests/MathMLStyleTests.cs index afaa917..12c5aef 100644 --- a/MathML.Tests/MathMLStyleTests.cs +++ b/MathML.Tests/MathMLStyleTests.cs @@ -27,7 +27,7 @@ public void EmptyMathMLStyleTest() [TestMethod] public void MathMLStyleWithAllAttributesTest() { - Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLStyle() { TextDirection = MathMLTextDirection.RightToLeft, DisplayStyle = false, DecimalPoint = ',', InfixLineBreakStyle = MathMLInfixLineBreakStyle.Duplicate, ScriptLevel = 10, ScriptMinimumSize = new MathMLLength(15, MathMLLengthUnit.Millimeters), ScriptSizeMultiplier = 2.5 })); + Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLStyle() { TextDirection = MathMLTextDirection.RightToLeft, DisplayStyle = false, DecimalPoint = ',', InfixLineBreakStyle = MathMLInfixLineBreakStyle.Duplicate, ScriptLevel = 10, ScriptMinimumSize = new MathMLMeasuredLength(15, MathMLMeasuredLengthUnit.Millimeters), ScriptSizeMultiplier = 2.5 })); } } } diff --git a/MathML.Tests/MathMLSubscriptSuperscriptTests.cs b/MathML.Tests/MathMLSubscriptSuperscriptTests.cs index 612f6d4..0e904e1 100644 --- a/MathML.Tests/MathMLSubscriptSuperscriptTests.cs +++ b/MathML.Tests/MathMLSubscriptSuperscriptTests.cs @@ -27,7 +27,7 @@ public void EmptyMathMLSubscriptSuperscriptTest() [TestMethod] public void MathMLSubscriptSuperscriptWithAllAttributesTest() { - Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLSubscriptSuperscript() { SubscriptShift = new MathMLLength(10, MathMLLengthUnit.Points), SuperscriptShift = new MathMLLength(15, MathMLLengthUnit.Millimeters) })); + Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLSubscriptSuperscript() { SubscriptShift = new MathMLMeasuredLength(10, MathMLMeasuredLengthUnit.Points), SuperscriptShift = new MathMLMeasuredLength(15, MathMLMeasuredLengthUnit.Millimeters) })); } } } diff --git a/MathML.Tests/MathMLSubscriptTests.cs b/MathML.Tests/MathMLSubscriptTests.cs index df83601..ebf1987 100644 --- a/MathML.Tests/MathMLSubscriptTests.cs +++ b/MathML.Tests/MathMLSubscriptTests.cs @@ -27,7 +27,7 @@ public void EmptyMathMLSubscriptTest() [TestMethod] public void MathMLSubscriptWithAllAttributesTest() { - Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLSubscript() { Shift = new MathMLLength(10, MathMLLengthUnit.Points) })); + Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLSubscript() { Shift = new MathMLMeasuredLength(10, MathMLMeasuredLengthUnit.Points) })); } } } diff --git a/MathML.Tests/MathMLSuperscriptTests.cs b/MathML.Tests/MathMLSuperscriptTests.cs index b627a32..8b7489e 100644 --- a/MathML.Tests/MathMLSuperscriptTests.cs +++ b/MathML.Tests/MathMLSuperscriptTests.cs @@ -27,7 +27,7 @@ public void EmptyMathMLSuperscriptTest() [TestMethod] public void MathMLSuperscriptWithAllAttributes() { - Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLSuperscript() { Shift = new MathMLLength(10, MathMLLengthUnit.Points) })); + Assert.AreEqual("", _serializer.SerializeMathMLNode(new MathMLSuperscript() { Shift = new MathMLMeasuredLength(10, MathMLMeasuredLengthUnit.Points) })); } } } diff --git a/MathML/MathML.csproj b/MathML/MathML.csproj index 988af6d..17bbec6 100644 --- a/MathML/MathML.csproj +++ b/MathML/MathML.csproj @@ -59,8 +59,8 @@ - - + + diff --git a/MathML/MathMLColor.cs b/MathML/MathMLColor.cs index 4d6da20..aea218c 100644 --- a/MathML/MathMLColor.cs +++ b/MathML/MathMLColor.cs @@ -6,7 +6,7 @@ namespace MathML { - public class MathMLColor + public abstract class MathMLColor { } } diff --git a/MathML/MathMLEnclose.cs b/MathML/MathMLEnclose.cs index ab28915..6ee4366 100644 --- a/MathML/MathMLEnclose.cs +++ b/MathML/MathMLEnclose.cs @@ -10,6 +10,14 @@ namespace MathML public class MathMLEnclose : MathMLElement { [MathMLAttributeName("notation")] + [MathMLAttributeOrderIndex(7)] public MathMLEncloseNotation Notation { get; set; } + + public MathMLEnclose() : this(MathMLEncloseNotation.LongDivision) { } + + public MathMLEnclose(MathMLEncloseNotation notation) + { + Notation = notation; + } } } diff --git a/MathML/MathMLGlyph.cs b/MathML/MathMLGlyph.cs index 308ec8c..adb0fc1 100644 --- a/MathML/MathMLGlyph.cs +++ b/MathML/MathMLGlyph.cs @@ -19,14 +19,14 @@ public class MathMLGlyph : MathMLElement [MathMLAttributeName("width")] [MathMLAttributeOrderIndex(9)] - public MathMLLength Width { get; set; } + public MathMLMeasuredLength Width { get; set; } [MathMLAttributeName("height")] [MathMLAttributeOrderIndex(10)] - public MathMLLength Height { get; set; } + public MathMLMeasuredLength Height { get; set; } [MathMLAttributeName("valign")] [MathMLAttributeOrderIndex(11)] - public MathMLLength VerticalAlignment { get; set; } + public MathMLMeasuredLength VerticalAlignment { get; set; } } } \ No newline at end of file diff --git a/MathML/MathMLMath.cs b/MathML/MathMLMath.cs index 246853b..529e586 100644 --- a/MathML/MathMLMath.cs +++ b/MathML/MathMLMath.cs @@ -17,10 +17,14 @@ public class MathMLMath : MathMLElement [DefaultValue(MathMLOverflow.LineBreak)] public MathMLOverflow Overflow { get; set; } - public MathMLMath() + public MathMLMath() : this(MathMLDisplay.Block, MathMLOverflow.LineBreak) { } + + public MathMLMath(MathMLDisplay display) : this(display, MathMLOverflow.LineBreak) { } + + public MathMLMath(MathMLDisplay display, MathMLOverflow overflow) { - Display = MathMLDisplay.Block; - Overflow = MathMLOverflow.LineBreak; + Display = display; + Overflow = overflow; } } } diff --git a/MathML/MathMLLength.cs b/MathML/MathMLMeasuredLength.cs similarity index 60% rename from MathML/MathMLLength.cs rename to MathML/MathMLMeasuredLength.cs index 7c18a73..91ecce8 100644 --- a/MathML/MathMLLength.cs +++ b/MathML/MathMLMeasuredLength.cs @@ -6,12 +6,12 @@ namespace MathML { - public class MathMLLength + public class MathMLMeasuredLength { public double Quantity { get; private set; } - public MathMLLengthUnit Units { get; private set; } + public MathMLMeasuredLengthUnit Units { get; private set; } - public MathMLLength(double quantity, MathMLLengthUnit units) + public MathMLMeasuredLength(double quantity, MathMLMeasuredLengthUnit units) { Quantity = quantity; Units = units; diff --git a/MathML/MathMLLengthUnit.cs b/MathML/MathMLMeasuredLengthUnit.cs similarity index 94% rename from MathML/MathMLLengthUnit.cs rename to MathML/MathMLMeasuredLengthUnit.cs index 5f80480..d232b36 100644 --- a/MathML/MathMLLengthUnit.cs +++ b/MathML/MathMLMeasuredLengthUnit.cs @@ -6,7 +6,7 @@ namespace MathML { - public enum MathMLLengthUnit + public enum MathMLMeasuredLengthUnit { [MathMLAttributeValue("em")] Em = 0, diff --git a/MathML/MathMLMultiscripts.cs b/MathML/MathMLMultiscripts.cs index 44e9a83..20986f7 100644 --- a/MathML/MathMLMultiscripts.cs +++ b/MathML/MathMLMultiscripts.cs @@ -10,9 +10,9 @@ namespace MathML public class MathMLMultiscripts : MathMLElement { [MathMLAttributeName("subscriptshift")] - public MathMLLength SubscriptShift { get; set; } + public MathMLMeasuredLength SubscriptShift { get; set; } [MathMLAttributeName("superscriptshift")] - public MathMLLength SuperscriptShift { get; set; } + public MathMLMeasuredLength SuperscriptShift { get; set; } } } diff --git a/MathML/MathMLOperator.cs b/MathML/MathMLOperator.cs index 73bf397..84933c7 100644 --- a/MathML/MathMLOperator.cs +++ b/MathML/MathMLOperator.cs @@ -51,11 +51,11 @@ public class MathMLOperator : MathMLElement [MathMLAttributeName("lspace")] [MathMLAttributeOrderIndex(17)] - public MathMLLength LeftSpace { get; set; } + public MathMLMeasuredLength LeftSpace { get; set; } [MathMLAttributeName("rspace")] [MathMLAttributeOrderIndex(18)] - public MathMLLength RightSpace { get; set; } + public MathMLMeasuredLength RightSpace { get; set; } [MathMLAttributeName("dir")] [MathMLAttributeOrderIndex(7)] diff --git a/MathML/MathMLOver.cs b/MathML/MathMLOver.cs index 59f62dc..ab56eef 100644 --- a/MathML/MathMLOver.cs +++ b/MathML/MathMLOver.cs @@ -13,5 +13,12 @@ public class MathMLOver : MathMLElement [MathMLAttributeOrderIndex(7)] [DefaultValue(false)] public bool Accent { get; set; } + + public MathMLOver() : this(false) { } + + public MathMLOver(bool accent) + { + Accent = accent; + } } } diff --git a/MathML/MathMLPadded.cs b/MathML/MathMLPadded.cs index 394b575..b324ea1 100644 --- a/MathML/MathMLPadded.cs +++ b/MathML/MathMLPadded.cs @@ -11,22 +11,22 @@ public class MathMLPadded : MathMLElement { [MathMLAttributeName("width")] [MathMLAttributeOrderIndex(7)] - public MathMLLength Width { get; set; } + public MathMLMeasuredLength Width { get; set; } [MathMLAttributeName("height")] [MathMLAttributeOrderIndex(8)] - public MathMLLength Height { get; set; } + public MathMLMeasuredLength Height { get; set; } [MathMLAttributeName("depth")] [MathMLAttributeOrderIndex(9)] - public MathMLLength Depth { get; set; } + public MathMLMeasuredLength Depth { get; set; } [MathMLAttributeName("lspace")] [MathMLAttributeOrderIndex(10)] - public MathMLLength LeftSpace { get; set; } + public MathMLMeasuredLength LeftSpace { get; set; } [MathMLAttributeName("voffset")] [MathMLAttributeOrderIndex(11)] - public MathMLLength VerticalOffset { get; set; } + public MathMLMeasuredLength VerticalOffset { get; set; } } } diff --git a/MathML/MathMLSerializer.cs b/MathML/MathMLSerializer.cs index d18b9f0..7c67b81 100644 --- a/MathML/MathMLSerializer.cs +++ b/MathML/MathMLSerializer.cs @@ -162,7 +162,7 @@ private string SerializeAttributeValue(object value) else if (value is MathMLTableVerticalAlignment) return SerializeEnumeration((MathMLTableVerticalAlignment)value); else if (value is MathMLTextDirection) return SerializeEnumeration((MathMLTextDirection)value); else if (value is MathMLUnderOverAlignment) return SerializeEnumeration((MathMLUnderOverAlignment)value); - else if (value is MathMLLength) return SerializeMathMLLength((MathMLLength)value); + else if (value is MathMLMeasuredLength) return SerializeMathMLLength((MathMLMeasuredLength)value); else if (value is MathMLColor) return SerializeMathMLColor((MathMLColor)value); throw new UnknownMathMLAttributeTypeException(); @@ -183,7 +183,7 @@ private string SerializeEnumeration(T value) return ((MathMLAttributeValue)attribute).Value; } - private string SerializeMathMLLength(MathMLLength length) + private string SerializeMathMLLength(MathMLMeasuredLength length) { return string.Format("{0}{1}", length.Quantity.ToString(), SerializeEnumeration(length.Units)); } diff --git a/MathML/MathMLSpace.cs b/MathML/MathMLSpace.cs index 916571d..4f9c5d9 100644 --- a/MathML/MathMLSpace.cs +++ b/MathML/MathMLSpace.cs @@ -11,15 +11,15 @@ public class MathMLSpace : MathMLElement { [MathMLAttributeName("width")] [MathMLAttributeOrderIndex(7)] - public MathMLLength Width { get; set; } + public MathMLMeasuredLength Width { get; set; } [MathMLAttributeName("height")] [MathMLAttributeOrderIndex(8)] - public MathMLLength Height { get; set; } + public MathMLMeasuredLength Height { get; set; } [MathMLAttributeName("depth")] [MathMLAttributeOrderIndex(9)] - public MathMLLength Depth { get; set; } + public MathMLMeasuredLength Depth { get; set; } [MathMLAttributeName("linebreak")] [MathMLAttributeOrderIndex(10)] diff --git a/MathML/MathMLStyle.cs b/MathML/MathMLStyle.cs index d829466..5dadd44 100644 --- a/MathML/MathMLStyle.cs +++ b/MathML/MathMLStyle.cs @@ -36,7 +36,7 @@ public class MathMLStyle : MathMLElement [MathMLAttributeName("scriptminsize")] [MathMLAttributeOrderIndex(12)] - public MathMLLength ScriptMinimumSize { get; set; } + public MathMLMeasuredLength ScriptMinimumSize { get; set; } [MathMLAttributeName("scriptsizemultiplier")] [MathMLAttributeOrderIndex(13)] diff --git a/MathML/MathMLSubscript.cs b/MathML/MathMLSubscript.cs index 42c7fb8..da64c1f 100644 --- a/MathML/MathMLSubscript.cs +++ b/MathML/MathMLSubscript.cs @@ -10,6 +10,6 @@ namespace MathML public class MathMLSubscript : MathMLElement { [MathMLAttributeName("subscriptshift")] - public MathMLLength Shift { get; set; } + public MathMLMeasuredLength Shift { get; set; } } } diff --git a/MathML/MathMLSubscriptSuperscript.cs b/MathML/MathMLSubscriptSuperscript.cs index de810fa..70d83f3 100644 --- a/MathML/MathMLSubscriptSuperscript.cs +++ b/MathML/MathMLSubscriptSuperscript.cs @@ -10,9 +10,9 @@ namespace MathML public class MathMLSubscriptSuperscript : MathMLElement { [MathMLAttributeName("subscriptshift")] - public MathMLLength SubscriptShift { get; set; } + public MathMLMeasuredLength SubscriptShift { get; set; } [MathMLAttributeName("superscriptshift")] - public MathMLLength SuperscriptShift { get; set; } + public MathMLMeasuredLength SuperscriptShift { get; set; } } } diff --git a/MathML/MathMLSuperscript.cs b/MathML/MathMLSuperscript.cs index 24fdd02..2f2f47b 100644 --- a/MathML/MathMLSuperscript.cs +++ b/MathML/MathMLSuperscript.cs @@ -10,6 +10,6 @@ namespace MathML public class MathMLSuperscript : MathMLElement { [MathMLAttributeName("superscriptshift")] - public MathMLLength Shift { get; set; } + public MathMLMeasuredLength Shift { get; set; } } } diff --git a/MathML/MathMLTable.cs b/MathML/MathMLTable.cs index 684a9f5..50e6a80 100644 --- a/MathML/MathMLTable.cs +++ b/MathML/MathMLTable.cs @@ -10,6 +10,7 @@ namespace MathML public class MathMLTable : MathMLElement { [MathMLAttributeName("align")] + [DefaultValue(MathMLTableVerticalAlignment.Axis)] public MathMLTableVerticalAlignment VerticalAlignment { get; set; } [MathMLAttributeName("columnalign")] @@ -19,28 +20,32 @@ public class MathMLTable : MathMLElement public IList ColumnLineStyle { get; set; } [MathMLAttributeName("columnspacing")] - public MathMLLength ColumnSpacing { get; set; } + public MathMLMeasuredLength ColumnSpacing { get; set; } [MathMLAttributeName("columnwidth")] - public MathMLLength ColumnWidth { get; set; } + public MathMLMeasuredLength ColumnWidth { get; set; } [MathMLAttributeName("displaystyle")] + [DefaultValue(true)] public bool DisplayStyle { get; set; } [MathMLAttributeName("equalcolumns")] + [DefaultValue(false)] public bool EqualColumnHeights { get; set; } [MathMLAttributeName("equalrows")] + [DefaultValue(false)] public bool EqualRowHeights { get; set; } [MathMLAttributeName("frame")] + [DefaultValue(MathMLTableLineStyle.None)] public MathMLTableLineStyle Frame { get; set; } [MathMLAttributeName("framespacing")] - public MathMLLength FrameSpacing { get; set; } + public MathMLMeasuredLength FrameSpacing { get; set; } [MathMLAttributeName("minlabelspacing")] - public MathMLLength MinimumLabelSpacing { get; set; } + public MathMLMeasuredLength MinimumLabelSpacing { get; set; } [MathMLAttributeName("rowalign")] public IList RowAlignment { get; set; } @@ -49,12 +54,23 @@ public class MathMLTable : MathMLElement public IList RowLineStyle { get; set; } [MathMLAttributeName("rowspacing")] - public MathMLLength RowSpacing { get; set; } + public MathMLMeasuredLength RowSpacing { get; set; } [MathMLAttributeName("side")] + [DefaultValue(MathMLLabeledTableRowPlacement.Right)] public MathMLLabeledTableRowPlacement Side { get; set; } [MathMLAttributeName("width")] - public MathMLLength Width { get; set; } + public MathMLMeasuredLength Width { get; set; } + + public MathMLTable() + { + VerticalAlignment = MathMLTableVerticalAlignment.Axis; + DisplayStyle = true; + EqualColumnHeights = false; + EqualRowHeights = false; + Frame = MathMLTableLineStyle.None; + Side = MathMLLabeledTableRowPlacement.Right; + } } } \ No newline at end of file