[gtksourceview] rst.lang: Handle all link types better



commit f32f7e156686df67881c92ddd7d575400bdb073f
Author: Pierre Ossman <ossman cendio se>
Date:   Fri Oct 15 11:17:13 2021 +0200

    rst.lang: Handle all link types better

 data/language-specs/rst.lang | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/data/language-specs/rst.lang b/data/language-specs/rst.lang
index 689d081c..846fd1f1 100644
--- a/data/language-specs/rst.lang
+++ b/data/language-specs/rst.lang
@@ -111,8 +111,20 @@
       <end>(?&lt;!\s)\*</end>
     </context>
 
-    <context id="link" style-ref="link">
-      <match>(\S+_\b)|(`\b.*?\b`_)</match>
+    <context id="links">
+      <include>
+        <context id="target" style-ref="link">
+          <start>_`(?!(\s|$))</start>
+          <end>(?&lt;!\s)`</end>
+        </context>
+        <context id="link" style-ref="link">
+          <start>`(?!(\s|$|`))</start>
+          <end>(?&lt;!\s)`__?</end>
+        </context>
+        <context id="simple-link" style-ref="link">
+          <match>[^\W_]\w*_(\%{legal-end})</match>
+        </context>
+      </include>
     </context>
 
     <context id="substitution" style-ref="substitution">
@@ -146,7 +158,7 @@
         <context ref="field"/>
         <context ref="strong-emphasis"/>
         <context ref="emphasis"/>
-        <context ref="link"/>
+        <context ref="links"/>
         <context ref="substitution"/>
         <context ref="literals"/>
         <context ref="url"/>


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