[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kate] /: adjust reST link rules
From:       Matthew Woehlke <matthew.woehlke () kitware ! com>
Date:       2014-03-03 21:46:33
Message-ID: E1WKagz-0005vO-KW () scm ! kde ! org
[Download RAW message or body]

Git commit 9156a0221024c7c0dc1569902d304afbb52f7085 by Matthew Woehlke.
Committed on 18/02/2014 at 23:44.
Pushed by mwoehlke into branch 'master'.

adjust reST link rules

Treat non-phrase links in reST the same as other inline markup (i.e.
using the same start/end rules). This fixes highlighting of single-word
links immediately followed by e.g. punctuation.

M  +4    -2    examples/syntax/highlight.rst
M  +1    -1    part/syntax/data/rest.xml

http://commits.kde.org/kate/9156a0221024c7c0dc1569902d304afbb52f7085

diff --git a/examples/syntax/highlight.rst b/examples/syntax/highlight.rst
index d05ecd4..fcc5774 100644
--- a/examples/syntax/highlight.rst
+++ b/examples/syntax/highlight.rst
@@ -36,6 +36,8 @@ Nor is :role:`text`. But `text`:role: should also be a role.
 This text [here] should not be special, but [this]_ is a footnote.
 This [isn't]_ a footnote; no special characters allowed!
 
+Full Stop_. That should make 'stop' a single-word link.
+
 * Let's try some indented stuff...
   ::
     I should be code!
@@ -44,9 +46,9 @@ This [isn't]_ a footnote; no special characters allowed!
 
   .. note:: This should be a directive, not be a comment.
 
-  The definition of this `example`_ link (below) should also not be a comment:
+  The definition of `this example`_ link (below) should also not be a comment:
 
-  .. _example: http://www.example.com
+  .. _this example: http://www.example.com
 
 * Still a list.
 
diff --git a/part/syntax/data/rest.xml b/part/syntax/data/rest.xml
index 1699b56..4cd9165 100644
--- a/part/syntax/data/rest.xml
+++ b/part/syntax/data/rest.xml
@@ -40,7 +40,7 @@
         <RegExpr attribute="InlineInternalTarget" context="#stay" \
                String="&inlinestart;_`[^\s].*`&inlineend;" minimal="true"/>
         <RegExpr attribute="FootnoteReference" context="#stay" \
                String="&inlinestart;\[[&SimpleReferenceNameChars;]+\]_&inlineend;" \
                minimal="true"/>
         <RegExpr attribute="HyperlinkReference" context="#stay" \
                String="&inlinestart;`[^\s].*`_&inlineend;" minimal="true"/>
-        <RegExpr attribute="HyperlinkReference" context="#stay" String="\w+_(\s|$)" \
minimal="true"/> +        <RegExpr attribute="HyperlinkReference" context="#stay" \
                String="&inlinestart;\w+_&inlineend;" minimal="true"/>
         <RegExpr attribute="InterpretedText" context="TrailingRole" \
                String="&inlinestart;`[^\s].*`(?=:[\w-_\.\+]+:)" minimal="true"/>
         <RegExpr attribute="Role" String=":[\w-_\.\+]+:(?=`)" context="Role"/>
       </context>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic