gtksourceview r2038 - in trunk: . gtksourceview/language-specs po tests



Author: pborelli
Date: Wed Aug 27 08:37:12 2008
New Revision: 2038
URL: http://svn.gnome.org/viewvc/gtksourceview?rev=2038&view=rev

Log:
2008-08-27  Paolo Borelli  <paolo borelli katamail com>

	* gtksourceview/language-specs/xslt.lang: add lang file for xslt.
	* gtksourceview/language-specs/xml.lang: fix match priority bug
	needed for xslt.



Added:
   trunk/gtksourceview/language-specs/xslt.lang
Modified:
   trunk/ChangeLog
   trunk/gtksourceview/language-specs/Makefile.am
   trunk/gtksourceview/language-specs/xml.lang
   trunk/po/POTFILES.in
   trunk/tests/testfiles.sh

Modified: trunk/gtksourceview/language-specs/Makefile.am
==============================================================================
--- trunk/gtksourceview/language-specs/Makefile.am	(original)
+++ trunk/gtksourceview/language-specs/Makefile.am	Wed Aug 27 08:37:12 2008
@@ -63,6 +63,7 @@
 	verilog.lang		\
 	vhdl.lang		\
 	xml.lang		\
+	xslt.lang		\
 	yacc.lang
 
 STYLES =			\

Modified: trunk/gtksourceview/language-specs/xml.lang
==============================================================================
--- trunk/gtksourceview/language-specs/xml.lang	(original)
+++ trunk/gtksourceview/language-specs/xml.lang	Wed Aug 27 08:37:12 2008
@@ -128,10 +128,9 @@
             <match>(?&lt;!:)\%{prefix}:</match>
         </context>
 
-        <context id="element-name" once-only="true" style-ref="element-name">
-            <match>\b\%{name}\b(?!\s*=)</match>
-        </context>
-
+        <!-- Match attribute-name before element-name otherwise
+             "text" in <fo:block text-align="left"> is detected as
+             element -->
         <context id="attribute-name" style-ref="attribute-name">
             <match>\b\%{name}\s*=</match>
         </context>
@@ -146,6 +145,10 @@
             </include>
         </context>
 
+        <context id="element-name" once-only="true" style-ref="element-name">
+            <match>\b\%{name}\b(?!\s*=)</match>
+        </context>
+
         <context id="prolog">
             <start>&lt;\?xml</start>
             <end>\?&gt;</end>
@@ -167,9 +170,9 @@
                 <context ref="character-reference"/>
                 <context ref="unallowed-chars"/>
                 <context ref="namespace"/>
-                <context ref="element-name"/>
                 <context ref="attribute-name"/>
                 <context ref="attribute-value"/>
+                <context ref="element-name"/>
                 <context style-ref="error" extend-parent="false">
                   <match>\S</match>
                 </context>

Added: trunk/gtksourceview/language-specs/xslt.lang
==============================================================================
--- (empty file)
+++ trunk/gtksourceview/language-specs/xslt.lang	Wed Aug 27 08:37:12 2008
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Author: Paolo Borelli <pborelli katamail com>
+ Copyright (C) 2008 Paolo Borelli <pborelli katamail com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+-->
+<language id="xslt" name="XSLT" version="2.0" _section="Markup">
+  <metadata>
+    <property name="mimetypes">application/xslt+xml</property>
+    <property name="globs">*.xsl</property>
+    <property name="block-comment-start">&lt;!--</property>
+    <property name="block-comment-end">--&gt;</property>
+  </metadata>
+
+  <styles>
+    <style id="element" name="Element" map-to="def:keyword"/>
+    <style id="namespace" name="Namespace" map-to="xslt:element"/>
+  </styles>
+
+  <definitions>
+
+    <context id="namespace" style-ref="namespace">
+      <match>(?&lt;!:)xsl:</match>
+    </context>
+
+    <context id="xslt-namespace">
+      <include>
+        <context ref="namespace"/>
+        <context ref="xml:namespace" original="true"/>
+      </include>
+    </context>
+
+    <context id="elements" once-only="true" style-ref="element">
+      <suffix>\b(?!\s*=)</suffix>
+      <keyword>apply-imports</keyword>
+      <keyword>apply-templates</keyword>
+      <keyword>attribute-set</keyword>
+      <keyword>attribute</keyword>
+      <keyword>call-template</keyword>
+      <keyword>choose</keyword>
+      <keyword>comment</keyword>
+      <keyword>copy-of</keyword>
+      <keyword>copy</keyword>
+      <keyword>decimal-format</keyword>
+      <keyword>document</keyword>
+      <keyword>element</keyword>
+      <keyword>fallback</keyword>
+      <keyword>for-each</keyword>
+      <keyword>if</keyword>
+      <keyword>import</keyword>
+      <keyword>include</keyword>
+      <keyword>key</keyword>
+      <keyword>message</keyword>
+      <keyword>namespace-alias</keyword>
+      <keyword>number</keyword>
+      <keyword>otherwise</keyword>
+      <keyword>output</keyword>
+      <keyword>param</keyword>
+      <keyword>preserve-space</keyword>
+      <keyword>processing-instruction</keyword>
+      <keyword>script</keyword>
+      <keyword>sort</keyword>
+      <keyword>strip-space</keyword>
+      <keyword>stylesheet</keyword>
+      <keyword>template</keyword>
+      <keyword>text</keyword>
+      <keyword>transform</keyword>
+      <keyword>value-of</keyword>
+      <keyword>variable</keyword>
+      <keyword>when</keyword>
+      <keyword>with-param</keyword>
+    </context>
+
+    <context id="xslt-tags">
+      <include>
+        <context ref="elements"/>
+        <context ref="xml:element-name" original="true"/>
+      </include>
+    </context>
+
+    <replace id="xml:namespace" ref="xslt-namespace"/>
+    <replace id="xml:element-name" ref="xslt-tags"/>
+
+    <context id="xslt">
+      <include>
+        <context ref="xml:xml"/>
+      </include>
+    </context>
+  </definitions>
+
+</language>

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Wed Aug 27 08:37:12 2008
@@ -72,6 +72,7 @@
 gtksourceview/language-specs/verilog.lang
 gtksourceview/language-specs/vhdl.lang
 gtksourceview/language-specs/xml.lang
+gtksourceview/language-specs/xslt.lang
 gtksourceview/language-specs/yacc.lang
 gtksourceview/language-specs/classic.xml
 gtksourceview/language-specs/kate.xml

Modified: trunk/tests/testfiles.sh
==============================================================================
--- trunk/tests/testfiles.sh	(original)
+++ trunk/tests/testfiles.sh	Wed Aug 27 08:37:12 2008
@@ -181,6 +181,18 @@
 </foolala>
 EOFEOF
 
+cat > $dir/file.xsl <<EOFEOF
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version='1.0'>
+  <xsl:param name="foo" select="'@bar'"/>
+  <xsl:template match="baz">
+    <p>
+      <b><xsl:value-of select="@lala"/></b>
+    </p>
+  </xsl:template>
+</xsl:stylesheet>
+EOFEOF
+
 cat > $dir/file.y <<EOFEOF
 %{
 #include <stdio.h>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]