[gtksourceview] latex.lang: improve \url and \href highlighting
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] latex.lang: improve \url and \href highlighting
- Date: Fri, 16 Jun 2017 09:37:23 +0000 (UTC)
commit d4f39a1315d9ee6f009d1f6fbdc0ee8b7818d627
Author: Schrieveslaach <info schrieveslaach de>
Date: Tue Jun 13 15:19:57 2017 +0200
latex.lang: improve \url and \href highlighting
https://bugzilla.gnome.org/show_bug.cgi?id=781893
data/language-specs/latex.lang | 45 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/data/language-specs/latex.lang b/data/language-specs/latex.lang
index 2a343a7..73e8d77 100644
--- a/data/language-specs/latex.lang
+++ b/data/language-specs/latex.lang
@@ -106,6 +106,50 @@
</include>
</context>
+ <!--
+ Examples: \url{http://google.de}, \href{http://google.de}{Google}
+
+ Supports also urls with math symbols: \url{https://example.com/$test}
+ -->
+ <context id="urls">
+ <include>
+ <context ref="url-command"/>
+ <context ref="href-command"/>
+ </include>
+ </context>
+
+ <context id="url-command" class="no-spell-check">
+ <match extended="true">
+ (\\url) # url command.
+ \{ # Literal opening braces.
+ [ \t]* # Optional spaces or tabs after the opening braces.
+ .*? # URL
+ [ \t]* # Optional spaces or tabs before the closing braces.
+ \} # closing url command.
+ </match>
+
+ <include>
+ <context sub-pattern="1" style-ref="command"/>
+ </include>
+ </context>
+
+ <context id="href-command">
+ <match extended="true">
+ (\\href) # url command.
+ \{( # Literal opening braces.
+ [ \t]* # Optional spaces or tabs after the opening braces.
+ .*? # URL
+ [ \t]* # Optional spaces or tabs before the closing braces.
+ )\} # closing url command.
+ \{(.*?)\} # link text
+ </match>
+
+ <include>
+ <context sub-pattern="1" class="no-spell-check" style-ref="command"/>
+ <context sub-pattern="2" class="no-spell-check"/>
+ </include>
+ </context>
+
<!--using brackets is an experimental feature from the listings package. The
following must support these cases:
@@ -581,6 +625,7 @@
<context ref="R-block"/>
<context ref="headings"/>
<context ref="math"/>
+ <context ref="urls"/>
<context ref="specific-commands"/>
<context ref="common-commands"/>
<context ref="special-char"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]