aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-07-01 13:28:57 +0000
committerJoursoir <chat@joursoir.net>2021-07-01 13:28:57 +0000
commit74d6e788c9430521c96ede21557a9a32bbd76a34 (patch)
tree13b15e5b10efb3f35d629d6d01155bc9aff4fd87
parentf9cbfc1969d7f1d83da764f5f53fd53469830a78 (diff)
downloadsubl-syntax-man-74d6e788c9430521c96ede21557a9a32bbd76a34.tar.gz
subl-syntax-man-74d6e788c9430521c96ede21557a9a32bbd76a34.tar.bz2
subl-syntax-man-74d6e788c9430521c96ede21557a9a32bbd76a34.zip
add awful realization of formatting alternate fonts
Why is it awful? Because a lot of code is duplicated. And the code is badly designed. As a result, we have one bug, which i don't know how to fix (if you know - write me at email): .BI [ "--init, -i"] ^ start italic font style ^ must start bold, but still using italic But I couldn't leave it as it is and have made a dirty trick: ` - match: '"[^\s]' scope: invalid.illegal pop: true` ` If the '"', which is supposed to end the string, has a not white-space as following character, then I scoping it like illegal syntax. Anyway, it's not correct to write this way, put a white-space after '"' :)
-rw-r--r--man.sublime-syntax115
1 files changed, 115 insertions, 0 deletions
diff --git a/man.sublime-syntax b/man.sublime-syntax
index 4f1dadd..1decbe2 100644
--- a/man.sublime-syntax
+++ b/man.sublime-syntax
@@ -43,6 +43,14 @@ contexts:
push: macros_line
pop: true
+ - match: '{{cc}}(?={{font_alt}})\b'
+ scope: keyword.control.man
+ push: font_alts
+ with_prototype:
+ - match: '(?={{escape}}|$)'
+ pop: true
+ pop: true
+
- match: '{{cc}}(?={{font_style}})\b'
scope: keyword.control.man
push: font_styles
@@ -78,6 +86,113 @@ contexts:
pop: true
+ font_alts:
+ - match: \bB
+ scope: keyword.control.man
+ push: font_alt_bold
+ - match: \bR
+ scope: keyword.control.man
+ push: font_alt_regular
+ - match: \bI
+ scope: keyword.control.man
+ push: font_alt_italic
+
+
+ font_alt_bold:
+ - match: I\s+
+ scope: keyword.control.man
+ push:
+ - meta_content_scope: markup.bold.man
+ - include: start_and_end_string
+
+ - match: '\s+'
+ push:
+ - meta_content_scope: markup.italic.man
+ - clear_scopes: 1
+ - include: font_alt_odd_pop
+
+ - match: R\s+
+ scope: keyword.control.man
+ push:
+ - meta_content_scope: markup.bold.man
+ - include: start_and_end_string
+
+ - match: '\s+'
+ push:
+ - meta_content_scope: markup.regular.man
+ - clear_scopes: 1
+ - include: font_alt_odd_pop
+
+
+ font_alt_regular:
+ - match: B\s+
+ scope: keyword.control.man
+ push:
+ - meta_content_scope: markup.regular.man
+ - include: start_and_end_string
+
+ - match: '\s+'
+ push:
+ - meta_content_scope: markup.bold.man
+ - clear_scopes: 1
+ - include: font_alt_odd_pop
+
+ - match: I\s+
+ scope: keyword.control.man
+ push:
+ - meta_content_scope: markup.regular.man
+ - include: start_and_end_string
+
+ - match: '\s+'
+ push:
+ - meta_content_scope: markup.italic.man
+ - clear_scopes: 1
+ - include: font_alt_odd_pop
+
+
+ font_alt_italic:
+ - match: B\s+
+ scope: keyword.control.man
+ push:
+ - meta_content_scope: markup.italic.man
+ - include: start_and_end_string
+
+ - match: '\s+'
+ push:
+ - meta_content_scope: markup.bold.man
+ - clear_scopes: 1
+ - include: font_alt_odd_pop
+
+ - match: R\s+
+ scope: keyword.control.man
+ push:
+ - meta_content_scope: markup.italic.man
+ - include: start_and_end_string
+
+ - match: '\s+'
+ push:
+ - meta_content_scope: markup.regular.man
+ - clear_scopes: 1
+ - include: font_alt_odd_pop
+
+
+ start_and_end_string:
+ - match: '(?<=\s)"'
+ push:
+ - match: '"[^\s]'
+ scope: invalid.illegal
+ pop: true
+ - match: '"'
+ pop: true
+
+
+ font_alt_odd_pop:
+ - include: start_and_end_string
+
+ - match: '\s+'
+ pop: true
+
+
font_styles:
- match: (B\b|{{escape}}(B))
captures: