[gtksourceview] html: fix handling of the end of <style> and <script>



commit e35de2d4e808c3b9ddc71f95b824ac24e4d79c45
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Feb 5 18:58:07 2014 +0100

    html: fix handling of the end of <style> and <script>
    
    Example:
    
    <style>
    p {
        border: "</style>";
        padding: "/>";
        margin: 5;
    }
    </style>
    
    <script language="/>" />
    
    <script language="javascript">
    var a = "/>";
    var b = "</script>";
    var c = 5;
    </script>
    <p>
    var d = 6;
    </p>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=614072

 data/language-specs/html.lang |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/data/language-specs/html.lang b/data/language-specs/html.lang
index ee1dc3f..33e9ea2 100644
--- a/data/language-specs/html.lang
+++ b/data/language-specs/html.lang
@@ -3,9 +3,9 @@
 
  This file is part of GtkSourceView
 
- Authors: Marco Barisione, Emanuele Aina
- Copyright (C) 2005-2007 Marco Barisione <barisione gmail com>
- Copyright (C) 2005-2007 Emanuele Aina
+ Copyright (C) 2005-2007 - Marco Barisione <barisione gmail com>
+ Copyright (C) 2005-2007 - Emanuele Aina
+ Copyright (C) 2014 - Sébastien Wilmet <swilmet gnome org>
 
  GtkSourceView is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
@@ -215,16 +215,20 @@
 
     <context id="style" class="no-spell-check">
       <start>&lt;\s*style\%]</start>
-      <end>/&gt;|&lt;\s*/\s*style\s*&gt;</end>
-
       <include>
         <context sub-pattern="0" where="start" style-ref="tag"/>
-        <context sub-pattern="0" where="end" style-ref="tag"/>
         <context ref="generic-tag"/>
-        <context id="style-code" extend-parent="false">
+
+        <context end-parent="true" style-ref="tag">
+          <match>/\s*&gt;</match>
+        </context>
+
+        <context id="style-code" end-parent="true">
           <start>&gt;</start>
+          <end>&lt;\s*/\s*style\s*&gt;</end>
           <include>
             <context sub-pattern="0" where="start" style-ref="tag"/>
+            <context sub-pattern="0" where="end" style-ref="tag"/>
             <context ref="css:css"/>
           </include>
         </context>
@@ -233,16 +237,20 @@
 
     <context id="script" class="no-spell-check">
       <start>&lt;\s*script\%]</start>
-      <end>/&gt;|&lt;\s*/\s*script\s*&gt;</end>
-
       <include>
         <context sub-pattern="0" where="start" style-ref="tag"/>
-        <context sub-pattern="0" where="end" style-ref="tag"/>
         <context ref="generic-tag"/>
-        <context id="js-code" extend-parent="false">
+
+        <context end-parent="true" style-ref="tag">
+          <match>/\s*&gt;</match>
+        </context>
+
+        <context id="js-code" end-parent="true">
           <start>&gt;</start>
+          <end>&lt;\s*/\s*script\s*&gt;</end>
           <include>
             <context sub-pattern="0" where="start" style-ref="tag"/>
+            <context sub-pattern="0" where="end" style-ref="tag"/>
             <context ref="js:js"/>
           </include>
         </context>


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