Fix commit 72d0220, breaking syntax for bold due to bad punctuation preceded right flank (issue #1325)

This commit is contained in:
Tinmarino
2023-04-19 13:38:02 -04:00
parent 71edcf6802
commit 7a48268d24
4 changed files with 44 additions and 16 deletions
+6 -6
View File
@@ -303,11 +303,11 @@ endfunction
function! vimwiki#u#hi_expand_regex(lst) abort
" Helper: Expand regex from reduced typeface delimiters
" :param: list<list,delimiters>> with reduced regex
" 1: Left delimiter
" 2: right delimiter
" 3: possible characters to ignore (default '$^' => never match)
" 4: can multiply delimiter (boolean) (default 0 => do not repeat)
" :param: list<list<delimiters>> with reduced regex
" 1: Left delimiter (regex)
" 2: Right delimiter (regex)
" 3: Possible characters to ignore (regex: default '$^' => never match)
" 4: Can multiply delimiter (boolean: default 0 => do not repeat)
" Return: list with extended regex delimiters (not inside a word)
" -- [['\*_', '_\*']] -> [['\*_\S\@=', '\S\@<=_\*\%(\s\|$\)\@=']]
" Note: For purposes of this definition, the beginning and the end of the line count as Unicode whitespace.
@@ -354,7 +354,7 @@ function! vimwiki#u#hi_expand_regex(lst) abort
" Right Case2: preceded by a punctuation character and followed by Unicode whitespace or end of line or a punctuation character
let r_right_prefix2 = '\%([' . punctuation . ']\@<=\)'
let r_right_suffix2 = '\%(\%($\|[[:space:]' . punctuation . ']\)\@<=\)'
let r_right_suffix2 = '\%(\%($\|[[:space:]\n' . punctuation . ']\)\@=\)'
" Right Concatenate
let r_end = '\%(' . r_right_prefix1 . r_right_repeat . r_right_suffix1
+6 -6
View File
@@ -684,7 +684,6 @@ function! s:get_default_syntaxlocal() abort
\ 'list_markers': {'type': type([]), 'default': ['-', '1.', '*', 'I)', 'a)']},
\ 'number_types': {'type': type([]), 'default': ['1)', '1.', 'i)', 'I)', 'a)', 'A)']},
\ 'recurring_bullets': {'type': type(0), 'default': 0},
\ 'comment_regex': {'type': type(''), 'default': '^\s*%%.*$'},
\ 'header_symbol': {'type': type(''), 'default': '='},
\ 'rxHR': {'type': type(''), 'default': '^-----*$'},
\ 'rxListDefine': {'type': type(''), 'default': '::\(\s\|$\)'},
@@ -699,10 +698,10 @@ function! s:get_default_syntaxlocal() abort
\ 'post_mark': '}}}'}},
\ 'symH': {'type': type(1), 'default': 1},
\ 'typeface': {'type': type({}), 'default': {
\ 'bold': vimwiki#u#hi_expand_regex([['\*', '\*']]),
\ 'italic': vimwiki#u#hi_expand_regex([['_', '_']]),
\ 'bold': vimwiki#u#hi_expand_regex([['\*', '\*', '[*]', 0]]),
\ 'italic': vimwiki#u#hi_expand_regex([['_', '_', '', 0]]),
\ 'underline': vimwiki#u#hi_expand_regex([]),
\ 'bold_italic': vimwiki#u#hi_expand_regex([['\*_', '_\*'], ['_\*', '\*_']]),
\ 'bold_italic': vimwiki#u#hi_expand_regex([['\*_', '_\*', '[*_]', 1], ['_\*', '\*_', '[*_]', 1]]),
\ 'code': [
\ ['\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@=',
\ '\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@='],
@@ -737,7 +736,6 @@ function! s:get_markdown_syntaxlocal() abort
\ 'list_markers': {'type': type([]), 'default': ['-', '*', '+', '1.']},
\ 'number_types': {'type': type([]), 'default': ['1.']},
\ 'recurring_bullets': {'type': type(0), 'default': 0},
\ 'comment_regex': {'type': type(''), 'default': '^\s*%%.*$\|<!--[^>]*-->'},
\ 'header_symbol': {'type': type(''), 'default': '#'},
\ 'rxHR': {'type': type(''), 'default': '\(^---*$\|^___*$\|^\*\*\**$\)'},
\ 'rxListDefine': {'type': type(''), 'default': '::\%(\s\|$\)'},
@@ -792,7 +790,6 @@ function! s:get_media_syntaxlocal() abort
\ 'list_markers': {'type': type([]), 'default': ['*', '#']},
\ 'number_types': {'type': type([]), 'default': []},
\ 'recurring_bullets': {'type': type(1), 'default': 1},
\ 'comment_regex': {'type': type(''), 'default': '^\s*%%.*$'},
\ 'header_symbol': {'type': type(''), 'default': '='},
\ 'rxHR': {'type': type(''), 'default': '^-----*$'},
\ 'rxListDefine': {'type': type(''), 'default': '^\%(;\|:\)\s'},
@@ -850,6 +847,9 @@ function! s:get_common_syntaxlocal() abort
" -- it should not be changed but let's avoid hardcoding
let res.blockquote_markers = {'type': type([]), 'default': ['>']}
" HTML comment
let res.comment_regex = {'type': type(''), 'default': '\%(^\s*%%.*$\|<!--\%([^>]\|\n\)*-->\)'}
return res
endfunction