diff options
author | Joursoir <chat@joursoir.net> | 2021-06-27 10:04:16 +0000 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2021-06-27 10:05:20 +0000 |
commit | 4d161fe6e3d4965223973a7e608de4ea1570898a (patch) | |
tree | 71889f2035d0af63bd65a4849620aa24d0f19f50 | |
parent | 554df035bf9f9e8af18f32b2476a0490d3affbe5 (diff) | |
download | subl-syntax-man-4d161fe6e3d4965223973a7e608de4ea1570898a.tar.gz subl-syntax-man-4d161fe6e3d4965223973a7e608de4ea1570898a.tar.bz2 subl-syntax-man-4d161fe6e3d4965223973a7e608de4ea1570898a.zip |
handle font styles by control and escape char
-rw-r--r-- | man.sublime-syntax | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/man.sublime-syntax b/man.sublime-syntax index 093dcda..afd6665 100644 --- a/man.sublime-syntax +++ b/man.sublime-syntax @@ -9,29 +9,26 @@ variables: # Requests always have a period (‘.’) or an apostrophe (‘'’) # as the first character of the input line. cc: ^([.']) # cc - control character + escape: \\f macro: (TH|SH|SS|TP|LP|PP|P|HP|RS|RE)\b numeric: '\b(-)?[0-9.]+\b' font_size: (SM|SB)\b font_alt: (BI|IB|RI|IR|BR|RB)\b font_style: ([BRI]) + end_format: (?={{escape}}|{{cc}}) contexts: main: - match: (?={{cc}}) push: macros - - match: '{{cc}}(?={{font_style}})\b' - scope: keyword.control.man + - match: (?={{escape}}{{font_style}}) push: font_styles with_prototype: - - match: $ + - match: '{{end_format}}' + meta_content_scope: markup.regular.man pop: true - - match: (\\f){{font_style}} - captures: - 1: keyword.control.man - 2: constant.character.escape.man - # Comments begin and finish at the end of the line - match: \\["#] scope: comment.man @@ -47,6 +44,14 @@ contexts: push: macros_line pop: true + - match: '{{cc}}(?={{font_style}})\b' + scope: keyword.control.man + push: font_styles + with_prototype: + - match: '{{end_format}}' + pop: true + pop: true + - match: '{{cc}}\w+\b' scope: support.function.groff push: macros_line @@ -75,13 +80,19 @@ contexts: font_styles: - - match: B - scope: keyword.control.man + - match: (B\b|{{escape}}(B)) + captures: + 1: keyword.control.man + 2: constant.character.escape.man push: - meta_content_scope: markup.bold.man - - match: R - scope: keyword.control.man - - match: I - scope: keyword.control.man + - match: ({{escape}})(R) # only \fR + captures: + 1: keyword.control.man + 2: constant.character.escape.man + - match: (I\b|{{escape}}(I)) + captures: + 1: keyword.control.man + 2: constant.character.escape.man push: - meta_content_scope: markup.italic.man |