[gtksourceview/cherry-pick-ff930904] Merge branch 'jade_block_comments' into 'master'




commit 7ee2aeb4fb0fbecba2566024578fbf7e86250e32
Author: Christian Hergert <christian hergert me>
Date:   Tue Jun 29 17:49:42 2021 +0000

    Merge branch 'jade_block_comments' into 'master'
    
    jade.lang: Fix block comments
    
    See merge request GNOME/gtksourceview!194
    
    (cherry picked from commit ff93090454edfb0024d9e1bfdc39a1d09762c765)
    
    f79da802 jade.lang: Fix block comments
    5f475cdb jade.lang: Add test file

 data/language-specs/jade.lang       | 10 ++++------
 tests/syntax-highlighting/file.jade | 22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/data/language-specs/jade.lang b/data/language-specs/jade.lang
index 1598f562..29344cd3 100644
--- a/data/language-specs/jade.lang
+++ b/data/language-specs/jade.lang
@@ -206,11 +206,9 @@
       <match>\.[a-zA-Z0-9_-]+</match>
     </context>
 
-    <context id="line-comment" style-ref="comment" end-at-line-end="true" class="comment" 
class-disabled="no-spell-check">
-      <start>//</start>
-      <include>
-        <context ref="def:in-line-comment"/>
-      </include>
+    <context id="block-comment" style-ref="comment" class="comment" end-parent="true" 
class-disabled="no-spell-check">
+      <start>^(?'indent'\s*)\/\/</start>
+      <end>^(?!\%{indent@start}\s+)</end>
     </context>
 
     <context id="jade-executable">
@@ -238,7 +236,7 @@
         <context ref="attribute-id"/>
         <context ref="attribute-class"/>
         <context ref="tags"/>
-        <context ref="line-comment"/>
+        <context ref="block-comment"/>
         <context ref="jade-executable"/>
         <context ref="interpolated" />
         <context ref="jade-filter"/>
diff --git a/tests/syntax-highlighting/file.jade b/tests/syntax-highlighting/file.jade
new file mode 100644
index 00000000..af90c56e
--- /dev/null
+++ b/tests/syntax-highlighting/file.jade
@@ -0,0 +1,22 @@
+// Comment
+- // This is JavaScript
+- var title = 'jade test'
+
+doctype
+html
+  head
+    title #{title}
+  body
+    h1.title #{title}
+    // This comment will be output
+    //- This comment wont be output
+    //-
+      p This element is in a comment
+    p This element is not in a comment
+    p
+      | The pipe always goes at the beginning of its own line,
+      | not counting indentation.
+    p.
+      Using regular tags can help keep your lines short,
+      but interpolated tags may be easier to #[em visualize]
+      whether the tags and text are whitespace-separated.


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