[lasem] mathml_itex: use the display attribute for the inline/block mode.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lasem] mathml_itex: use the display attribute for the inline/block mode.
- Date: Wed, 1 Dec 2010 21:14:07 +0000 (UTC)
commit 9f25a29403a91100617b1c96f6356689307fb77f
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Wed Dec 1 22:13:02 2010 +0100
mathml_itex: use the display attribute for the inline/block mode.
src/lsmmathmlitexelement.c | 12 +++++++++++-
tests/data/mathml/misc/itex.mml | 18 +++++++++---------
2 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/src/lsmmathmlitexelement.c b/src/lsmmathmlitexelement.c
index b4f5f55..74e6dd3 100644
--- a/src/lsmmathmlitexelement.c
+++ b/src/lsmmathmlitexelement.c
@@ -48,15 +48,25 @@ _update (LsmMathmlElement *self, LsmMathmlStyle *style)
{
LsmMathmlItexElement *itex_element = LSM_MATHML_ITEX_ELEMENT (self);
LsmDomNode *node;
- GString *string = g_string_new ("");
+ GString *string;
gboolean need_conversion;
+ if (style->display == LSM_MATHML_DISPLAY_INLINE)
+ string = g_string_new ("$");
+ else
+ string = g_string_new ("$$");
+
for (node = LSM_DOM_NODE (self)->first_child; node != NULL; node = node->next_sibling) {
if (LSM_IS_DOM_TEXT (node)) {
g_string_append (string, lsm_dom_node_get_node_value (node));
}
}
+ if (style->display == LSM_MATHML_DISPLAY_INLINE)
+ g_string_append (string, "$");
+ else
+ g_string_append (string, "$$");
+
need_conversion = g_strcmp0 (itex_element->itex, string->str) != 0;
lsm_debug ("update", "[MathmlItex::update] itex = '%s'", itex_element->itex);
diff --git a/tests/data/mathml/misc/itex.mml b/tests/data/mathml/misc/itex.mml
index 784a047..91f308d 100644
--- a/tests/data/mathml/misc/itex.mml
+++ b/tests/data/mathml/misc/itex.mml
@@ -1,12 +1,12 @@
<math xmlns="http://www.w3.org/1998/Math/MathML" xmlns:lasem="lasem.dtd">
-<mstyle mathsize="20pt">
- <mfrac>
- <lasem:itex> $f(x)=\sqrt{\frac{x-1}{x+1}}$ </lasem:itex>
- <mrow>
- <mi>a</mi>
- <mo>+</mo>
- <lasem:itex>$$\sqrt{2}$$</lasem:itex>
- </mrow>
- </mfrac>
+ <mstyle mathsize="20pt">
+ <mfrac>
+ <mstyle displaystyle="false"><lasem:itex>f(x)=\sqrt{\frac{x-1}{x+1}}</lasem:itex></mstyle>
+ <mrow>
+ <mi>a</mi>
+ <mo>+</mo>
+ <mstyle displaystyle="true"><lasem:itex>\int^\infinity_0{x dx}</lasem:itex></mstyle>
+ </mrow>
+ </mfrac>
</mstyle>
</math>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]