forked from marshallward/vim-restructuredtext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inline literal escape support; doc updates
Escape character support was disabled for inline literals, which are handled separately from standard inline highlights, in that escape characters are unsupported. Also adding maintainer info to several other language support files.
- Loading branch information
1 parent
0cc9be0
commit 88a3297
Showing
5 changed files
with
62 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
" Maintainer: Marshall Ward <[email protected]> | ||
" Original Maintainer: Nikolai Weibull <[email protected]> | ||
" Website: https://github.com/marshallward/vim-restructuredtext | ||
" Latest Revision: 2018-12-29 | ||
" Latest Revision: 2020-03-31 | ||
|
||
if exists("b:did_ftplugin") | ||
finish | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
" Vim indent file | ||
" Language: reStructuredText Documentation Format | ||
" Previous Maintainer: Nikolai Weibull <[email protected]> | ||
" Latest Revision: 2011-08-03 | ||
" Vim reST indent file | ||
" Language: reStructuredText Documentation Format | ||
" Maintainer: Marshall Ward <[email protected]> | ||
" Previous Maintainer: Nikolai Weibull <[email protected]> | ||
" Latest Revision: 2020-03-31 | ||
|
||
if exists("b:did_indent") | ||
finish | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
" Vim syntax file | ||
" Vim reST syntax file | ||
" Language: reStructuredText documentation format | ||
" Maintainer: Marshall Ward <[email protected]> | ||
" Previous Maintainer: Nikolai Weibull <[email protected]> | ||
" Website: https://github.com/marshallward/vim-restructuredtext | ||
" Latest Revision: 2018-12-29 | ||
" Latest Revision: 2020-03-31 | ||
|
||
if exists("b:current_syntax") | ||
finish | ||
|
@@ -97,22 +97,32 @@ function! s:DefineOneInlineMarkup(name, start, middle, end, char_left, char_righ | |
let first = a:start[0] | ||
endif | ||
|
||
execute 'syn match rstEscape'.a:name.' +\\\\\|\\'.first.'+'.' contained' | ||
if a:start != '``' | ||
let rst_contains=' contains=rstEscape' . a:name | ||
execute 'syn match rstEscape'.a:name.' +\\\\\|\\'.first.'+'.' contained' | ||
else | ||
let rst_contains='' | ||
endif | ||
|
||
execute 'syn region rst' . a:name . | ||
\ ' start=+' . a:char_left . '\zs' . a:start . | ||
\ '\ze[^[:space:]' . a:char_right . a:start[strlen(a:start) - 1] . ']+' . | ||
\ a:middle . | ||
\ ' end=+' . a:end . '\ze\%($\|\s\|[''"’)\]}>/:.,;!?\\-]\)+' . | ||
\ ' contains=rstEscape' . a:name | ||
\ rst_contains | ||
|
||
execute 'hi def link rstEscape'.a:name.' Special' | ||
if a:start != '``' | ||
execute 'hi def link rstEscape'.a:name.' Special' | ||
endif | ||
endfunction | ||
|
||
" TODO: The "middle" argument may no longer be useful here. | ||
function! s:DefineInlineMarkup(name, start, middle, end) | ||
let middle = a:middle != "" ? | ||
\ (' skip=+\\\\\|\\' . a:middle . '\|\s' . a:middle . '+') : | ||
\ "" | ||
if a:middle == '`' | ||
let middle = ' skip=+\s'.a:middle.'+' | ||
else | ||
let middle = ' skip=+\\\\\|\\' . a:middle . '\|\s' . a:middle . '+' | ||
endif | ||
|
||
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, "'", "'") | ||
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '"', '"') | ||
|
@@ -121,8 +131,8 @@ function! s:DefineInlineMarkup(name, start, middle, end) | |
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '{', '}') | ||
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '<', '>') | ||
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '’', '’') | ||
" TODO: Additional Unicode Pd, Po, Pi, Pf, Ps characters | ||
|
||
" TODO: Additional whitespace Unicode characters: Pd, Po, Pi, Pf, Ps | ||
call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\%(^\|\s\|\%ua0\|[/:]\)', '') | ||
|
||
execute 'syn match rst' . a:name . | ||
|
@@ -136,7 +146,7 @@ endfunction | |
call s:DefineInlineMarkup('Emphasis', '\*', '\*', '\*') | ||
call s:DefineInlineMarkup('StrongEmphasis', '\*\*', '\*', '\*\*') | ||
call s:DefineInlineMarkup('InterpretedTextOrHyperlinkReference', '`', '`', '`_\{0,2}') | ||
call s:DefineInlineMarkup('InlineLiteral', '``', "", '``') | ||
call s:DefineInlineMarkup('InlineLiteral', '``', '`', '``') | ||
call s:DefineInlineMarkup('SubstitutionReference', '|', '|', '|_\{0,2}') | ||
call s:DefineInlineMarkup('InlineInternalTargets', '_`', '`', '`') | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters