[gtksourceview] rst.lang: Check inline markup context
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] rst.lang: Check inline markup context
- Date: Tue, 19 Oct 2021 22:30:14 +0000 (UTC)
commit 8c0a2dc09b9c88b4677356152c6d9d818d74da3c
Author: Pierre Ossman <ossman cendio se>
Date: Fri Oct 15 12:37:35 2021 +0200
rst.lang: Check inline markup context
data/language-specs/rst.lang | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
---
diff --git a/data/language-specs/rst.lang b/data/language-specs/rst.lang
index 846fd1f1..f2d57cfb 100644
--- a/data/language-specs/rst.lang
+++ b/data/language-specs/rst.lang
@@ -101,42 +101,50 @@
<match>^\s*:.+?:</match>
</context>
+ <define-regex id="legal-start" extended="true">
+ ((?<=(\s|[-:/'"<([{‘’“”‚„]))|^)
+ </define-regex>
+
+ <define-regex id="legal-end" extended="true">
+ ((?=(\s|[-.,:;!?\\/'")\]}>‘’“”‚„]))|$)
+ </define-regex>
+
<context id="strong-emphasis" style-ref="strong-emphasis">
- <start>\*\*(?!(\s|$))</start>
- <end>(?<!\s)\*\*</end>
+ <start>(\%{legal-start})\*\*(?!(\s|$))</start>
+ <end>(?<!\s)\*\*(\%{legal-end})</end>
</context>
<context id="emphasis" style-ref="emphasis">
- <start>\*(?!(\s|$))</start>
- <end>(?<!\s)\*</end>
+ <start>(\%{legal-start})\*(?!(\s|$))</start>
+ <end>(?<!\s)\*(\%{legal-end})</end>
</context>
<context id="links">
<include>
<context id="target" style-ref="link">
- <start>_`(?!(\s|$))</start>
- <end>(?<!\s)`</end>
+ <start>(\%{legal-start})_`(?!(\s|$))</start>
+ <end>(?<!\s)`(\%{legal-end})</end>
</context>
<context id="link" style-ref="link">
- <start>`(?!(\s|$|`))</start>
- <end>(?<!\s)`__?</end>
+ <start>(\%{legal-start})`(?!(\s|$|`))</start>
+ <end>(?<!\s)`__?(\%{legal-end})</end>
</context>
<context id="simple-link" style-ref="link">
- <match>[^\W_]\w*_(\%{legal-end})</match>
+ <match>(\%{legal-start})[^\W_]\w*_(\%{legal-end})</match>
</context>
</include>
</context>
<context id="substitution" style-ref="substitution">
- <start>\|(?!(\s|$))</start>
- <end>(?<!\s)\|</end>
+ <start>(\%{legal-start})\|(?!(\s|$))</start>
+ <end>(?<!\s)\|(\%{legal-end})</end>
</context>
<context id="literals">
<include>
<context id="inline-literals" class="no-spell-check" style-ref="code">
- <start>``(?!(\s|$))</start>
- <end>(?<!\s)``</end>
+ <start>(\%{legal-start})``(?!(\s|$))</start>
+ <end>(?<!\s)``(\%{legal-end})</end>
</context>
</include>
</context>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]