[PATCH/RFC] GtkSourceView: FeatureSupport for Headings
Andreas Fuchs <[email protected]> Fri, 31 May 2013 14:14:40 +0200
| Newsgroups | gmane.comp.gnome.devtools |
|---|---|
| Message-ID | <1370002480.3810.9.camel@7thhell> |
Hi all,
out of envy for the Emacs Latex-Plugin I implemented the feature to
scale certain parts of a file accoring to the style definition.
Specifically, this means that \chapter{}, \section{}, etc commands in
tex files and <h1>, <h2>, etc commands in html files will have their
contents presented in a larger form than the rest.
Please finde the code for pull at:
https://github.com/anduchs/gtksourceview-headlining/tree/headliningsupport
(or in the attached patch-files against current head)
Open Issues:
- in <h1 class="test"> tags the attributes are note highlighted
correctly anymore as it seems no context-matching is possible within a
start-subpattern.
Attached are also two illustrative test files.
Best regards,
Andreas
_______________________________________________
gnome-devtools mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gnome-devtools
test.html
(text/html, 201 B)
<html> <head> <title>Testsite</title> </head> <body> <h1 sadf dsfasdfasdf =2313" "2314234>Test Heading 1</h1> <h2 class="test attrib">testing heading 2</h2> <h2>asdf</h2> </body> </html>
test.tex
(text/x-tex, 216 B)
\documentclass{article}
\begin{document}
\part{part}
\chapter{Chapter}
\section{Section}
$as+df$
\subsection{subsection}
\subsubsection{asdfasdf}
\paragraph{asdfasdf}
\subparagraph{asfsddsf}
\end{document}
0001-Add-support-for-scale-property-in-gtksourcestyle.patch
(text/x-patch, 7.8 KB)
From 861ab58ba7249c804f45b1e60afd89695373de60 Mon Sep 17 00:00:00 2001 From: Andreas Fuchs <[email protected]> Date: Fri, 31 May 2013 10:34:33 +0200 Subject: [PATCH 1/4] Add support for scale property in gtksourcestyle. - Add scale / scaleset property to gtksourcestyle objects. - Pass scale property to underlying gtktextview/textselection with scale property. - Add code for parsing scale properties from gtksourcestyleschemes. --- data/styles/styles.rng | 3 ++ gtksourceview/gtksourcestyle-private.h | 4 +- gtksourceview/gtksourcestyle.c | 66 +++++++++++++++++++++++++++++++- gtksourceview/gtksourcestylescheme.c | 9 ++++- 4 files changed, 79 insertions(+), 3 deletions(-) diff --git a/data/styles/styles.rng b/data/styles/styles.rng index 7821cd5..94306a8 100644 --- a/data/styles/styles.rng +++ b/data/styles/styles.rng @@ -106,6 +106,9 @@ <define name="style-elements"> <optional> + <attribute name="scale"/> + </optional> + <optional> <attribute name="foreground"/> </optional> <optional> diff --git a/gtksourceview/gtksourcestyle-private.h b/gtksourceview/gtksourcestyle-private.h index d63727a..f160862 100644 --- a/gtksourceview/gtksourcestyle-private.h +++ b/gtksourceview/gtksourcestyle-private.h @@ -38,7 +38,8 @@ enum { GTK_SOURCE_STYLE_USE_ITALIC = 1 << 3, /*< nick=use_italic >*/ GTK_SOURCE_STYLE_USE_BOLD = 1 << 4, /*< nick=use_bold >*/ GTK_SOURCE_STYLE_USE_UNDERLINE = 1 << 5, /*< nick=use_underline >*/ - GTK_SOURCE_STYLE_USE_STRIKETHROUGH = 1 << 6 /*< nick=use_strikethrough >*/ + GTK_SOURCE_STYLE_USE_STRIKETHROUGH = 1 << 6, /*< nick=use_strikethrough >*/ + GTK_SOURCE_STYLE_USE_SCALE = 1 << 7 /*< nick=use_scale >*/ }; struct _GtkSourceStyle @@ -55,6 +56,7 @@ struct _GtkSourceStyle guint underline : 1; guint strikethrough : 1; guint mask : 12; + const gchar *scale; }; G_GNUC_INTERNAL diff --git a/gtksourceview/gtksourcestyle.c b/gtksourceview/gtksourcestyle.c index 234863f..3f06ea6 100644 --- a/gtksourceview/gtksourcestyle.c +++ b/gtksourceview/gtksourcestyle.c @@ -59,7 +59,9 @@ enum { PROP_UNDERLINE, PROP_UNDERLINE_SET, PROP_STRIKETHROUGH, - PROP_STRIKETHROUGH_SET + PROP_STRIKETHROUGH_SET, + PROP_SCALE, + PROP_SCALE_SET }; static void @@ -131,6 +133,14 @@ gtk_source_style_class_init (GtkSourceStyleClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (object_class, + PROP_SCALE, + g_param_spec_string ("scale", + _("Scale"), + _("Text scale factor"), + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, PROP_LINE_BACKGROUND_SET, g_param_spec_boolean ("line-background-set", _("Line background set"), @@ -185,6 +195,14 @@ gtk_source_style_class_init (GtkSourceStyleClass *klass) _("Whether strikethrough attribute is set"), FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property (object_class, + PROP_SCALE_SET, + g_param_spec_boolean ("scale-set", + _("Scale set"), + _("Whether scale attribute is set"), + FALSE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); } static void @@ -279,6 +297,20 @@ gtk_source_style_set_property (GObject *object, SET_MASK (style, STRIKETHROUGH); break; + case PROP_SCALE: + string = g_value_get_string (value); + if (string != NULL) + { + style->scale = g_intern_string (string); + SET_MASK (style, SCALE); + } + else + { + style->scale = NULL; + UNSET_MASK (style, SCALE); + } + break; + case PROP_FOREGROUND_SET: MODIFY_MASK (style, value, FOREGROUND); break; @@ -300,6 +332,9 @@ gtk_source_style_set_property (GObject *object, case PROP_STRIKETHROUGH_SET: MODIFY_MASK (style, value, STRIKETHROUGH); break; + case PROP_SCALE_SET: + MODIFY_MASK (style, value, SCALE); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -338,6 +373,9 @@ gtk_source_style_get_property (GObject *object, case PROP_STRIKETHROUGH: g_value_set_boolean (value, style->strikethrough); break; + case PROP_SCALE: + g_value_set_string (value, style->scale); + break; case PROP_FOREGROUND_SET: GET_MASK (style, value, FOREGROUND); @@ -360,6 +398,9 @@ gtk_source_style_get_property (GObject *object, case PROP_STRIKETHROUGH_SET: GET_MASK (style, value, STRIKETHROUGH); break; + case PROP_SCALE_SET: + GET_MASK (style, value, SCALE); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -397,6 +438,7 @@ gtk_source_style_copy (const GtkSourceStyle *style) copy->underline = style->underline; copy->strikethrough = style->strikethrough; copy->mask = style->mask; + copy->scale = style->scale; return copy; } @@ -458,6 +500,27 @@ _gtk_source_style_apply (const GtkSourceStyle *style, else g_object_set (tag, "strikethrough-set", FALSE, NULL); + if (style->mask & GTK_SOURCE_STYLE_USE_SCALE) + if (g_strcmp0 (style->scale, "L") == 0) + g_object_set (tag, "scale", PANGO_SCALE_LARGE, NULL); + else if (g_strcmp0 (style->scale, "XL") == 0) + g_object_set (tag, "scale", PANGO_SCALE_X_LARGE, NULL); + else if (g_strcmp0 (style->scale, "XXL") == 0) + g_object_set (tag, "scale", PANGO_SCALE_XX_LARGE, NULL); + else if (g_strcmp0 (style->scale, "S") == 0) + g_object_set (tag, "scale", PANGO_SCALE_SMALL, NULL); + else if (g_strcmp0 (style->scale, "XS") == 0) + g_object_set (tag, "scale", PANGO_SCALE_X_SMALL, NULL); + else if (g_strcmp0 (style->scale, "XXS") == 0) + g_object_set (tag, "scale", PANGO_SCALE_XX_SMALL, NULL); + else if (g_strcmp0 (style->scale, "M") == 0) + g_object_set (tag, "scale", PANGO_SCALE_MEDIUM, NULL); + else if (g_ascii_strtod(style->scale, NULL) > 0) + g_object_set (tag, "scale", g_ascii_strtod(style->scale, NULL), NULL); + else g_object_set (tag, "scale-set", FALSE, NULL); + else + g_object_set (tag, "scale-set", FALSE, NULL); + g_object_thaw_notify (G_OBJECT (tag)); } else @@ -470,6 +533,7 @@ _gtk_source_style_apply (const GtkSourceStyle *style, "weight-set", FALSE, "underline-set", FALSE, "strikethrough-set", FALSE, + "scale-set", FALSE, NULL); } } diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c index 2265907..51dcc10 100644 --- a/gtksourceview/gtksourcestylescheme.c +++ b/gtksourceview/gtksourcestylescheme.c @@ -891,6 +891,7 @@ parse_style (GtkSourceStyleScheme *scheme, gboolean italic = FALSE; gboolean underline = FALSE; gboolean strikethrough = FALSE; + xmlChar *scale = NULL; xmlChar *tmp; tmp = xmlGetProp (node, BAD_CAST "name"); @@ -937,10 +938,11 @@ parse_style (GtkSourceStyleScheme *scheme, get_bool (node, "bold", &mask, GTK_SOURCE_STYLE_USE_BOLD, &bold); get_bool (node, "underline", &mask, GTK_SOURCE_STYLE_USE_UNDERLINE, &underline); get_bool (node, "strikethrough", &mask, GTK_SOURCE_STYLE_USE_STRIKETHROUGH, &strikethrough); + scale = xmlGetProp (node, BAD_CAST "scale"); if (use_style) { - if (fg != NULL || bg != NULL || line_bg != NULL || mask != 0) + if (fg != NULL || bg != NULL || line_bg != NULL || mask != 0 || scale != NULL) { g_set_error (error, ERROR_QUARK, 0, "in style '%s': style attributes used along with use-style", @@ -983,6 +985,11 @@ parse_style (GtkSourceStyleScheme *scheme, result->line_background = g_intern_string ((char*) line_bg); result->mask |= GTK_SOURCE_STYLE_USE_LINE_BACKGROUND; } + if (scale != NULL) + { + result->scale = g_intern_string ((char*) scale); + result->mask |= GTK_SOURCE_STYLE_USE_SCALE; + } } *style_p = result; -- 1.7.10.4
0002-Add-support-for-scale-property-via-def-heading-to-st.patch
(text/x-patch, 5.2 KB)
From e6825a3561cc6605ee799d6b23b0474a17d3c184 Mon Sep 17 00:00:00 2001 From: Andreas Fuchs <[email protected]> Date: Fri, 31 May 2013 10:37:06 +0200 Subject: [PATCH 2/4] Add support for scale property via def:heading to styles - Introduce properties def:heading0 to def:heading6 to style-files - Map to use scale property --- data/styles/classic.xml | 9 +++++++++ data/styles/cobalt.xml | 9 +++++++++ data/styles/kate.xml | 9 +++++++++ data/styles/oblivion.xml | 9 +++++++++ data/styles/tango.xml | 9 +++++++++ 5 files changed, 45 insertions(+) diff --git a/data/styles/classic.xml b/data/styles/classic.xml index 7369806..556eedf 100644 --- a/data/styles/classic.xml +++ b/data/styles/classic.xml @@ -81,6 +81,15 @@ <style name="def:note" foreground="blue" background="yellow" bold="true"/> <style name="def:underlined" italic="true" underline="true"/> + <!-- Heading styles --> + <style name="def:heading0" scale="5.0"/> + <style name="def:heading1" scale="2.5"/> + <style name="def:heading2" scale="2.0"/> + <style name="def:heading3" scale="1.7"/> + <style name="def:heading4" scale="1.5"/> + <style name="def:heading5" scale="1.3"/> + <style name="def:heading6" scale="1.2"/> + <!-- Language specific styles --> <style name="diff:added-line" foreground="#008B8B"/> <style name="diff:removed-line" foreground="#6A5ACD"/> diff --git a/data/styles/cobalt.xml b/data/styles/cobalt.xml index 2a43e7e..6393d6c 100644 --- a/data/styles/cobalt.xml +++ b/data/styles/cobalt.xml @@ -101,6 +101,15 @@ <style name="def:net-address-in-comment" foreground="teal_blue" italic="false" underline="true"/> <style name="def:preprocessor" foreground="light_grey"/> + <!-- Heading styles --> + <style name="def:heading0" scale="5.0"/> + <style name="def:heading1" scale="2.5"/> + <style name="def:heading2" scale="2.0"/> + <style name="def:heading3" scale="1.7"/> + <style name="def:heading4" scale="1.5"/> + <style name="def:heading5" scale="1.3"/> + <style name="def:heading6" scale="1.2"/> + <!-- Unknown? --> <style name="def:specials" foreground="white" background="neon_pink"/> <style name="def:boolean" foreground="nail_polish_pink"/> diff --git a/data/styles/kate.xml b/data/styles/kate.xml index 091821c..f0dfac1 100644 --- a/data/styles/kate.xml +++ b/data/styles/kate.xml @@ -91,6 +91,15 @@ <style name="def:warning" foreground="brown" underline="true"/> <style name="def:underlined" underline="true"/> + <!-- Heading styles --> + <style name="def:heading0" scale="5.0"/> + <style name="def:heading1" scale="2.5"/> + <style name="def:heading2" scale="2.0"/> + <style name="def:heading3" scale="1.7"/> + <style name="def:heading4" scale="1.5"/> + <style name="def:heading5" scale="1.3"/> + <style name="def:heading6" scale="1.2"/> + <!-- Language specific styles --> <style name="c:preprocessor" foreground="dark-green"/> <style name="c:included-file" use-style="c:preprocessor"/> diff --git a/data/styles/oblivion.xml b/data/styles/oblivion.xml index a52bf23..202f6c0 100644 --- a/data/styles/oblivion.xml +++ b/data/styles/oblivion.xml @@ -103,6 +103,15 @@ <style name="def:note" background="butter1" foreground="aluminium4" bold="true"/> <style name="def:underlined" italic="true" underline="true"/> + <!-- Heading styles --> + <style name="def:heading0" scale="5.0"/> + <style name="def:heading1" scale="2.5"/> + <style name="def:heading2" scale="2.0"/> + <style name="def:heading3" scale="1.7"/> + <style name="def:heading4" scale="1.5"/> + <style name="def:heading5" scale="1.3"/> + <style name="def:heading6" scale="1.2"/> + <!-- Language specific --> <style name="diff:added-line" foreground="butter2"/> <style name="diff:removed-line" foreground="skyblue1"/> diff --git a/data/styles/tango.xml b/data/styles/tango.xml index e334b9e..f8984fa 100644 --- a/data/styles/tango.xml +++ b/data/styles/tango.xml @@ -94,6 +94,15 @@ <style name="def:note" background="orange1" bold="true"/> <style name="def:underlined" italic="true" underline="true"/> + <!-- Heading styles --> + <style name="def:heading0" scale="5.0"/> + <style name="def:heading1" scale="2.5"/> + <style name="def:heading2" scale="2.0"/> + <style name="def:heading3" scale="1.7"/> + <style name="def:heading4" scale="1.5"/> + <style name="def:heading5" scale="1.3"/> + <style name="def:heading6" scale="1.2"/> + <!-- Language specific --> <style name="diff:added-line" foreground="chameleon3"/> <style name="diff:removed-line" foreground="plum3"/> -- 1.7.10.4
0003-Add-support-for-headings-to-latex-lang-spec.patch
(text/x-patch, 6.2 KB)
From 022b781e921d785851d2734f1121df026feea17b Mon Sep 17 00:00:00 2001 From: Andreas Fuchs <[email protected]> Date: Fri, 31 May 2013 10:39:10 +0200 Subject: [PATCH 3/4] Add support for headings to latex-lang-spec - Map commands part, chaper, section, subsection, subsubsection, paragraph, subparagraph to heading0 to 6 --- data/language-specs/latex.lang | 103 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/data/language-specs/latex.lang b/data/language-specs/latex.lang index d0b85d1..d615a84 100644 --- a/data/language-specs/latex.lang +++ b/data/language-specs/latex.lang @@ -43,6 +43,13 @@ <style id="common-commands" _name="Command" map-to="def:keyword"/> <style id="command" _name="Command" map-to="def:keyword"/> <style id="verbatim" _name="Verbatim" map-to="def:comment"/> + <style id="part" _name="Part Heading" map-to="def:heading0"/> + <style id="chapter" _name="Chapter Heading" map-to="def:heading1"/> + <style id="section" _name="Section Heading" map-to="def:heading2"/> + <style id="subsection" _name="SubSection Heading" map-to="def:heading3"/> + <style id="subsubsection" _name="SubSubSection Heading" map-to="def:heading4"/> + <style id="paragraph" _name="Paragraph Heading" map-to="def:heading5"/> + <style id="subparagraph" _name="SubParagraph Heading" map-to="def:heading6"/> </styles> <definitions> @@ -197,6 +204,101 @@ </include> </context> + <context id="headings"> + <include> + <context id="part" style-inside="true" style-ref="part" end-at-line-end="true"> + <start>\\part\{</start> + <end>\}</end> + <include> + <context sub-pattern="0" where="start" style-ref="common-commands"/> + <context sub-pattern="0" where="end" style-ref="common-commands"/> + <context ref="specials-symbol"/> + <context ref="command"/> + <context ref="math-1"/> + <context ref="math-2"/> + </include> + </context> + + <context id="chapter" style-inside="true" style-ref="chapter" end-at-line-end="true"> + <start>\\chapter\{</start> + <end>\}</end> + <include> + <context sub-pattern="0" where="start" style-ref="common-commands"/> + <context sub-pattern="0" where="end" style-ref="common-commands"/> + <context ref="specials-symbol"/> + <context ref="command"/> + <context ref="math-1"/> + <context ref="math-2"/> + </include> + </context> + + <context id="section" style-inside="true" style-ref="section" end-at-line-end="true"> + <start>\\section\{</start> + <end>\}</end> + <include> + <context sub-pattern="0" where="start" style-ref="common-commands"/> + <context sub-pattern="0" where="end" style-ref="common-commands"/> + <context ref="specials-symbol"/> + <context ref="command"/> + <context ref="math-1"/> + <context ref="math-2"/> + </include> + </context> + + <context id="subsection" style-inside="true" style-ref="subsection" end-at-line-end="true"> + <start>\\subsection\{</start> + <end>\}</end> + <include> + <context sub-pattern="0" where="start" style-ref="common-commands"/> + <context sub-pattern="0" where="end" style-ref="common-commands"/> + <context ref="specials-symbol"/> + <context ref="command"/> + <context ref="math-1"/> + <context ref="math-2"/> + </include> + </context> + + <context id="subsubsection" style-inside="true" style-ref="subsubsection" end-at-line-end="true"> + <start>\\subsubsection\{</start> + <end>\}</end> + <include> + <context sub-pattern="0" where="start" style-ref="common-commands"/> + <context sub-pattern="0" where="end" style-ref="common-commands"/> + <context ref="specials-symbol"/> + <context ref="command"/> + <context ref="math-1"/> + <context ref="math-2"/> + </include> + </context> + + <context id="paragraph" style-inside="true" style-ref="paragraph" end-at-line-end="true"> + <start>\\paragraph\{</start> + <end>\}</end> + <include> + <context sub-pattern="0" where="start" style-ref="common-commands"/> + <context sub-pattern="0" where="end" style-ref="common-commands"/> + <context ref="specials-symbol"/> + <context ref="command"/> + <context ref="math-1"/> + <context ref="math-2"/> + </include> + </context> + + <context id="subparagraph" style-inside="true" style-ref="subparagraph" end-at-line-end="true"> + <start>\\subparagraph\{</start> + <end>\}</end> + <include> + <context sub-pattern="0" where="start" style-ref="common-commands"/> + <context sub-pattern="0" where="end" style-ref="common-commands"/> + <context ref="specials-symbol"/> + <context ref="command"/> + <context ref="math-1"/> + <context ref="math-2"/> + </include> + </context> + </include> + </context> + <context id="comment" style-ref="comment"> <start>%</start> <end>$</end> @@ -323,6 +425,7 @@ <context id="latex"> <include> + <context ref="headings"/> <context ref="comment"/> <context ref="verbatim-comment"/> <context ref="math-1"/> -- 1.7.10.4
0004-Add-support-for-headings-in-html-spec.patch
(text/x-patch, 4.5 KB)
From 83f01ec7fa1887e4feede2aeae84749a451cfd5d Mon Sep 17 00:00:00 2001 From: Andreas Fuchs <[email protected]> Date: Fri, 31 May 2013 10:56:13 +0200 Subject: [PATCH 4/4] Add support for headings in html-spec - Add support for def:headings1 to 5 for h1 to h5 tags in html Issue: - attributes in h1 to h2 are not highlighted anymore as the start subpattern cannot reference generic-tag context anymore. --- data/language-specs/html.lang | 60 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/data/language-specs/html.lang b/data/language-specs/html.lang index 8583a98..37eb799 100644 --- a/data/language-specs/html.lang +++ b/data/language-specs/html.lang @@ -37,6 +37,12 @@ <style id="attrib-value" _name="Attribute Value" map-to="xml:attribute-value"/> <style id="dtd" _name="DTD" map-to="xml:doctype"/> <style id="error" _name="Error" map-to="xml:error"/> + <style id="title" _name="Page title" map-to="def:heading0"/> + <style id="h1" _name="Heading type 1" map-to="def:heading1"/> + <style id="h2" _name="Heading type 2" map-to="def:heading2"/> + <style id="h3" _name="Heading type 3" map-to="def:heading3"/> + <style id="h4" _name="Heading type 4" map-to="def:heading4"/> + <style id="h5" _name="Heading type 5" map-to="def:heading5"/> </styles> <default-regex-options case-sensitive="false"/> @@ -162,8 +168,62 @@ </include> </context> + <context id="headings"> + <include> + <context id="title" style-inside="true" style-ref="title" end-at-line-end="true"> + <start><title></start> + <end></title></end> + <include> + <context sub-pattern="0" where="start" style-ref="tag"/> + <context sub-pattern="0" where="end" style-ref="tag"/> + </include> + </context> + <context id="h1" style-inside="true" style-ref="h1" end-at-line-end="true"> + <start><h1[^>]*></start> + <end></h1></end> + <include> + <context sub-pattern="0" where="start" style-ref="tag"/> + <context sub-pattern="0" where="end" style-ref="tag"/> + </include> + </context> + <context id="h2" style-inside="true" style-ref="h2" end-at-line-end="true"> + <start><h2[^>]*></start> + <end></h2></end> + <include> + <context sub-pattern="0" where="start" style-ref="tag"/> + <context sub-pattern="0" where="end" style-ref="tag"/> + </include> + </context> + <context id="h3" style-inside="true" style-ref="h3" end-at-line-end="true"> + <start><h3[^>]*></start> + <end></h3></end> + <include> + <context sub-pattern="0" where="start" style-ref="tag"/> + <context sub-pattern="0" where="end" style-ref="tag"/> + </include> + </context> + <context id="h4" style-inside="true" style-ref="h4" end-at-line-end="true"> + <start><h4[^>]*></start> + <end></h4></end> + <include> + <context sub-pattern="0" where="start" style-ref="tag"/> + <context sub-pattern="0" where="end" style-ref="tag"/> + </include> + </context> + <context id="h5" style-inside="true" style-ref="h5" end-at-line-end="true"> + <start><h5[^>]*></start> + <end></h5></end> + <include> + <context sub-pattern="0" where="start" style-ref="tag"/> + <context sub-pattern="0" where="end" style-ref="tag"/> + </include> + </context> + </include> + </context> + <context id="html"> <include> + <context ref="headings"/> <context ref="xml:doctype"/> <context ref="xml:entity"/> <context ref="xml:character-reference"/> -- 1.7.10.4