[gtksourceview] Add support for reStructuredText syntax
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] Add support for reStructuredText syntax
- Date: Fri, 15 Nov 2013 07:41:48 +0000 (UTC)
commit 4d604a72a9fe84bff45e34133aeb41fbacf18099
Author: Guillaume Chereau <guillaume chereau gmail com>
Date: Fri Nov 15 14:26:38 2013 +0800
Add support for reStructuredText syntax
https://bugzilla.gnome.org/show_bug.cgi?id=649445
data/language-specs/Makefile.am | 1 +
data/language-specs/rst.lang | 142 +++++++++++++++++++++++++++++++++++++++
po/POTFILES.in | 1 +
3 files changed, 144 insertions(+), 0 deletions(-)
---
diff --git a/data/language-specs/Makefile.am b/data/language-specs/Makefile.am
index f6dbc88..537adef 100644
--- a/data/language-specs/Makefile.am
+++ b/data/language-specs/Makefile.am
@@ -88,6 +88,7 @@ LANGUAGES = \
puppet.lang \
R.lang \
rpmspec.lang \
+ rst.lang \
ruby.lang \
scala.lang \
scheme.lang \
diff --git a/data/language-specs/rst.lang b/data/language-specs/rst.lang
new file mode 100644
index 0000000..5f791cd
--- /dev/null
+++ b/data/language-specs/rst.lang
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ This file is part of GtkSourceView
+
+ Author: Guillaume Chéreau <guillaume chereau gmail com>
+
+ GtkSourceView is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ GtkSourceView is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+-->
+<language id="rst" _name="reStructuredText" version="2.0" _section="Markup">
+ <metadata>
+ <property name="mimetypes">text/x-rst</property>
+ <property name="globs">*.rst</property>
+ <property name="line-comment-start">..\u0020</property>
+ </metadata>
+
+ <styles>
+ <style id="header" _name="Header" map-to="def:type"/>
+ <style id="emphasis" _name="Emphasis" map-to="def:doc-comment-element"/>
+ <style id="strong-emphasis" _name="Strong Emphasis" map-to="def:statement"/>
+ <style id="bullet" _name="Bullet" map-to="def:preprocessor"/>
+ <style id="directive" _name="Directive" map-to="def:constant"/>
+ <style id="comment" _name="Comment" map-to="def:comment"/>
+ <style id="link" _name="Link" map-to="def:type"/>
+ <style id="substitution" _name="Substitution" map-to="def:type"/>
+ <style id="code" _name="Code" map-to="def:identifier"/>
+ <style id="url" name="Url" map-to="def:underlined"/>
+ </styles>
+
+ <definitions>
+
+ <context id="directive" class="no-spell-check" style-ref="directive">
+ <match>^\s*\.\. .*::.*$</match>
+ </context>
+
+ <context id="footnotes" style-ref="directive">
+ <match>^\s*\.\. \[.+\] .*$</match>
+ </context>
+
+ <context id="link-target" class="no-spell-check" style-ref="directive">
+ <match>^\s*\.\. _.*:.*$</match>
+ </context>
+
+ <context id="comment" style-ref="comment">
+ <start>(\s*)\.\.(\s+).+$</start>
+ <end>^(?!(\%{1 start} \%{2 start})|(^$))</end>
+ </context>
+
+ <context id="comment-single" style-ref="comment">
+ <start>^(\s*)\.\.(\s*)$</start>
+ <end>x</end>
+ <include>
+ <context id="comment-single-block" style-ref="comment" end-parent="true">
+ <start>(\s*).+$</start>
+ <end>^(?!(\%{1 start}))</end>
+ </context>
+ </include>
+ </context>
+
+ <context id="title-adornment" style-ref="header">
+ <match>^\s*(=+|\-+|`+|:+|(\.\.\.+)|'+|"+|~+|\^+|_+|\*+|\++|#+)\s*$</match>
+ </context>
+
+ <context id="bullet" style-ref="bullet">
+ <match>^\s*[\*\+\-•‣⁃] </match>
+ </context>
+
+ <define-regex id="enumerator-chars" extended="true">
+ ([a-zA-Z]|([0-9]+))
+ </define-regex>
+
+ <context id="enumerator" style-ref="bullet">
+ <match>^\s*((\%{enumerator-chars}\.)|(\(?\%{enumerator-chars}\)) )</match>
+ </context>
+
+ <context id="field" style-ref="bullet">
+ <match>^\s*:.+?:</match>
+ </context>
+
+ <context id="strong-emphasis" style-ref="strong-emphasis">
+ <match>\*\*(?!\s).+?(?!\s)\*\*</match>
+ </context>
+
+ <context id="emphasis" style-ref="emphasis">
+ <match>\*(?!\s).+?(?!\s)\*</match>
+ </context>
+
+ <context id="link" style-ref="link">
+ <match>(\S+_)|(`\b.*?\b`_)</match>
+ </context>
+
+ <context id="substitution" style-ref="substitution">
+ <match>\|\b.*\b\|</match>
+ </context>
+
+ <context id="literals">
+ <include>
+ <context id="inline-literals" class="no-spell-check" style-ref="code">
+ <match>``(?!\s).*(?!\s)``</match>
+ </context>
+ </include>
+ </context>
+
+ <context id="url" style-ref="url">
+ <match>((http)|(file))://\S*</match>
+ </context>
+
+ <context id="rst">
+ <include>
+ <context ref="directive"/>
+ <context ref="link-target"/>
+ <context ref="footnotes"/>
+ <context ref="comment"/>
+ <context ref="comment-single"/>
+ <context ref="title-adornment"/>
+ <context ref="bullet"/>
+ <context ref="enumerator"/>
+ <context ref="field"/>
+ <context ref="strong-emphasis"/>
+ <context ref="emphasis"/>
+ <context ref="link"/>
+ <context ref="substitution"/>
+ <context ref="literals"/>
+ <context ref="url"/>
+ </include>
+ </context>
+ </definitions>
+
+</language>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ec203dc..e54ffc0 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -86,6 +86,7 @@ data/language-specs/python3.lang
data/language-specs/python.lang
data/language-specs/R.lang
data/language-specs/rpmspec.lang
+data/language-specs/rst.lang
data/language-specs/ruby.lang
data/language-specs/scala.lang
data/language-specs/scheme.lang
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]