mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-09 03:53:52 -05:00
Update
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1
|
||||
|
||||
" Vim syntax file
|
||||
" Vim reST syntax file
|
||||
" Language: reStructuredText documentation format
|
||||
" Maintainer: Marshall Ward <marshall.ward@gmail.com>
|
||||
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Website: https://github.com/marshallward/vim-restructuredtext
|
||||
" Latest Revision: 2018-12-29
|
||||
" Latest Revision: 2020-03-31
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
@@ -99,22 +99,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, '"', '"')
|
||||
@@ -123,8 +133,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 .
|
||||
@@ -138,7 +148,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', '_`', '`', '`')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user