[gtksourceview] latex: fix headings with curly braces inside them
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] latex: fix headings with curly braces inside them
- Date: Thu, 22 May 2014 14:33:34 +0000 (UTC)
commit 2e95b07cc038f7f184d8b0f6265e638dbd42deb6
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu May 22 15:47:54 2014 +0200
latex: fix headings with curly braces inside them
The headings are delimited by the opening and closing curly braces. But
they can contain other latex commands inside them, for example:
\section{\LaTeX{}ila}
\section{\textit{italic} normal}
And the curly braces pairs can be nested:
\section{\textit{foo \textbf{bar}}}
data/language-specs/latex.lang | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/data/language-specs/latex.lang b/data/language-specs/latex.lang
index 3a96780..99bca31 100644
--- a/data/language-specs/latex.lang
+++ b/data/language-specs/latex.lang
@@ -366,6 +366,15 @@
<!-- headings -->
+ <context id="curly-braces-pair">
+ <start>\{</start>
+ <end>\}</end>
+ <include>
+ <context ref="curly-braces-pair"/>
+ <context ref="latex"/>
+ </include>
+ </context>
+
<context id="headings">
<include>
<context id="part" style-inside="true" style-ref="part" end-at-line-end="true">
@@ -374,6 +383,7 @@
<include>
<context sub-pattern="0" where="start" style-ref="common-commands"/>
<context sub-pattern="0" where="end" style-ref="common-commands"/>
+ <context ref="curly-braces-pair"/>
<context ref="latex"/>
</include>
</context>
@@ -384,6 +394,7 @@
<include>
<context sub-pattern="0" where="start" style-ref="common-commands"/>
<context sub-pattern="0" where="end" style-ref="common-commands"/>
+ <context ref="curly-braces-pair"/>
<context ref="latex"/>
</include>
</context>
@@ -394,6 +405,7 @@
<include>
<context sub-pattern="0" where="start" style-ref="common-commands"/>
<context sub-pattern="0" where="end" style-ref="common-commands"/>
+ <context ref="curly-braces-pair"/>
<context ref="latex"/>
</include>
</context>
@@ -404,6 +416,7 @@
<include>
<context sub-pattern="0" where="start" style-ref="common-commands"/>
<context sub-pattern="0" where="end" style-ref="common-commands"/>
+ <context ref="curly-braces-pair"/>
<context ref="latex"/>
</include>
</context>
@@ -414,6 +427,7 @@
<include>
<context sub-pattern="0" where="start" style-ref="common-commands"/>
<context sub-pattern="0" where="end" style-ref="common-commands"/>
+ <context ref="curly-braces-pair"/>
<context ref="latex"/>
</include>
</context>
@@ -424,6 +438,7 @@
<include>
<context sub-pattern="0" where="start" style-ref="common-commands"/>
<context sub-pattern="0" where="end" style-ref="common-commands"/>
+ <context ref="curly-braces-pair"/>
<context ref="latex"/>
</include>
</context>
@@ -434,6 +449,7 @@
<include>
<context sub-pattern="0" where="start" style-ref="common-commands"/>
<context sub-pattern="0" where="end" style-ref="common-commands"/>
+ <context ref="curly-braces-pair"/>
<context ref="latex"/>
</include>
</context>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]