Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| be45bd65f5 | |||
| 11350f572b | |||
| dec6a9ecab | |||
| 57107c7c56 | |||
| 72d02207b0 | |||
| f4bd841a4c | |||
| 5eb5c9c71f | |||
| 8640988c5c | |||
| f5399ffdfa | |||
| a7aa5eb1ea | |||
| 1d35ff035d | |||
| c9af9c7807 | |||
| 8374bcfccf | |||
| cde5dbc92a | |||
| 6993610585 | |||
| 29ac6ee589 | |||
| 035b2f15c7 | |||
| eab70aedaa | |||
| 91fe25ad5f | |||
| 5db16850da | |||
| 87c44caef9 |
@@ -1,14 +1,16 @@
|
|||||||
|
---
|
||||||
# Copied from previous .travis.yml by tinmarino the 2023-03-09
|
# Copied from previous .travis.yml by tinmarino the 2023-03-09
|
||||||
|
|
||||||
# Commented out to avoid verbosity on github commit status
|
# Commented out to avoid verbosity on github commit status
|
||||||
name: CI
|
name: CI
|
||||||
#description: Vimwiki CI test bank
|
|
||||||
|
|
||||||
|
# yamllint disable-line rule:truthy
|
||||||
on: [push, pull_request, workflow_dispatch]
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Typos:
|
Typos:
|
||||||
# Copyed from: https://github.com/junegunn/fzf/blob/master/.github/workflows/typos.yml
|
# Copied from: https://github.com/junegunn/fzf/blob/master/
|
||||||
|
# -- .github/workflows/typos.yml
|
||||||
name: Typos
|
name: Typos
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -20,9 +22,23 @@ jobs:
|
|||||||
config: ./test/resources/typos_config.toml
|
config: ./test/resources/typos_config.toml
|
||||||
|
|
||||||
|
|
||||||
|
Yamllint:
|
||||||
|
# Copied from: https://github.com/junegunn/fzf/blob/master/
|
||||||
|
# -- .github/workflows/typos.yml
|
||||||
|
name: Yamllint
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: ibiqlik/action-yamllint@v3
|
||||||
|
with:
|
||||||
|
file_or_dir: .github/workflows/test-vader-action.yml
|
||||||
|
|
||||||
|
|
||||||
Vint:
|
Vint:
|
||||||
# Copyed from: https://github.com/LudvigHz/vint-action
|
# Copied from: https://github.com/LudvigHz/vint-action
|
||||||
# And local test/run_test.sh
|
# And local ./test/run_test.sh
|
||||||
name: Vint
|
name: Vint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
+33
-10
@@ -449,7 +449,7 @@ function! vimwiki#base#generate_links(create, ...) abort
|
|||||||
let use_caption = vimwiki#vars#get_wikilocal('generated_links_caption', wiki_nr)
|
let use_caption = vimwiki#vars#get_wikilocal('generated_links_caption', wiki_nr)
|
||||||
for link in links
|
for link in links
|
||||||
let link_infos = vimwiki#base#resolve_link(link)
|
let link_infos = vimwiki#base#resolve_link(link)
|
||||||
if !vimwiki#base#is_diary_file(link_infos.filename, copy(l:diary_file_paths))
|
if !vimwiki#base#is_among_diary_files(link_infos.filename, copy(l:diary_file_paths))
|
||||||
let link_tpl = vimwiki#vars#get_syntaxlocal('Link1')
|
let link_tpl = vimwiki#vars#get_syntaxlocal('Link1')
|
||||||
|
|
||||||
let link_caption = vimwiki#base#read_caption(link_infos.filename)
|
let link_caption = vimwiki#base#read_caption(link_infos.filename)
|
||||||
@@ -492,7 +492,7 @@ endfunction
|
|||||||
function! vimwiki#base#goto(...) abort
|
function! vimwiki#base#goto(...) abort
|
||||||
" Jump: to other wikifile, specified on command mode
|
" Jump: to other wikifile, specified on command mode
|
||||||
" Called: by command VimwikiGoto (Exported)
|
" Called: by command VimwikiGoto (Exported)
|
||||||
let key = a:0 > 0 ? a:1 : input('Enter name: ', '',
|
let key = a:0 > 0 && a:1 !=# '' ? a:1 : input('Enter name: ', '',
|
||||||
\ 'customlist,vimwiki#base#complete_links_escaped')
|
\ 'customlist,vimwiki#base#complete_links_escaped')
|
||||||
|
|
||||||
let anchor = a:0 > 1 ? a:2 : ''
|
let anchor = a:0 > 1 ? a:2 : ''
|
||||||
@@ -2236,7 +2236,7 @@ function! vimwiki#base#AddHeaderLevel(...) abort
|
|||||||
" Clause, argument must be <= 1
|
" Clause, argument must be <= 1
|
||||||
" Actually argument is not used :-)
|
" Actually argument is not used :-)
|
||||||
if a:1 > 1
|
if a:1 > 1
|
||||||
call vimwiki#base#AddHeaderLevel(1)
|
call vimwiki#base#AddHeaderLevel(a:1 - 1)
|
||||||
endif
|
endif
|
||||||
let lnum = line('.')
|
let lnum = line('.')
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
@@ -2270,7 +2270,7 @@ function! vimwiki#base#RemoveHeaderLevel(...) abort
|
|||||||
" Clause, argument must be <= 1
|
" Clause, argument must be <= 1
|
||||||
" Actually argument is not used :-)
|
" Actually argument is not used :-)
|
||||||
if a:1 > 1
|
if a:1 > 1
|
||||||
call vimwiki#base#RemoveHeaderLevel(1)
|
call vimwiki#base#RemoveHeaderLevel(a:1 - 1)
|
||||||
endif
|
endif
|
||||||
let lnum = line('.')
|
let lnum = line('.')
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
@@ -2639,13 +2639,10 @@ function! s:clean_url(url) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#base#is_diary_file(filename, ...) abort
|
function! vimwiki#base#is_among_diary_files(filename, diary_file_paths) abort
|
||||||
" Check if 1.filename is a diary file
|
" Check if filename is in a list of diary files
|
||||||
" An optional second argument allows you to pass in a list of diary files rather
|
|
||||||
" than generating a list on each call to the function.
|
|
||||||
let l:diary_file_paths = a:0 > 0 ? a:1 : vimwiki#diary#get_diary_files()
|
|
||||||
let l:normalised_file_paths =
|
let l:normalised_file_paths =
|
||||||
\ map(l:diary_file_paths, 'vimwiki#path#normalize(v:val)')
|
\ map(a:diary_file_paths, 'vimwiki#path#normalize(v:val)')
|
||||||
" Escape single quote (Issue #886)
|
" Escape single quote (Issue #886)
|
||||||
let filename = substitute(a:filename, "'", "''", 'g')
|
let filename = substitute(a:filename, "'", "''", 'g')
|
||||||
let l:matching_files =
|
let l:matching_files =
|
||||||
@@ -2654,6 +2651,32 @@ function! vimwiki#base#is_diary_file(filename, ...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! vimwiki#base#is_diary_file(filename, ...) abort
|
||||||
|
" Check if filename is a diary file.
|
||||||
|
"
|
||||||
|
" For our purposes, a diary file is any readable file with the current wiki
|
||||||
|
" extension in diary_rel_path.
|
||||||
|
"
|
||||||
|
" An optional second argument allows you to pass in a list of diary files
|
||||||
|
" rather than generating a list on each call to the function. This is
|
||||||
|
" handled by passing off to is_among_diary_files(). This behavior is
|
||||||
|
" retained just in case anyone has scripted against is_diary_file(), but
|
||||||
|
" shouldn't be used internally by VimWiki code. Call is_among_diary_files()
|
||||||
|
" directly instead.
|
||||||
|
|
||||||
|
" Handle the case with diary file paths passed in:
|
||||||
|
if a:0 > 0
|
||||||
|
return vimwiki#base#is_among_diary_files(a:filename, a:1)
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:readable = filereadable(a:filename)
|
||||||
|
let l:diary_path = vimwiki#vars#get_wikilocal('path') .
|
||||||
|
\ vimwiki#vars#get_wikilocal('diary_rel_path')
|
||||||
|
let l:in_diary_path = (0 == stridx(a:filename, l:diary_path))
|
||||||
|
return l:readable && l:in_diary_path
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template) abort
|
function! vimwiki#base#normalize_link_helper(str, rxUrl, rxDesc, template) abort
|
||||||
" Treat link string towards normalization
|
" Treat link string towards normalization
|
||||||
" [__LinkDescription__](__LinkUrl__.__FileExtension__)
|
" [__LinkDescription__](__LinkUrl__.__FileExtension__)
|
||||||
|
|||||||
@@ -1,9 +1,18 @@
|
|||||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
" Title: Vimwiki list functions
|
||||||
" Vimwiki autoload plugin file
|
"
|
||||||
" Description: Everything concerning lists and checkboxes
|
" Description:
|
||||||
|
" Everything concerning lists and checkboxes
|
||||||
|
"
|
||||||
|
" Also helpers for blockquotes as this file has intelligence and map (issue #1274)
|
||||||
|
" i <Cr>
|
||||||
|
" n o
|
||||||
|
" n O
|
||||||
|
" Which also got exploited for blocquotes
|
||||||
|
"
|
||||||
" Home: https://github.com/vimwiki/vimwiki/
|
" Home: https://github.com/vimwiki/vimwiki/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if exists('g:loaded_vimwiki_list_auto') || &compatible
|
if exists('g:loaded_vimwiki_list_auto') || &compatible
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
@@ -145,11 +154,24 @@ function! s:line_has_marker(lnum) abort
|
|||||||
" Returns: 2 if there is a marker and text
|
" Returns: 2 if there is a marker and text
|
||||||
" 1 for a marker and no text
|
" 1 for a marker and no text
|
||||||
" 0 for no marker at all (empty line or only text)
|
" 0 for no marker at all (empty line or only text)
|
||||||
if getline(a:lnum) =~# vimwiki#vars#get_wikilocal('rxListItem').'\s*$'
|
|
||||||
|
" Concatenate regex list and blockquote item
|
||||||
|
let rx_list_or_blockquote =
|
||||||
|
\ '\%('
|
||||||
|
\ . vimwiki#vars#get_wikilocal('rxListItem')
|
||||||
|
\ . '\|'
|
||||||
|
\ . vimwiki#vars#get_wikilocal('rxBlockquoteItem')
|
||||||
|
\ . '\)'
|
||||||
|
|
||||||
|
" Search for marker
|
||||||
|
if getline(a:lnum) =~# rx_list_or_blockquote . '\s*$'
|
||||||
|
" Found without text
|
||||||
return 1
|
return 1
|
||||||
elseif getline(a:lnum) =~# vimwiki#vars#get_wikilocal('rxListItem').'\s*\S'
|
elseif getline(a:lnum) =~# rx_list_or_blockquote . '\s*\S'
|
||||||
|
" Found with text
|
||||||
return 2
|
return 2
|
||||||
else
|
else
|
||||||
|
" Not found
|
||||||
return 0
|
return 0
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -178,12 +200,17 @@ endfunction
|
|||||||
" ---------------------------------------------------------
|
" ---------------------------------------------------------
|
||||||
|
|
||||||
function! s:get_item(lnum) abort
|
function! s:get_item(lnum) abort
|
||||||
" Returns: the mainly used data structure in this file
|
" Return: the mainly used data structure in this file
|
||||||
" An item represents a single list item and is a dictionary with the keys
|
" An item represents a single list item and is a dictionary with the keys
|
||||||
" lnum - the line number of the list item
|
" lnum - the line number of the list item
|
||||||
" type - 1 for bulleted item, 2 for numbered item, 0 for a regular line (default)
|
" type - the type of marker at current line
|
||||||
|
" - 0 for a regular line (default)
|
||||||
|
" - 1 for bulleted item
|
||||||
|
" - 2 for numbered item
|
||||||
|
" - 3 a blockquote item (see #1274 to add line-continuation trick to blockquotes)
|
||||||
" mrkr - the concrete marker, e.g. '**' or 'b)' (default '')
|
" mrkr - the concrete marker, e.g. '**' or 'b)' (default '')
|
||||||
" cb - the char in the checkbox or '' if there is no checkbox
|
" cb - the char in the checkbox or '' if there is no checkbox
|
||||||
|
|
||||||
" Init default
|
" Init default
|
||||||
let item = {'lnum': a:lnum}
|
let item = {'lnum': a:lnum}
|
||||||
let item.type = 0
|
let item.type = 0
|
||||||
@@ -195,7 +222,15 @@ function! s:get_item(lnum) abort
|
|||||||
return item
|
return item
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Search for list on current line
|
" Clause: Search for blockquotes (#1274) and return it if found
|
||||||
|
let matches = matchlist(getline(a:lnum), vimwiki#vars#get_wikilocal('rxBlockquoteItem'))
|
||||||
|
if len(matches) >= 1 && matches[1] !=? ''
|
||||||
|
let item.type = 3
|
||||||
|
let item.mrkr = matches[1]
|
||||||
|
return item
|
||||||
|
endif
|
||||||
|
|
||||||
|
" List: Search for list on current line if no blockquotes
|
||||||
let matches = matchlist(getline(a:lnum), vimwiki#vars#get_wikilocal('rxListItem'))
|
let matches = matchlist(getline(a:lnum), vimwiki#vars#get_wikilocal('rxListItem'))
|
||||||
" Clause: If not on a list line => do not work
|
" Clause: If not on a list line => do not work
|
||||||
if matches == [] ||
|
if matches == [] ||
|
||||||
@@ -205,6 +240,7 @@ function! s:get_item(lnum) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Fill item
|
" Fill item
|
||||||
|
" The checkbox inner is the last match
|
||||||
let item.cb = matches[3]
|
let item.cb = matches[3]
|
||||||
if matches[1] !=? ''
|
if matches[1] !=? ''
|
||||||
let item.type = 1
|
let item.type = 1
|
||||||
@@ -1842,3 +1878,5 @@ function! vimwiki#lst#fold_level(lnum) abort
|
|||||||
endif
|
endif
|
||||||
return '='
|
return '='
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
||||||
|
|||||||
@@ -117,7 +117,8 @@ function! s:scan_tags(lines, page_name) abort
|
|||||||
endfor
|
endfor
|
||||||
let current_complete_anchor .= header
|
let current_complete_anchor .= header
|
||||||
endif
|
endif
|
||||||
continue " tags are not allowed in headers
|
" See: issue #1316 to allow tags in header
|
||||||
|
" continue " tags are not allowed in headers
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Scan line for tags. There can be many of them.
|
" Scan line for tags. There can be many of them.
|
||||||
@@ -448,3 +449,21 @@ function! vimwiki#tags#complete_tags(ArgLead, CmdLine, CursorPos) abort
|
|||||||
let taglist = vimwiki#tags#get_tags()
|
let taglist = vimwiki#tags#get_tags()
|
||||||
return join(taglist, "\n")
|
return join(taglist, "\n")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! vimwiki#tags#search_tags(tag_pattern) abort
|
||||||
|
" See #1316 and rxTags in vars.vim
|
||||||
|
let tf = vimwiki#vars#get_syntaxlocal('tag_format')
|
||||||
|
|
||||||
|
" Craft regex
|
||||||
|
let rx_this_tag = '/'
|
||||||
|
let rx_this_tag .= tf.pre . '\@<=' . tf.pre_mark
|
||||||
|
let rx_this_tag .= '\%(' . tf.in . tf.sep . '\)*'
|
||||||
|
let rx_this_tag .= a:tag_pattern
|
||||||
|
let rx_this_tag .= '\%(' . tf.sep . tf.in . '\)*'
|
||||||
|
let rx_this_tag .= tf.post_mark . tf.post . '\@='
|
||||||
|
let rx_this_tag .= '/'
|
||||||
|
|
||||||
|
" Search in current wiki folder
|
||||||
|
return vimwiki#base#search(rx_this_tag)
|
||||||
|
endfunction
|
||||||
|
|||||||
+35
-24
@@ -295,13 +295,19 @@ endfunction
|
|||||||
function! vimwiki#u#get_punctuation_string() abort
|
function! vimwiki#u#get_punctuation_string() abort
|
||||||
" Faster
|
" Faster
|
||||||
" See: https://github.github.com/gfm/#ascii-punctuation-character
|
" See: https://github.github.com/gfm/#ascii-punctuation-character
|
||||||
return '!"#$%&''()*+,-./:;<=>?@\[\\\]^`{}|~'
|
" res = '!"#$%&''()*+,-./:;<=>?@\[\\\]^`{}|~'
|
||||||
|
" But I removed the * as it is treated as a special case
|
||||||
|
return '!"#$%&''()+,-./:;<=>?@\[\\\]^`{}|~'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#u#hi_expand_regex(lst) abort
|
function! vimwiki#u#hi_expand_regex(lst) abort
|
||||||
" Helper: Expand regex from reduced typeface delimiters
|
" Helper: Expand regex from reduced typeface delimiters
|
||||||
" :param: list<list,delimiters>> with reduced regex
|
" :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)
|
||||||
" Return: list with extended regex delimiters (not inside a word)
|
" Return: list with extended regex delimiters (not inside a word)
|
||||||
" -- [['\*_', '_\*']] -> [['\*_\S\@=', '\S\@<=_\*\%(\s\|$\)\@=']]
|
" -- [['\*_', '_\*']] -> [['\*_\S\@=', '\S\@<=_\*\%(\s\|$\)\@=']]
|
||||||
" Note: For purposes of this definition, the beginning and the end of the line count as Unicode whitespace.
|
" Note: For purposes of this definition, the beginning and the end of the line count as Unicode whitespace.
|
||||||
@@ -313,42 +319,46 @@ function! vimwiki#u#hi_expand_regex(lst) abort
|
|||||||
for a_delimiter in a:lst
|
for a_delimiter in a:lst
|
||||||
let r_left_del = a_delimiter[0]
|
let r_left_del = a_delimiter[0]
|
||||||
let r_right_del = a_delimiter[1]
|
let r_right_del = a_delimiter[1]
|
||||||
|
let r_repeat_del = len(a_delimiter) >= 3 ? a_delimiter[2] : '$^'
|
||||||
|
let b_can_mult = len(a_delimiter) >= 4 ? a_delimiter[3] : 0
|
||||||
|
|
||||||
|
" Craft the repeatable middle
|
||||||
|
let r_mult = b_can_mult ? '\+' : ''
|
||||||
|
let r_left_repeat = '\%(\%(' . r_left_del . '\)' . r_mult . '\)'
|
||||||
|
let r_right_repeat = '\%(\%(' . r_right_del . '\)' . r_mult . '\)'
|
||||||
|
let r_unescaped_repeat = '\%(\\\|\\\@<!' . r_repeat_del . '\)'
|
||||||
|
|
||||||
" Regex Start:
|
" Regex Start:
|
||||||
" Left-Flanking is not followed by space (or need of line)
|
" Left-Flanking is not followed by space (or need of line)
|
||||||
let r_left_prefix = '\%(^\|[[:space:]]\@<=\)'
|
|
||||||
let r_left_prefix = '\\\@<!'
|
|
||||||
" -- not followed by Unicode whitespace,
|
|
||||||
let r_left_suffix = '\%([^[:space:]]\@=\)'
|
|
||||||
|
|
||||||
" Left Case1: not followed by punctuation
|
" Left Case1: not followed by punctuation, start with blacklist
|
||||||
let r_left_suffix1 = '\%(\%([^[:space:]' . punctuation . ']\)\@=\)'
|
|
||||||
" -- Can escape the leftflank
|
" -- Can escape the leftflank
|
||||||
let r_left_prefix1 = '\%(^\|\\\@<!\)'
|
let r_left_prefix1 = '\%(^\|' . r_unescaped_repeat . '\@<!\)'
|
||||||
|
let r_left_suffix1 = '\%(\%([[:space:]\n' . punctuation . ']\|' . r_unescaped_repeat . '\)\@!\)'
|
||||||
|
|
||||||
" Left Case2: followed by punctuation so must be preceded by Unicode whitespace or start of line or a punctuation character.
|
" Left Case2: followed by punctuation so must be preceded by whitelisted Unicode whitespace or start of line or a punctuation character.
|
||||||
|
let r_left_prefix2 = '\%(\%(^\|[[:space:]\n' . punctuation . ']\)\@<=\)'
|
||||||
let r_left_suffix2 = '\%([' . punctuation . ']\@=\)'
|
let r_left_suffix2 = '\%([' . punctuation . ']\@=\)'
|
||||||
let r_left_prefix2 = '\%(\%(^\|[[:space:]' . punctuation . ']\)\@<=\)'
|
|
||||||
|
|
||||||
" Left Concatenate
|
" Left Concatenate
|
||||||
let r_start = '\%(' . r_left_prefix1 . r_left_del . r_left_suffix1
|
let r_start = '\%(' . r_left_prefix1 . '\zs' . r_left_repeat . '\ze' . r_left_suffix1
|
||||||
let r_start .= '\|' . r_left_prefix2 . r_left_del . r_left_suffix2 . '\)'
|
let r_start .= '\|' . r_left_prefix2 . '\zs' . r_left_repeat . '\ze' . r_left_suffix2 . '\)'
|
||||||
|
|
||||||
" Regex End:
|
" Regex End:
|
||||||
" not preceded by Unicode whitespace
|
" not preceded by Unicode whitespace
|
||||||
let r_right_prefix = '\(^\|[^[:space:]]\@<=\)'
|
let r_right_prefix = '\(^\|[^[:space:]]\@<=\)'
|
||||||
|
|
||||||
" Right Case1: not preceded by a punctuation character (or start of line)
|
" Right Case1: not preceded by a punctuation character (or start of line)
|
||||||
let r_right_prefix1 = '\%(\%(^\|[^[:space:]' . punctuation . ']\)\@<=\)'
|
let r_right_prefix1 = '\%(^\|\%([[:space:]\n' . punctuation . ']\|' . r_unescaped_repeat . '\)\@<!\)'
|
||||||
let r_right_suffix1 = ''
|
let r_right_suffix1 = '\%($\|' . r_unescaped_repeat . '\@!\)'
|
||||||
|
|
||||||
" Right Case2: preceded by a punctuation character and followed by Unicode whitespace or end of line or a punctuation character
|
" 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_prefix2 = '\%([' . punctuation . ']\@<=\)'
|
||||||
let r_right_suffix2 = '\%(\%($\|[[:space:]' . punctuation . ']\)\@<=\)'
|
let r_right_suffix2 = '\%(\%($\|[[:space:]' . punctuation . ']\)\@<=\)'
|
||||||
|
|
||||||
" Right Concatenate
|
" Right Concatenate
|
||||||
let r_end = '\%(' . r_right_prefix1 . r_right_del . r_right_suffix1
|
let r_end = '\%(' . r_right_prefix1 . r_right_repeat . r_right_suffix1
|
||||||
let r_end .= '\|' . r_right_prefix2 . r_right_del . r_right_suffix2 . '\)'
|
let r_end .= '\|' . r_right_prefix2 . r_right_repeat . r_right_suffix2 . '\)'
|
||||||
|
|
||||||
call add(res, [r_start, r_end])
|
call add(res, [r_start, r_end])
|
||||||
endfor
|
endfor
|
||||||
@@ -359,7 +369,8 @@ endfunction
|
|||||||
|
|
||||||
function! vimwiki#u#hi_tag(tag_pre, tag_post, syntax_group, contains, ...) abort
|
function! vimwiki#u#hi_tag(tag_pre, tag_post, syntax_group, contains, ...) abort
|
||||||
" Helper: Create highlight region between two tags
|
" Helper: Create highlight region between two tags
|
||||||
" :param: tag <string> example '<b>'
|
" :param: tag_pre <string>: opening tag example '<b>'
|
||||||
|
" :param: tag_post <string>: closing tag example '</b>'
|
||||||
" :param: syntax_group <string> example: VimwikiBold
|
" :param: syntax_group <string> example: VimwikiBold
|
||||||
" :param: contains <string> coma separated and prefixed, default VimwikiHTMLTag
|
" :param: contains <string> coma separated and prefixed, default VimwikiHTMLTag
|
||||||
" :param: (1) <boolean> is contained
|
" :param: (1) <boolean> is contained
|
||||||
@@ -407,6 +418,13 @@ function! vimwiki#u#hi_typeface(dic) abort
|
|||||||
|
|
||||||
let nested = vimwiki#u#get_syntax_dic().nested
|
let nested = vimwiki#u#get_syntax_dic().nested
|
||||||
|
|
||||||
|
" Bold Italic
|
||||||
|
if has_key(a:dic, 'bold_italic')
|
||||||
|
for bi in a:dic['bold_italic']
|
||||||
|
call vimwiki#u#hi_tag(bi[0], bi[1], 'VimwikiBoldItalic', nested . ',VimwikiBoldItalicUnderline')
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
|
||||||
" Italic
|
" Italic
|
||||||
for i in a:dic['italic']
|
for i in a:dic['italic']
|
||||||
" -- Italic 1
|
" -- Italic 1
|
||||||
@@ -435,13 +453,6 @@ function! vimwiki#u#hi_typeface(dic) abort
|
|||||||
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiUnderlineItalicBold', nested, 2)
|
call vimwiki#u#hi_tag(b[0], b[1], 'VimwikiUnderlineItalicBold', nested, 2)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
" Bold Italic
|
|
||||||
if has_key(a:dic, 'bold_italic')
|
|
||||||
for bi in a:dic['bold_italic']
|
|
||||||
call vimwiki#u#hi_tag(bi[0], bi[1], 'VimwikiBoldItalic', nested . ',VimwikiBoldItalicUnderline')
|
|
||||||
endfor
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Underline
|
" Underline
|
||||||
for u in a:dic['underline']
|
for u in a:dic['underline']
|
||||||
" -- Underline 1
|
" -- Underline 1
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
" Title: Vimwiki variable definition and manipulation functions
|
||||||
" Vimwiki autoload plugin file
|
"
|
||||||
" Description: Vimwiki variable definition and manipulation
|
|
||||||
" Home: https://github.com/vimwiki/vimwiki/
|
" Home: https://github.com/vimwiki/vimwiki/
|
||||||
|
|
||||||
" ------------------------------------------------------------------------------------------------
|
" ------------------------------------------------------------------------------------------------
|
||||||
@@ -610,6 +609,8 @@ function! s:normalize_wikilocal_settings() abort
|
|||||||
endif
|
endif
|
||||||
call s:populate_list_vars(wiki_settings)
|
call s:populate_list_vars(wiki_settings)
|
||||||
|
|
||||||
|
call s:populate_blockquote_vars(wiki_settings)
|
||||||
|
|
||||||
" Check nested syntax
|
" Check nested syntax
|
||||||
for keyword in keys(wiki_settings.nested_syntaxes)
|
for keyword in keys(wiki_settings.nested_syntaxes)
|
||||||
if type(keyword) != type('') || empty(keyword) || type(wiki_settings.nested_syntaxes[keyword]) != type('') ||
|
if type(keyword) != type('') || empty(keyword) || type(wiki_settings.nested_syntaxes[keyword]) != type('') ||
|
||||||
@@ -751,10 +752,21 @@ function! s:get_markdown_syntaxlocal() abort
|
|||||||
\ 'post_mark': '\%(`\{3,}\|\~\{3,}\)'}},
|
\ 'post_mark': '\%(`\{3,}\|\~\{3,}\)'}},
|
||||||
\ 'symH': {'type': type(0), 'default': 0},
|
\ 'symH': {'type': type(0), 'default': 0},
|
||||||
\ 'typeface': {'type': type({}), 'default': {
|
\ 'typeface': {'type': type({}), 'default': {
|
||||||
\ 'bold': vimwiki#u#hi_expand_regex([['__', '__'], ['\*\*', '\*\*']]),
|
\ 'bold': vimwiki#u#hi_expand_regex([
|
||||||
\ 'italic': vimwiki#u#hi_expand_regex([['\*', '\*'], ['_', '_']]),
|
\ ['__', '__', '[_*]', 1],
|
||||||
|
\ ['\*\*', '\*\*', '[_*]', 1],
|
||||||
|
\ ]),
|
||||||
|
\ 'italic': vimwiki#u#hi_expand_regex([
|
||||||
|
\ ['_', '_', '[_*]', 0],
|
||||||
|
\ ['\*', '\*', '[_*]', 0],
|
||||||
|
\ ['\*_', '_\*', '[_*]', 1],
|
||||||
|
\ ['_\*', '\*_', '[_*]', 1],
|
||||||
|
\ ]),
|
||||||
\ 'underline': vimwiki#u#hi_expand_regex([]),
|
\ 'underline': vimwiki#u#hi_expand_regex([]),
|
||||||
\ 'bold_italic': vimwiki#u#hi_expand_regex([['\*_', '_\*'], ['_\*', '\*_'], ['\*\*\*', '\*\*\*'], ['___', '___']]),
|
\ 'bold_italic': vimwiki#u#hi_expand_regex([
|
||||||
|
\ ['___', '___', '[_*]', 1],
|
||||||
|
\ ['\*\*\*', '\*\*\*', '[_*]', 1],
|
||||||
|
\ ]),
|
||||||
\ 'code': [
|
\ 'code': [
|
||||||
\ ['\%(^\|[^`\\]\)\@<=`\%($\|[^`]\)\@=',
|
\ ['\%(^\|[^`\\]\)\@<=`\%($\|[^`]\)\@=',
|
||||||
\ '\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@='],
|
\ '\%(^\|[^`]\)\@<=`\%($\|[^`]\)\@='],
|
||||||
@@ -834,6 +846,10 @@ function! s:get_common_syntaxlocal() abort
|
|||||||
let s:rx_inline_math_start = '\%(^\|[^$\\]\)\@<=\$\%($\|[^$[:space:]]\)\@='
|
let s:rx_inline_math_start = '\%(^\|[^$\\]\)\@<=\$\%($\|[^$[:space:]]\)\@='
|
||||||
let s:rx_inline_math_end = '\%(^\|[^$\\[:space:]]\)\@<=\$\%($\|[^$0-9]\)\@='
|
let s:rx_inline_math_end = '\%(^\|[^$\\[:space:]]\)\@<=\$\%($\|[^$0-9]\)\@='
|
||||||
|
|
||||||
|
" Blockquote marker (#1274)
|
||||||
|
" -- it should not be changed but let's avoid hardcoding
|
||||||
|
let res.blockquote_markers = {'type': type([]), 'default': ['>']}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -1121,6 +1137,22 @@ function! s:populate_list_vars(wiki) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! s:populate_blockquote_vars(wiki) abort
|
||||||
|
" Populate blockquote variable
|
||||||
|
" Start being more intelligent on blockquote line continuation
|
||||||
|
" See: issue #1274
|
||||||
|
|
||||||
|
" Start of line and spaces
|
||||||
|
let a:wiki.rxBlockquoteItem = '^\s*\('
|
||||||
|
|
||||||
|
" Content
|
||||||
|
let blockquote_markers = vimwiki#vars#get_syntaxlocal('blockquote_markers')
|
||||||
|
let a:wiki.rxBlockquoteItem .= join(blockquote_markers, '\|')
|
||||||
|
|
||||||
|
let a:wiki.rxBlockquoteItem .= '\)'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! s:populate_extra_markdown_vars() abort
|
function! s:populate_extra_markdown_vars() abort
|
||||||
" Populate markdown specific syntax variables
|
" Populate markdown specific syntax variables
|
||||||
let mkd_syntax = g:vimwiki_syntaxlocal_vars['markdown']
|
let mkd_syntax = g:vimwiki_syntaxlocal_vars['markdown']
|
||||||
@@ -1681,3 +1713,4 @@ function! vimwiki#vars#number_of_wikis() abort
|
|||||||
" Return: number of registered wikis + temporary
|
" Return: number of registered wikis + temporary
|
||||||
return len(g:vimwiki_wikilocal_vars) - 1
|
return len(g:vimwiki_wikilocal_vars) - 1
|
||||||
endfunction
|
endfunction
|
||||||
|
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
|
||||||
|
|||||||
+47
-16
@@ -1190,13 +1190,13 @@ in HTML: >
|
|||||||
alt="Vimwiki"/>
|
alt="Vimwiki"/>
|
||||||
|
|
||||||
Transclude image with alternate text and some style: >
|
Transclude image with alternate text and some style: >
|
||||||
{{http://.../vimwiki_logo.png|cool stuff|style="width:150px;height:120px;"}}
|
{{https://.../vimwiki_logo.png|cool stuff|style="width:150px;height:120px;"}}
|
||||||
in HTML: >
|
in HTML: >
|
||||||
<img src="https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png"
|
<img src="https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png"
|
||||||
alt="cool stuff" style="width:150px; height:120px"/>
|
alt="cool stuff" style="width:150px; height:120px"/>
|
||||||
|
|
||||||
Transclude image _without_ alternate text and with a CSS class: >
|
Transclude image _without_ alternate text and with a CSS class: >
|
||||||
{{http://.../vimwiki_logo.png||class="center flow blabla"}}
|
{{https://.../vimwiki_logo.png||class="center flow blabla"}}
|
||||||
in HTML: >
|
in HTML: >
|
||||||
<img src="https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png"
|
<img src="https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png"
|
||||||
alt="" class="center flow blabla"/>
|
alt="" class="center flow blabla"/>
|
||||||
@@ -1207,16 +1207,16 @@ See |VimwikiWikiIncludeHandler|.
|
|||||||
Thumbnail links~
|
Thumbnail links~
|
||||||
>
|
>
|
||||||
Thumbnail links are constructed like this: >
|
Thumbnail links are constructed like this: >
|
||||||
[[http://someaddr.com/bigpicture.jpg|{{http://someaddr.com/thumbnail.jpg}}]]
|
[[https://someaddr.com/bigpicture.jpg|{{https://someaddr.com/thumbnail.jpg}}]]
|
||||||
|
|
||||||
in HTML: >
|
in HTML: >
|
||||||
<a href="http://someaddr.com/ ... /.jpg">
|
<a href="https://someaddr.com/ ... /.jpg">
|
||||||
<img src="http://../thumbnail.jpg /></a>
|
<img src="https://../thumbnail.jpg /></a>
|
||||||
|
|
||||||
Markdown Links~
|
Markdown Links~
|
||||||
|
|
||||||
These links are only available for Markdown syntax. See
|
These links are only available for Markdown syntax. See
|
||||||
http://daringfireball.net/projects/markdown/syntax#link.
|
https://daringfireball.net/projects/markdown/syntax#link.
|
||||||
|
|
||||||
Inline link: >
|
Inline link: >
|
||||||
[Looks like this](URL)
|
[Looks like this](URL)
|
||||||
@@ -1456,7 +1456,7 @@ See |vimwiki-option-nested_syntaxes| and
|
|||||||
5.8. Mathematical formulae *vimwiki-syntax-math*
|
5.8. Mathematical formulae *vimwiki-syntax-math*
|
||||||
|
|
||||||
Mathematical formulae are highlighted, and can be rendered in HTML using the
|
Mathematical formulae are highlighted, and can be rendered in HTML using the
|
||||||
powerful open source display engine MathJax (http://www.mathjax.org/).
|
powerful open source display engine MathJax (https://www.mathjax.org/).
|
||||||
|
|
||||||
There are three supported syntaxes, which are inline, block display and
|
There are three supported syntaxes, which are inline, block display and
|
||||||
block environment.
|
block environment.
|
||||||
@@ -2029,7 +2029,7 @@ If you have Calendar.vim installed you can use it to create diary notes.
|
|||||||
Just open calendar with :Calendar and tap <Enter> on the date. A wiki file
|
Just open calendar with :Calendar and tap <Enter> on the date. A wiki file
|
||||||
will be created in the default wiki's diary.
|
will be created in the default wiki's diary.
|
||||||
|
|
||||||
Get it from http://www.vim.org/scripts/script.php?script_id=52
|
Get it from https://www.vim.org/scripts/script.php?script_id=52
|
||||||
|
|
||||||
See |g:vimwiki_use_calendar| option to turn it off/on.
|
See |g:vimwiki_use_calendar| option to turn it off/on.
|
||||||
|
|
||||||
@@ -2948,6 +2948,14 @@ Where:
|
|||||||
- `['*', '-', '+']` is the option value
|
- `['*', '-', '+']` is the option value
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*blockquote_markers*
|
||||||
|
|
||||||
|
List of markers to define the blockquote regrion
|
||||||
|
|
||||||
|
Default: ['>']
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*yaml_metadata_block*
|
*yaml_metadata_block*
|
||||||
|
|
||||||
@@ -3817,7 +3825,7 @@ generate and follow_link
|
|||||||
----------------------------------------------------- ReGeX
|
----------------------------------------------------- ReGeX
|
||||||
| pre | '^\|\s' | Limitations to tag precedence
|
| pre | '^\|\s' | Limitations to tag precedence
|
||||||
| pre_mark | ':' | Tag list opener
|
| pre_mark | ':' | Tag list opener
|
||||||
| in | '[:space:]]\+' | Tag permitted characters
|
| in | '[[:space:]]\+' | Tag permitted characters
|
||||||
| sep | ':' | Tag separators in a tag list
|
| sep | ':' | Tag separators in a tag list
|
||||||
| post_mark | ':' | Tag list closer
|
| post_mark | ':' | Tag list closer
|
||||||
| post | '\s\|$' | Limitations to tag following
|
| post | '\s\|$' | Limitations to tag following
|
||||||
@@ -3861,15 +3869,15 @@ See CONTRIBUTING.md for info about how to file bugs etc.
|
|||||||
==============================================================================
|
==============================================================================
|
||||||
15. Development *vimwiki-development*
|
15. Development *vimwiki-development*
|
||||||
|
|
||||||
Homepage: http://vimwiki.github.io/
|
Homepage: https://vimwiki.github.io/
|
||||||
Github: https://github.com/vimwiki/vimwiki/
|
Github: https://github.com/vimwiki/vimwiki/
|
||||||
Vim plugins: http://www.vim.org/scripts/script.php?script_id=2226
|
Vim plugins: https://www.vim.org/scripts/script.php?script_id=2226
|
||||||
Old homepage: http://code.google.com/p/vimwiki/
|
Old homepage: https://code.google.com/p/vimwiki/
|
||||||
|
|
||||||
Contributors and their Github usernames in roughly chronological order:
|
Contributors and their Github usernames in roughly chronological order:
|
||||||
|
|
||||||
- Maxim Kim (@habamax) <habamax@gmail.com> as original author
|
- Maxim Kim (@habamax) <habamax@gmail.com> as original author
|
||||||
- the people here: http://code.google.com/p/vimwiki/people/list
|
- the people here: https://code.google.com/p/vimwiki/people/list
|
||||||
- Stuart Andrews (@tub78)
|
- Stuart Andrews (@tub78)
|
||||||
- Tomas Pospichal
|
- Tomas Pospichal
|
||||||
- Daniel Schemala (@EinfachToll) as current maintainer
|
- Daniel Schemala (@EinfachToll) as current maintainer
|
||||||
@@ -4001,7 +4009,7 @@ Contributors and their Github usernames in roughly chronological order:
|
|||||||
|
|
||||||
Issue numbers starting with '#' are issues from
|
Issue numbers starting with '#' are issues from
|
||||||
https://github.com/vimwiki/vimwiki/issues/, all others from
|
https://github.com/vimwiki/vimwiki/issues/, all others from
|
||||||
http://code.google.com/p/vimwiki/issues/list. They may be accessible from
|
https://code.google.com/p/vimwiki/issues/list. They may be accessible from
|
||||||
https://github.com/vimwiki-backup/vimwiki/issues.
|
https://github.com/vimwiki-backup/vimwiki/issues.
|
||||||
|
|
||||||
From version 2022.12.02, what would have been 2.6.0 under the prior versioning
|
From version 2022.12.02, what would have been 2.6.0 under the prior versioning
|
||||||
@@ -4011,7 +4019,30 @@ master is retained as a legacy mirror of the dev branch.
|
|||||||
|
|
||||||
This is somewhat experimental, and will probably be refined over time.
|
This is somewhat experimental, and will probably be refined over time.
|
||||||
|
|
||||||
|
2023.04.04~
|
||||||
|
|
||||||
New:~
|
New:~
|
||||||
|
* Issue #1261: Feature: Support for <mark> in Markdown
|
||||||
|
highlighting with yellow background and back foreground
|
||||||
|
* Issue #1274: Feature: Continue blockquote when <CR>
|
||||||
|
is pressed in insert mode
|
||||||
|
Also add the |blockquote_markers| variable
|
||||||
|
|
||||||
|
Fixed:~
|
||||||
|
* Issue #1267: Improve performance on link creation by speeding up
|
||||||
|
is_diary_file()
|
||||||
|
* Issue #1229: Bug: VimwikiGoto without argument creates empty page
|
||||||
|
* Issue #1316: Permit tags in heading
|
||||||
|
and improve |VimwikiSearchTags| and |VimwikiRebuildTags|
|
||||||
|
* Issue #1270: |VimwikiAddHeaderLevel| map (3=) was broken by a previous
|
||||||
|
refactoring commit
|
||||||
|
|
||||||
|
|
||||||
|
2023.03.15~
|
||||||
|
|
||||||
|
New:~
|
||||||
|
* Issue #150 Fix Math border cases
|
||||||
|
according to https://pandoc.org/MANUAL.html#math
|
||||||
* Issue #1287 Highlight YAML header with |yaml_metadata_block|
|
* Issue #1287 Highlight YAML header with |yaml_metadata_block|
|
||||||
configuration variable holding region delimiters
|
configuration variable holding region delimiters
|
||||||
|
|
||||||
@@ -4474,7 +4505,7 @@ Summary ~
|
|||||||
* Option to disable table mappings. See |g:vimwiki_table_mappings|.
|
* Option to disable table mappings. See |g:vimwiki_table_mappings|.
|
||||||
|
|
||||||
For detailed information see issues list on
|
For detailed information see issues list on
|
||||||
http://code.google.com/p/vimwiki/issues/list
|
https://code.google.com/p/vimwiki/issues/list
|
||||||
|
|
||||||
|
|
||||||
1.2~
|
1.2~
|
||||||
@@ -4553,7 +4584,7 @@ http://code.google.com/p/vimwiki/issues/list
|
|||||||
17. License *vimwiki-license*
|
17. License *vimwiki-license*
|
||||||
|
|
||||||
The MIT License
|
The MIT License
|
||||||
http://www.opensource.org/licenses/mit-license.php
|
https://www.opensource.org/licenses/mit-license.php
|
||||||
|
|
||||||
Copyright (c) 2008-2010 Maxim Kim
|
Copyright (c) 2008-2010 Maxim Kim
|
||||||
2013-2017 Daniel Schemala
|
2013-2017 Daniel Schemala
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ command! -buffer VimwikiDiaryPrevDay call vimwiki#diary#goto_prev_day()
|
|||||||
" tags commands
|
" tags commands
|
||||||
command! -buffer -bang VimwikiRebuildTags call vimwiki#tags#update_tags(1, '<bang>')
|
command! -buffer -bang VimwikiRebuildTags call vimwiki#tags#update_tags(1, '<bang>')
|
||||||
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
||||||
\ VimwikiSearchTags VimwikiSearch /:<args>:/
|
\ VimwikiSearchTags call vimwiki#tags#search_tags(<q-args>)
|
||||||
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
||||||
\ VimwikiGenerateTagLinks call vimwiki#tags#generate_tags(1, <f-args>)
|
\ VimwikiGenerateTagLinks call vimwiki#tags#generate_tags(1, <f-args>)
|
||||||
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
command! -buffer -nargs=* -complete=custom,vimwiki#tags#complete_tags
|
||||||
|
|||||||
+28
-18
@@ -150,6 +150,25 @@ let s:target = vimwiki#base#apply_template(
|
|||||||
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
call s:add_target_syntax_ON(s:target, 'VimwikiLink')
|
||||||
|
|
||||||
|
|
||||||
|
" List:
|
||||||
|
execute 'syntax match VimwikiList /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB').'/'
|
||||||
|
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
|
||||||
|
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_wikilocal('rxListItem').'/'
|
||||||
|
|
||||||
|
" Task List Done:
|
||||||
|
if vimwiki#vars#get_global('hl_cb_checked') == 1
|
||||||
|
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB')
|
||||||
|
\ . '\s*\[['.vimwiki#vars#get_wikilocal('listsyms_list')[-1]
|
||||||
|
\ . vimwiki#vars#get_global('listsym_rejected')
|
||||||
|
\ . ']\]\s\(.*\)$/ '
|
||||||
|
\ . 'contains=' . syntax_dic.nested . ',VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
||||||
|
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
|
||||||
|
execute 'syntax match VimwikiCheckBoxDone /'
|
||||||
|
\ . vimwiki#vars#get_wikilocal('rxListItemAndChildren')
|
||||||
|
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
" Header Level: 1..6
|
" Header Level: 1..6
|
||||||
for s:i in range(1,6)
|
for s:i in range(1,6)
|
||||||
" WebLink are for markdown but putting them here avoidcode duplication
|
" WebLink are for markdown but putting them here avoidcode duplication
|
||||||
@@ -236,24 +255,6 @@ syntax match VimwikiTableRow /^\s*|.\+|\s*$/
|
|||||||
|
|
||||||
syntax match VimwikiCellSeparator /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
syntax match VimwikiCellSeparator /\%(|\)\|\%(-\@<=+\-\@=\)\|\%([|+]\@<=-\+\)/ contained
|
||||||
|
|
||||||
" List:
|
|
||||||
execute 'syntax match VimwikiList /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB').'/'
|
|
||||||
execute 'syntax match VimwikiList /'.vimwiki#vars#get_syntaxlocal('rxListDefine').'/'
|
|
||||||
execute 'syntax match VimwikiListTodo /'.vimwiki#vars#get_wikilocal('rxListItem').'/'
|
|
||||||
|
|
||||||
" Task List Done:
|
|
||||||
if vimwiki#vars#get_global('hl_cb_checked') == 1
|
|
||||||
execute 'syntax match VimwikiCheckBoxDone /'.vimwiki#vars#get_wikilocal('rxListItemWithoutCB')
|
|
||||||
\ . '\s*\[['.vimwiki#vars#get_wikilocal('listsyms_list')[-1]
|
|
||||||
\ . vimwiki#vars#get_global('listsym_rejected')
|
|
||||||
\ . ']\]\s\(.*\)$/ '
|
|
||||||
\ . 'contains=' . syntax_dic.nested . ',VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
|
||||||
elseif vimwiki#vars#get_global('hl_cb_checked') == 2
|
|
||||||
execute 'syntax match VimwikiCheckBoxDone /'
|
|
||||||
\ . vimwiki#vars#get_wikilocal('rxListItemAndChildren')
|
|
||||||
\ .'/ contains=VimwikiNoExistsLink,VimwikiLink,VimwikiWeblink1,VimwikiWikiLink1,@Spell'
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
" Horizontal Rule: <hr>
|
" Horizontal Rule: <hr>
|
||||||
execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/'
|
execute 'syntax match VimwikiHR /'.vimwiki#vars#get_syntaxlocal('rxHR').'/'
|
||||||
@@ -327,6 +328,13 @@ for [color_key, color_value] in items(color_dic)
|
|||||||
execute cmd
|
execute cmd
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
" Html mark tag, feature request in issue #1261
|
||||||
|
let cmd = 'syntax region VimwikiMarkTag matchgroup=VimwikiDelimiterColor'
|
||||||
|
\ . ' start=/<mark>/'
|
||||||
|
\ . ' end=+</mark>+'
|
||||||
|
\ . ' ' . b:vimwiki_syntax_concealends
|
||||||
|
execute cmd
|
||||||
|
|
||||||
|
|
||||||
" Comment: home made
|
" Comment: home made
|
||||||
execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('comment_regex').
|
execute 'syntax match VimwikiComment /'.vimwiki#vars#get_syntaxlocal('comment_regex').
|
||||||
@@ -416,6 +424,8 @@ hi def link VimwikiUnderlineItalicBold VimwikiBoldItalicUnderline
|
|||||||
hi def link VimwikiCode PreProc
|
hi def link VimwikiCode PreProc
|
||||||
hi def link VimwikiCodeT VimwikiCode
|
hi def link VimwikiCodeT VimwikiCode
|
||||||
|
|
||||||
|
" Mark
|
||||||
|
hi def VimwikiMarkTag term=bold ctermbg=yellow ctermfg=black guibg=yellow guifg=black
|
||||||
hi def link VimwikiPre PreProc
|
hi def link VimwikiPre PreProc
|
||||||
hi def link VimwikiPreT VimwikiPre
|
hi def link VimwikiPreT VimwikiPre
|
||||||
hi def link VimwikiPreDelim VimwikiPre
|
hi def link VimwikiPreDelim VimwikiPre
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# Test vimwiki#base#is_diary_file() for various inputs.
|
||||||
|
|
||||||
|
Execute (Check known good diary file):
|
||||||
|
VimwikiIndex 1
|
||||||
|
let link_infos = vimwiki#base#resolve_link('diary:2020-07-22')
|
||||||
|
Assert vimwiki#base#is_diary_file(link_infos.filename)
|
||||||
|
|
||||||
|
Execute (Check known good diary file using is_diary_file, with list of all diary files - legacy interface):
|
||||||
|
VimwikiIndex 1
|
||||||
|
let link_infos = vimwiki#base#resolve_link('diary:2020-07-22')
|
||||||
|
let diary_file_paths = vimwiki#diary#get_diary_files()
|
||||||
|
Assert vimwiki#base#is_diary_file(link_infos.filename, diary_file_paths)
|
||||||
|
|
||||||
|
Execute (Check known good diary file use is_among_diary_files, with list of all diary files):
|
||||||
|
VimwikiIndex 1
|
||||||
|
let link_infos = vimwiki#base#resolve_link('diary:2020-07-22')
|
||||||
|
let diary_file_paths = vimwiki#diary#get_diary_files()
|
||||||
|
Assert vimwiki#base#is_among_diary_files(link_infos.filename, diary_file_paths)
|
||||||
|
|
||||||
|
Execute (Check for nonexistent diary file):
|
||||||
|
VimwikiIndex 1
|
||||||
|
Assert !vimwiki#base#is_diary_file('not-a-diary-file')
|
||||||
|
|
||||||
|
Execute (Clean):
|
||||||
|
call ReloadVimwiki()
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
# Issue: #1261: Feature: Support for <mark> in Markdown
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Single line mark):
|
||||||
|
<mark>Single line</mark>
|
||||||
|
01234567890
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Set syntax markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Assert all is yaml except after the closing ---):
|
||||||
|
AssertEqual 'VimwikiMarkTag1', GetSyntaxStack(1, 7)[0] . 1
|
||||||
|
AssertEqual '02', len(GetSyntaxStack(2, 7)) . 2
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Multiple line mark):
|
||||||
|
<mark>Start
|
||||||
|
Multiple
|
||||||
|
Line
|
||||||
|
end</mark>
|
||||||
|
01234567890
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Set syntax markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Assert all is yaml except after the closing ---):
|
||||||
|
AssertEqual 'VimwikiMarkTag1', GetSyntaxStack(1, 7)[0] . 1
|
||||||
|
AssertEqual 'VimwikiMarkTag2', GetSyntaxStack(2, 2)[0] . 2
|
||||||
|
AssertEqual 'VimwikiMarkTag3', GetSyntaxStack(3, 2)[0] . 3
|
||||||
|
AssertEqual 'VimwikiMarkTag4', GetSyntaxStack(4, 2)[0] . 4
|
||||||
|
AssertEqual '05', len(GetSyntaxStack(5, 7)) . 5
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
# Non regression tests for issue: #1270
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Dummy heading):
|
||||||
|
# Test
|
||||||
|
|
||||||
|
Execute (Set syntax markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (call add header 1):
|
||||||
|
call vimwiki#base#AddHeaderLevel(1)
|
||||||
|
|
||||||
|
Expect (Heading 2):
|
||||||
|
## Test
|
||||||
|
|
||||||
|
Execute (call add header 2):
|
||||||
|
call vimwiki#base#AddHeaderLevel(2)
|
||||||
|
|
||||||
|
Expect (Heading 3):
|
||||||
|
### Test
|
||||||
|
|
||||||
|
Execute (call add header 5):
|
||||||
|
call vimwiki#base#AddHeaderLevel(5)
|
||||||
|
|
||||||
|
Expect (Heading6):
|
||||||
|
###### Test
|
||||||
|
|
||||||
|
Do (5=):
|
||||||
|
5=
|
||||||
|
|
||||||
|
Expect (Heading6):
|
||||||
|
###### Test
|
||||||
|
|
||||||
|
Given vimwiki (Dummy heading 6):
|
||||||
|
###### Test
|
||||||
|
|
||||||
|
Do (5-):
|
||||||
|
5-
|
||||||
|
|
||||||
|
Expect (Heading decreased by 5):
|
||||||
|
# Test
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
# Issue: #1274
|
||||||
|
# Feature: Markdown -- Continue blockquote when <CR> is pressed in insert mode.
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Blockquote with test {{{1):
|
||||||
|
> Dummy text 1
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Set syntax markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
|
||||||
|
Do (Press insert, enter and type):
|
||||||
|
A
|
||||||
|
\<Cr>
|
||||||
|
Dummy text 2
|
||||||
|
|
||||||
|
|
||||||
|
Expect(Marker added 1):
|
||||||
|
> Dummy text 1
|
||||||
|
> Dummy text 2
|
||||||
|
|
||||||
|
|
||||||
|
Do (Press o and type):
|
||||||
|
o
|
||||||
|
Dummy text 2
|
||||||
|
|
||||||
|
|
||||||
|
Expect(Marker added 2):
|
||||||
|
> Dummy text 1
|
||||||
|
> Dummy text 2
|
||||||
|
|
||||||
|
|
||||||
|
Do (Press O and type):
|
||||||
|
O
|
||||||
|
Dummy text 2
|
||||||
|
|
||||||
|
|
||||||
|
Expect(Marker added 3, above):
|
||||||
|
> Dummy text 2
|
||||||
|
> Dummy text 1
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Blockquote without test {{{1):
|
||||||
|
>
|
||||||
|
|
||||||
|
|
||||||
|
Do (Press insert, enter and type):
|
||||||
|
A
|
||||||
|
\<Cr>
|
||||||
|
Dummy text 2
|
||||||
|
|
||||||
|
|
||||||
|
Expect(Marker removed):
|
||||||
|
Dummy text 2
|
||||||
|
|
||||||
|
|
||||||
|
Do (Press o):
|
||||||
|
o
|
||||||
|
Dummy text 2
|
||||||
|
|
||||||
|
|
||||||
|
Expect(Marker appended, below):
|
||||||
|
>
|
||||||
|
> Dummy text 2
|
||||||
|
|
||||||
|
|
||||||
|
Do (Press O):
|
||||||
|
O
|
||||||
|
Dummy text 2
|
||||||
|
|
||||||
|
|
||||||
|
Expect(Marker appended, above):
|
||||||
|
> Dummy text 2
|
||||||
|
>
|
||||||
@@ -5,13 +5,20 @@ Before(Define function for yaml inspection):
|
|||||||
function! Issue1287Yaml(line)
|
function! Issue1287Yaml(line)
|
||||||
" The line where the yaml delimiter is: 1 if at top
|
" The line where the yaml delimiter is: 1 if at top
|
||||||
let l = a:line
|
let l = a:line
|
||||||
|
|
||||||
|
Log "1: " . string(GetSyntaxStack(l + 0, 2))
|
||||||
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 0, 2)[0]
|
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 0, 2)[0]
|
||||||
|
Log '2: ' . string(GetSyntaxStack(l + 0, 2))
|
||||||
AssertEqual 'VimwikiPre', GetSyntaxStack(l + 0, 2)[1]
|
AssertEqual 'VimwikiPre', GetSyntaxStack(l + 0, 2)[1]
|
||||||
|
|
||||||
|
Log '3: ' . string(GetSyntaxStack(l + 1, 2))
|
||||||
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 1, 2)[0]
|
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 1, 2)[0]
|
||||||
|
Log '4: ' . string(GetSyntaxStack(l + 2, 2))
|
||||||
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 2, 2)[0]
|
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 2, 2)[0]
|
||||||
|
Log '5: ' . string(GetSyntaxStack(l + 2, 20))
|
||||||
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 2, 20)[0]
|
AssertEqual 'textSnipYAML', GetSyntaxStack(l + 2, 20)[0]
|
||||||
|
|
||||||
|
Log '6: ' . string(GetSyntaxStack(l + 3, 2))
|
||||||
AssertEqual 'VimwikiPre', GetSyntaxStack(l + 3, 2)[-1]
|
AssertEqual 'VimwikiPre', GetSyntaxStack(l + 3, 2)[-1]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
+208
-165
@@ -1,24 +1,18 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
# shellcheck disable=SC2155 # Declare and assign separately to avoid masking return values
|
||||||
|
|
||||||
# credit to https://github.com/w0rp/ale for script ideas and the color vader
|
: '
|
||||||
# output function.
|
Vimwiki vader test script
|
||||||
|
|
||||||
# Say Hi
|
Credit: https://github.com/w0rp/ale for script ideas and the color vader output function.
|
||||||
echo -en "Starting $(basename "$0") for VimWiki\n"
|
'
|
||||||
start_time=$(date +%s)
|
|
||||||
|
|
||||||
red='\033[0;31m'
|
# Capture start time now
|
||||||
green='\033[0;32m'
|
declare -g start_time=$(date +%s)
|
||||||
nc='\033[0m'
|
|
||||||
|
|
||||||
# For windows: Cmder bash is appending busybox to the path and
|
|
||||||
# and a smlll vim is included, so that override the windows path vim
|
|
||||||
if [[ -v OLD_PATH ]]; then
|
|
||||||
echo "Setting path from OLD_PATH : $OLD_PATH"
|
|
||||||
export PATH="$OLD_PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
printHelp() {
|
printHelp() {
|
||||||
|
: 'Print usage to stdout'
|
||||||
cat << ' EOF' | sed -e 's/^ //'
|
cat << ' EOF' | sed -e 's/^ //'
|
||||||
Usage: bash run_tests.sh [OPTIONS]
|
Usage: bash run_tests.sh [OPTIONS]
|
||||||
|
|
||||||
@@ -56,8 +50,144 @@ printHelp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
run_test(){
|
||||||
|
: 'Main function'
|
||||||
|
local -i res=0
|
||||||
|
|
||||||
|
# Hi
|
||||||
|
echo -en "Starting $(basename "$0") for VimWiki\n"
|
||||||
|
|
||||||
|
# Hook ctrl-c or ctrl-z to stop tests
|
||||||
|
trap exit 1 SIGINT SIGTERM
|
||||||
|
|
||||||
|
# For windows: Cmder bash is appending busybox to the path and
|
||||||
|
# and a smlll vim is included, so that override the windows path vim
|
||||||
|
if [[ -v OLD_PATH ]]; then
|
||||||
|
echo "Setting path from OLD_PATH : $OLD_PATH"
|
||||||
|
export PATH="$OLD_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# WORK
|
||||||
|
parse_argument "$@"; ((res |= $?))
|
||||||
|
execute_test_argument; ((res |= $?))
|
||||||
|
|
||||||
|
# Print ellapsed time (after calculate it)
|
||||||
|
end_time=$(date +%s)
|
||||||
|
sec_time=$((end_time - start_time))
|
||||||
|
printf -v script_time '%dh:%dm:%ds' $((sec_time/3600)) $((sec_time%3600/60)) $((sec_time%60))
|
||||||
|
echo -ne "Script $(basename "$0"), in $script_time, Returned -> $res\n\n"
|
||||||
|
|
||||||
|
return "$res"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
parse_argument(){
|
||||||
|
: 'Parse user argument'
|
||||||
|
# Declare color helper
|
||||||
|
declare -g red='\033[0;31m'
|
||||||
|
declare -g green='\033[0;32m'
|
||||||
|
declare -g nc='\033[0m'
|
||||||
|
|
||||||
|
# Declare: Path of the script, supposing no spaces
|
||||||
|
declare -g g_script_file=$(dirname "$0")
|
||||||
|
declare -g g_script_path=$(realpath "$g_script_file")
|
||||||
|
declare -g g_wiki_path=$(realpath "$g_script_path/..")
|
||||||
|
declare -g g_tmp_dir=$(dirname "$(mktemp -u)")
|
||||||
|
|
||||||
|
# Declare: list of vim/nvim versions
|
||||||
|
declare -g g_vers="$(print_versions)"
|
||||||
|
|
||||||
|
# Declare: type of tests to run - vader/vint/all
|
||||||
|
declare -g g_type="all"
|
||||||
|
|
||||||
|
# Declare: verbose output flag
|
||||||
|
declare -g g_verbose=0
|
||||||
|
|
||||||
|
# Declare: only run these tests
|
||||||
|
declare -g g_file_test=""
|
||||||
|
|
||||||
|
# Declare: docker flags
|
||||||
|
declare -g flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
|
||||||
|
|
||||||
|
# Parse all argument options
|
||||||
|
while getopts ":hvn:lt:f:" opt; do
|
||||||
|
case ${opt} in
|
||||||
|
h)
|
||||||
|
printHelp
|
||||||
|
;;
|
||||||
|
n)
|
||||||
|
g_vers="$OPTARG"
|
||||||
|
;;
|
||||||
|
v)
|
||||||
|
g_verbose=1
|
||||||
|
;;
|
||||||
|
l)
|
||||||
|
print_versions
|
||||||
|
;;
|
||||||
|
t)
|
||||||
|
g_type="$OPTARG"
|
||||||
|
;;
|
||||||
|
f)
|
||||||
|
g_file_test="$OPTARG"
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: $OPTARG" 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
:)
|
||||||
|
echo "Invalid option: $OPTARG requires an argument" 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Shift out parameters already processed
|
||||||
|
shift $((OPTIND -1))
|
||||||
|
|
||||||
|
# Handle error for non-option arguments
|
||||||
|
if [[ $# -ne 0 ]]; then
|
||||||
|
echo "Error: Got $# non-option arguments." 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
execute_test_argument(){
|
||||||
|
: 'Execute test according to global variable'
|
||||||
|
# Global error return of the script
|
||||||
|
local -i res=0 ret=0
|
||||||
|
|
||||||
|
# Select and run tests
|
||||||
|
case $g_type in
|
||||||
|
vader)
|
||||||
|
run_vader; ret=$?
|
||||||
|
echo "Main Vader: returned $ret"
|
||||||
|
((res |= ret))
|
||||||
|
;;
|
||||||
|
vint)
|
||||||
|
run_vint; ret=$?
|
||||||
|
echo "Main Vint: returned $ret"
|
||||||
|
((res |= ret))
|
||||||
|
;;
|
||||||
|
all)
|
||||||
|
run_vint; ret=$?
|
||||||
|
echo "Main Vint: returned $ret"
|
||||||
|
((res |= ret))
|
||||||
|
run_vader; ret=$?
|
||||||
|
echo "Main Vader: returned $ret"
|
||||||
|
((res |= ret))
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Error: invalid type - '$g_type'" 1>&2
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
return "$res"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print_versions() {
|
print_versions() {
|
||||||
# Print the names of all vim/nvim versions
|
: 'Print the names of all vim/nvim versions'
|
||||||
# Get all possible version <- Dockerfile
|
# Get all possible version <- Dockerfile
|
||||||
sed -n 's/.* -name \([^ ]*\) .*/\1/p' ../Dockerfile
|
sed -n 's/.* -name \([^ ]*\) .*/\1/p' ../Dockerfile
|
||||||
exit 0
|
exit 0
|
||||||
@@ -65,33 +195,36 @@ print_versions() {
|
|||||||
|
|
||||||
|
|
||||||
run_vader() {
|
run_vader() {
|
||||||
# Run Vader tests
|
: 'Run Vader tests'
|
||||||
echo -e "\nStarting Vader tests."
|
echo -e "\nStarting Vader tests."
|
||||||
local err=0
|
local -i res=0
|
||||||
|
local opt='' current_test=''
|
||||||
|
|
||||||
|
echo "Tin 1 $g_file_test"
|
||||||
# Parse tests files to execute
|
# Parse tests files to execute
|
||||||
if [[ -z $file_test ]]; then
|
if [[ -z "$g_file_test" ]]; then
|
||||||
res="test/*"
|
opt="test/*"
|
||||||
else
|
else
|
||||||
read -ra TEST <<< "$file_test"
|
read -ra TEST <<< "$g_file_test"
|
||||||
for i in "${TEST[@]}"; do
|
for current_test in "${TEST[@]}"; do
|
||||||
# Remove quotes
|
# Remove quotes
|
||||||
i=${i#\'}
|
current_test=${current_test#\'}
|
||||||
i=${i%\'}
|
current_test=${current_test%\'}
|
||||||
if [[ "$i" == *"*"* ]]; then
|
if [[ "$current_test" == *"*"* ]]; then
|
||||||
res="$res test/${i}"
|
opt+=" test/${current_test}"
|
||||||
elif [[ -f "$i" ]]; then
|
elif [[ -f "$current_test" ]]; then
|
||||||
res="$res test/${i}"
|
opt+=" test/${current_test}"
|
||||||
elif [[ -f "${i}.vader" ]]; then
|
elif [[ -f "${current_test}.vader" ]]; then
|
||||||
res="$res test/${i}.vader"
|
opt+=" test/${current_test}.vader"
|
||||||
else
|
else
|
||||||
printf "WARNING: Test \"%s\" not found.\n", "$i"
|
printf "WARNING: Test \"%s\" not found.\n", "$current_test"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
echo "Tin 2 $opt"
|
||||||
|
|
||||||
# Run tests for each specified version
|
# Run tests for each specified version
|
||||||
for v in $vers; do
|
for v in $g_vers; do
|
||||||
echo -e "\n\nRunning version: $v"
|
echo -e "\n\nRunning version: $v"
|
||||||
echo -e "============================="
|
echo -e "============================="
|
||||||
|
|
||||||
@@ -101,14 +234,14 @@ run_vader() {
|
|||||||
home_save="$HOME"
|
home_save="$HOME"
|
||||||
|
|
||||||
# Create temporary root
|
# Create temporary root
|
||||||
mkdir -p "$tmp_dir/vader_wiki"
|
mkdir -p "$g_tmp_dir/vader_wiki"
|
||||||
mkdir -p "$tmp_dir/vader_wiki/home"
|
mkdir -p "$g_tmp_dir/vader_wiki/home"
|
||||||
mkdir -p "$tmp_dir/vader_wiki/home/test"
|
mkdir -p "$g_tmp_dir/vader_wiki/home/test"
|
||||||
mkdir -p "$tmp_dir/vader_wiki/testplugin"
|
mkdir -p "$g_tmp_dir/vader_wiki/testplugin"
|
||||||
|
|
||||||
# Set vars
|
# Set vars
|
||||||
export ROOT="$tmp_dir/vader_wiki/"
|
export ROOT="$g_tmp_dir/vader_wiki/"
|
||||||
export HOME="$tmp_dir/vader_wiki/home"
|
export HOME="$g_tmp_dir/vader_wiki/home"
|
||||||
vim="vim"
|
vim="vim"
|
||||||
vim_opt="-u ~/test/vimrc"
|
vim_opt="-u ~/test/vimrc"
|
||||||
else
|
else
|
||||||
@@ -134,11 +267,11 @@ run_vader() {
|
|||||||
# flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
|
# flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
|
||||||
echo -e "\nCopying resources to $ROOT"
|
echo -e "\nCopying resources to $ROOT"
|
||||||
# Copy testplugin
|
# Copy testplugin
|
||||||
cp -rf "$wiki_path/"* "$ROOT/testplugin/"
|
cp -rf "$g_wiki_path/"* "$ROOT/testplugin/"
|
||||||
# Copy home
|
# Copy home
|
||||||
cp -rf "$script_path/"* "$HOME/test/"
|
cp -rf "$g_script_path/"* "$HOME/test/"
|
||||||
# Copy rtp.vim
|
# Copy rtp.vim
|
||||||
cp -rf "$script_path/resources/rtp_local.vim" "$ROOT/rtp.vim"
|
cp -rf "$g_script_path/resources/rtp_local.vim" "$ROOT/rtp.vim"
|
||||||
# Copy vader <- internet
|
# Copy vader <- internet
|
||||||
echo 'Cloning Vader (git, do not care the fatal)'
|
echo 'Cloning Vader (git, do not care the fatal)'
|
||||||
git clone --depth 10 https://github.com/junegunn/vader.vim /tmp/vader_wiki/vader 2>&1
|
git clone --depth 10 https://github.com/junegunn/vader.vim /tmp/vader_wiki/vader 2>&1
|
||||||
@@ -146,77 +279,81 @@ run_vader() {
|
|||||||
|
|
||||||
# Run batch of tests
|
# Run batch of tests
|
||||||
# shellcheck disable=SC2086,SC2206
|
# shellcheck disable=SC2086,SC2206
|
||||||
if [[ "$res" != "" ]]; then
|
if [[ "$opt" != "" ]]; then
|
||||||
if [[ "$v" == "local" ]]; then
|
if [[ "$v" == "local" ]]; then
|
||||||
pushd "$tmp_dir/vader_wiki/testplugin" \
|
pushd "$g_tmp_dir/vader_wiki/testplugin" \
|
||||||
|| echo 'Warning pushd testplugin failed'
|
|| echo 'Warning pushd testplugin failed'
|
||||||
|
|
||||||
# Run the tests
|
# Run the tests
|
||||||
fcmd(){
|
fcmd(){
|
||||||
$vim $vim_opt "+Vader! ${res}" 2>&1 \
|
$vim $vim_opt "+Vader! ${opt}" 2>&1 \
|
||||||
| vader_filter | vader_color
|
| vader_filter | vader_color
|
||||||
return ${PIPESTATUS[1]}
|
return ${PIPESTATUS[1]}
|
||||||
}
|
}
|
||||||
echo -e "\nStarting Batch Vim/Vader:\n<- $res\n"
|
echo -e "\nStarting Batch Vim/Vader:\n<- $opt\n"
|
||||||
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
|
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
|
||||||
fcmd; ret=$?
|
fcmd; ret=$?
|
||||||
err=$(( err + ret ))
|
|
||||||
echo -e "\nReturned Batch Vim/Vader -> $ret"
|
echo -e "\nReturned Batch Vim/Vader -> $ret"
|
||||||
|
(( res |= ret ))
|
||||||
|
|
||||||
popd \
|
popd || echo 'Warning popd failed'
|
||||||
|| echo 'Warning popd also failed'
|
|
||||||
else
|
else
|
||||||
# In docker
|
# In docker
|
||||||
fcmd() {
|
fcmd() {
|
||||||
docker run -a stderr -e "VADER_OUTPUT_FILE=/dev/stderr" \
|
docker run -a stderr -e "VADER_OUTPUT_FILE=/dev/stderr" \
|
||||||
"${flags[@]}" "$v" $vim_opt "+Vader! ${res}" 2>&1 \
|
"${flags[@]}" "$v" $vim_opt "+Vader! ${opt}" 2>&1 \
|
||||||
| vader_filter | vader_color
|
| vader_filter | vader_color
|
||||||
return ${PIPESTATUS[1]}
|
return ${PIPESTATUS[1]}
|
||||||
}
|
}
|
||||||
echo -e "\nStarting Batch Vim/Vader:\n<- $res\n"
|
echo -e "\nStarting Batch Vim/Vader with: $opt\n"
|
||||||
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
|
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
|
||||||
fcmd; ret=$?
|
fcmd; ret=$?
|
||||||
err=$(( err + ret ))
|
|
||||||
echo -e "\nReturned Batch Docker/Vim/Vader -> $ret : ${PIPESTATUS[*]}"
|
echo -e "\nReturned Batch Docker/Vim/Vader -> $ret : ${PIPESTATUS[*]}"
|
||||||
|
(( res |= ret ))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#set +o pipefail
|
#set +o pipefail
|
||||||
|
|
||||||
# Restore what must (I know it should be refactored in a while)
|
# Restore what must (I know it should be refactored in a while)
|
||||||
if [[ "$v" == "local" ]]; then
|
if [[ "$v" == local ]]; then
|
||||||
export HOME=$home_save
|
export HOME=$home_save
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
return $err
|
return "$res"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
run_vint() {
|
run_vint() {
|
||||||
local err=0
|
: 'Run Vint test'
|
||||||
cmd="vint -s . && vint -s test/vimrc"
|
local -i res=0
|
||||||
if echo "$vers" | grep "local" > /dev/null; then
|
|
||||||
echo -e "\nRunning Vint: $cmd : in $wiki_path"
|
local cmd="vint -s . && vint -s test/vimrc"
|
||||||
pushd "$wiki_path" > /dev/null \
|
|
||||||
|
if echo "$g_vers" | grep "local" > /dev/null; then
|
||||||
|
echo -e "\nRunning Vint: $cmd : in $g_wiki_path"
|
||||||
|
pushd "$g_wiki_path" > /dev/null \
|
||||||
|| echo 'Warning pushd wiki_path failed'
|
|| echo 'Warning pushd wiki_path failed'
|
||||||
$cmd
|
$cmd
|
||||||
err=$(( err | $? ))
|
res=$(( res | $? ))
|
||||||
popd > /dev/null \
|
popd > /dev/null \
|
||||||
|| echo 'Warning popd also failed'
|
|| echo 'Warning popd also failed'
|
||||||
else
|
else
|
||||||
echo -e "\nStarting Docker container and running Vint: $cmd"
|
echo -e "\nStarting Docker container and running Vint: $cmd"
|
||||||
docker run -a stdout "${flags[@]}" bash -c "$cmd"
|
docker run -a stdout "${flags[@]}" bash -c "$cmd"
|
||||||
err=$(( err | $? ))
|
res=$(( res | $? ))
|
||||||
fi
|
fi
|
||||||
return $err
|
|
||||||
|
return "$res"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vader_filter() {
|
vader_filter() {
|
||||||
# Filter Vader Stdout
|
: 'Pipe Helper: Filter Vader Stdout'
|
||||||
local err=0
|
local -i res=0
|
||||||
# Keep indentation
|
# Keep indentation
|
||||||
local IFS=''
|
local IFS=''
|
||||||
|
|
||||||
while read -r REPLY; do
|
while read -r REPLY; do
|
||||||
# Print only possible error cases
|
# Print only possible error cases
|
||||||
if [[ "$REPLY" = *'docker:'* ]] || \
|
if [[ "$REPLY" = *'docker:'* ]] || \
|
||||||
@@ -228,31 +365,33 @@ vader_filter() {
|
|||||||
[[ "$REPLY" = *'[ DO] (X)'* ]] || \
|
[[ "$REPLY" = *'[ DO] (X)'* ]] || \
|
||||||
[[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then
|
[[ "$REPLY" = *'[ EXPECT] (X)'* ]]; then
|
||||||
echo -e "$red$REPLY$nc"
|
echo -e "$red$REPLY$nc"
|
||||||
err=1
|
res=1
|
||||||
elif [[ "$REPLY" = *'Success/Total:'* ]]; then
|
elif [[ "$REPLY" = *'Success/Total:'* ]]; then
|
||||||
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
|
success="$(echo -n "$REPLY" | grep -o '[0-9]\+/' | head -n1 | cut -d/ -f1)"
|
||||||
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
|
total="$(echo -n "$REPLY" | grep -o '/[0-9]\+' | head -n1 | cut -d/ -f2)"
|
||||||
if [ "$success" -lt "$total" ]; then
|
if [ "$success" -lt "$total" ]; then
|
||||||
err=1
|
res=1
|
||||||
fi
|
fi
|
||||||
echo "$REPLY"
|
echo "$REPLY"
|
||||||
elif [[ "$verbose" != 0 ]]; then
|
elif [[ "$g_verbose" != 0 ]]; then
|
||||||
# just print everything
|
# just print everything
|
||||||
echo "$REPLY"
|
echo "$REPLY"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "$err" == 1 ]]; then
|
if (( res == 1 )); then
|
||||||
echo -e "\033[0;31m"
|
echo -e "\033[0;31m"
|
||||||
echo -e "!---------Failed tests detected---------!"
|
echo -e "!---------Failed tests detected---------!"
|
||||||
echo -e "Run with the '-v' flag for verbose output"
|
echo -e "Run with the '-v' flag for verbose output"
|
||||||
echo -e "\033[0m"
|
echo -e "\033[0m"
|
||||||
fi
|
fi
|
||||||
return $err
|
|
||||||
|
return "$res"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vader_color() {
|
vader_color() {
|
||||||
|
: 'Pipe Helper: Filter to add color to Vader'
|
||||||
while read -r; do
|
while read -r; do
|
||||||
if [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
|
if [[ "$REPLY" = *'[EXECUTE] (X)'* ]] || \
|
||||||
[[ "$REPLY" = *'[ EXPECT] (X)'* ]] || \
|
[[ "$REPLY" = *'[ EXPECT] (X)'* ]] || \
|
||||||
@@ -283,103 +422,7 @@ vader_color() {
|
|||||||
echo -en "$nc"
|
echo -en "$nc"
|
||||||
}
|
}
|
||||||
|
|
||||||
# path of the script, supposing no spaces
|
|
||||||
script_file="$(dirname "$0")"
|
|
||||||
script_path="$( realpath "$script_file" )"
|
|
||||||
wiki_path="$( realpath "$script_path/.." )"
|
|
||||||
tmp_dir="$(dirname "$(mktemp -u)")"
|
|
||||||
|
|
||||||
# list of vim/nvim versions
|
if ! (return 0 2>/dev/null); then
|
||||||
vers="$(print_versions)"
|
run_test "$@"; exit $?
|
||||||
|
|
||||||
# type of tests to run - vader/vint/all
|
|
||||||
type="all"
|
|
||||||
|
|
||||||
# verbose output flag
|
|
||||||
verbose=0
|
|
||||||
|
|
||||||
# only run these tests
|
|
||||||
file_test=""
|
|
||||||
|
|
||||||
# docker flags
|
|
||||||
flags=(--rm -v "$PWD/../:/testplugin" -v "$PWD/../test:/home" -w /testplugin vimwiki)
|
|
||||||
|
|
||||||
while getopts ":hvn:lt:f:" opt; do
|
|
||||||
case ${opt} in
|
|
||||||
h)
|
|
||||||
printHelp
|
|
||||||
;;
|
|
||||||
n)
|
|
||||||
vers="$OPTARG"
|
|
||||||
;;
|
|
||||||
v)
|
|
||||||
verbose=1
|
|
||||||
;;
|
|
||||||
l)
|
|
||||||
print_versions
|
|
||||||
;;
|
|
||||||
t)
|
|
||||||
type="$OPTARG"
|
|
||||||
;;
|
|
||||||
f)
|
|
||||||
file_test="$OPTARG"
|
|
||||||
;;
|
|
||||||
\?)
|
|
||||||
echo "Invalid option: $OPTARG" 1>&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
:)
|
|
||||||
echo "Invalid option: $OPTARG requires an argument" 1>&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# shift out processed parameters
|
|
||||||
shift $((OPTIND -1))
|
|
||||||
|
|
||||||
# error handling for non-option arguments
|
|
||||||
if [[ $# -ne 0 ]]; then
|
|
||||||
echo "Error: Got $# non-option arguments." 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# stop tests on ctrl-c or ctrl-z
|
|
||||||
trap exit 1 SIGINT SIGTERM
|
|
||||||
|
|
||||||
# Global error return of the script
|
|
||||||
o_error=0
|
|
||||||
|
|
||||||
# Select which tests should run
|
|
||||||
case $type in
|
|
||||||
vader)
|
|
||||||
run_vader ; err=$?
|
|
||||||
echo "Main Vader: returned $err"
|
|
||||||
o_error=$(( err | o_error ))
|
|
||||||
;;
|
|
||||||
vint)
|
|
||||||
run_vint ; err=$?
|
|
||||||
echo "Main Vint: returned $err"
|
|
||||||
o_error=$(( err | o_error ))
|
|
||||||
;;
|
|
||||||
all)
|
|
||||||
run_vint ; err=$?
|
|
||||||
echo "Main Vint: returned $err"
|
|
||||||
o_error=$(( err | o_error ))
|
|
||||||
run_vader ; err=$?
|
|
||||||
echo "Main Vader: returned $err"
|
|
||||||
o_error=$(( err | o_error ))
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Error: invalid type - '$type'" 1>&2
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Calcultate time
|
|
||||||
end_time=$(date +%s)
|
|
||||||
sec_time=$((end_time - start_time))
|
|
||||||
printf -v script_time '%dh:%dm:%ds' $((sec_time/3600)) $((sec_time%3600/60)) $((sec_time%60))
|
|
||||||
|
|
||||||
# Exit
|
|
||||||
echo -ne "Script $(basename "$0"), in $script_time, Returned -> $o_error\n\n"
|
|
||||||
exit $o_error
|
|
||||||
|
|||||||
+6
-1
@@ -7,10 +7,16 @@ Execute (Setup search testing wrapper):
|
|||||||
Log 'Cheating for old vim version, do not want to reverse bug'
|
Log 'Cheating for old vim version, do not want to reverse bug'
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Execute command and grab output
|
||||||
redir => output
|
redir => output
|
||||||
silent execute a:search_command
|
silent execute a:search_command
|
||||||
redir END
|
redir END
|
||||||
|
|
||||||
|
" The location list should not be empty
|
||||||
Assert !empty(getloclist(0)), a:test_name.": no location list result"
|
Assert !empty(getloclist(0)), a:test_name.": no location list result"
|
||||||
|
|
||||||
|
" The location list should contains entries
|
||||||
Assert match(output, '\d of \d') > -1, a:test_name.": no result message"
|
Assert match(output, '\d of \d') > -1, a:test_name.": no result message"
|
||||||
|
|
||||||
" Tests that VimwikiSearch is quoting the pattern correctly.
|
" Tests that VimwikiSearch is quoting the pattern correctly.
|
||||||
@@ -30,7 +36,6 @@ Execute (Search test wiki):
|
|||||||
AssertEqual "= Test Wiki =", getline(1)
|
AssertEqual "= Test Wiki =", getline(1)
|
||||||
AssertEqual "vimwiki", &filetype
|
AssertEqual "vimwiki", &filetype
|
||||||
|
|
||||||
|
|
||||||
call TestSearch('VimwikiSearch foo', 'pattern with no spaces')
|
call TestSearch('VimwikiSearch foo', 'pattern with no spaces')
|
||||||
call TestSearch('VimwikiSearch foo bar', 'pattern with spaces')
|
call TestSearch('VimwikiSearch foo bar', 'pattern with spaces')
|
||||||
call TestSearch('VimwikiSearch foo\bar', 'pattern with ''\''')
|
call TestSearch('VimwikiSearch foo\bar', 'pattern with ''\''')
|
||||||
|
|||||||
+24
-1
@@ -4,6 +4,27 @@
|
|||||||
# 0 Escape {{{1
|
# 0 Escape {{{1
|
||||||
#################
|
#################
|
||||||
|
|
||||||
|
Given vimwiki (Most easy typeface):
|
||||||
|
1. 567890123
|
||||||
|
2. __bold__
|
||||||
|
3. *Italic*
|
||||||
|
4. ***Bold Italic***
|
||||||
|
5. ~~Strikethrough~~
|
||||||
|
6. <sub>Subscript</sub>
|
||||||
|
7. <sup>Superscript</sup>
|
||||||
|
|
||||||
|
Execute (Set syntax markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax basic typeface):
|
||||||
|
AssertEqual '1' , SyntaxAt(1, 9) . 1
|
||||||
|
AssertEqual 'VimwikiBold2' , SyntaxAt(2, 9) . 2
|
||||||
|
AssertEqual 'VimwikiItalic3' , SyntaxAt(3, 9) . 3
|
||||||
|
AssertEqual 'VimwikiBoldItalic4' , SyntaxAt(4, 9) . 4
|
||||||
|
AssertEqual 'VimwikiDelText5' , SyntaxAt(5, 9) . 5
|
||||||
|
AssertEqual 'VimwikiSubScript6' , SyntaxAt(6, 9) . 6
|
||||||
|
AssertEqual 'VimwikiSuperScript7', SyntaxAt(7, 9) . 7
|
||||||
|
|
||||||
Given vimwiki (Markdown typeface with escape sequence #1044: _ __ * ** {{{2):
|
Given vimwiki (Markdown typeface with escape sequence #1044: _ __ * ** {{{2):
|
||||||
This is 14 | 1
|
This is 14 | 1
|
||||||
__bold from begining__ 2
|
__bold from begining__ 2
|
||||||
@@ -16,6 +37,7 @@ Given vimwiki (Markdown typeface with escape sequence #1044: _ __ * ** {{{2):
|
|||||||
a ~~staaill deleted~~ Del 9
|
a ~~staaill deleted~~ Del 9
|
||||||
$$Eq\$$ uation follows$ Math 10
|
$$Eq\$$ uation follows$ Math 10
|
||||||
`code \` not finished inline` Code 11
|
`code \` not finished inline` Code 11
|
||||||
|
012345678901234567890
|
||||||
|
|
||||||
Execute (Set syntax markdown):
|
Execute (Set syntax markdown):
|
||||||
call SetSyntax('markdown')
|
call SetSyntax('markdown')
|
||||||
@@ -27,7 +49,8 @@ Execute (Assert Syntax of escape typeface):
|
|||||||
AssertEqual 'VimwikiBold4' , SyntaxAt(4, 14) . 4
|
AssertEqual 'VimwikiBold4' , SyntaxAt(4, 14) . 4
|
||||||
AssertEqual 'VimwikiItalic5' , SyntaxAt(5, 14) . 5
|
AssertEqual 'VimwikiItalic5' , SyntaxAt(5, 14) . 5
|
||||||
" See: #1303 where an escape start can close the region
|
" See: #1303 where an escape start can close the region
|
||||||
AssertEqual '6' , SyntaxAt(6, 14) . 6
|
" Fixed removing vars.vim::expand_delimiter
|
||||||
|
AssertEqual 'VimwikiItalic6' , SyntaxAt(6, 14) . 6
|
||||||
AssertEqual 'VimwikiSuperScript7', SyntaxAt(7, 14) . 7
|
AssertEqual 'VimwikiSuperScript7', SyntaxAt(7, 14) . 7
|
||||||
AssertEqual 'VimwikiSubScript8' , SyntaxAt(8, 14) . 8
|
AssertEqual 'VimwikiSubScript8' , SyntaxAt(8, 14) . 8
|
||||||
AssertEqual 'VimwikiDelText9' , SyntaxAt(9, 14) . 9
|
AssertEqual 'VimwikiDelText9' , SyntaxAt(9, 14) . 9
|
||||||
|
|||||||
@@ -166,6 +166,718 @@ Execute (Assert Syntax):
|
|||||||
|
|
||||||
|
|
||||||
# Rule 3 {{{1
|
# Rule 3 {{{1
|
||||||
# TODO Test 3
|
# A single * character can close emphasis iff it is part of a right-flanking delimiter run.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-374):
|
||||||
|
_foo*
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not emphasis, in theory (1), IDEA change that'
|
||||||
|
Log 'But Vim reion implementation is highlitghing it anyway, it would be nice to change that'
|
||||||
|
Log 'Note: The decision to start a region is only based on a matching start pattern. There is no check for a matching end pattern.'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-375):
|
||||||
|
*foo bar *
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not emphasis, in theory (2), IDEA change that'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-376):
|
||||||
|
*foo bar
|
||||||
|
*
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not emphasis, in theory (2), IDEA change that'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-377):
|
||||||
|
*(*foo)
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not emphasis, because the second * is preceded by punctuation and followed by an alphanumeric (hence it is not part of a right-flanking delimiter, in theory, IDEA Change that'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 2)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-378):
|
||||||
|
*(*foo*)*
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'The point of this restriction is more easily appreciated with this example, IDEA Change that'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 2)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-379):
|
||||||
|
*foo*bar
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Intraword emphasis with * is allowed'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 4 {{{1
|
||||||
|
# A single _ character can close emphasis iff it is part of a right-flanking delimiter run and either (a) not part of a left-flanking delimiter run or (b) part of a left-flanking delimiter run followed by punctuation.
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 5 {{{1
|
||||||
|
# A double ** can open strong emphasis iff it is part of a left-flanking delimiter run.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-387):
|
||||||
|
**foo bar**
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Easy bold'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 3)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-388):
|
||||||
|
** foo bar**
|
||||||
|
12345
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not strong emphasis, because the opening delimiter is followed by whitespace'
|
||||||
|
AssertEqual '', SyntaxAt(1, 5)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-389):
|
||||||
|
a**"foo"**
|
||||||
|
123456
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not strong emphasis, because the opening ** is preceded by an alphanumeric and followed by punctuation, and hence not part of a left-flanking delimiter'
|
||||||
|
AssertEqual '', SyntaxAt(1, 5)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-390):
|
||||||
|
foo**bar**
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Intraword strong emphasis with ** is permitted'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 7)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 6 {{{1
|
||||||
|
# A double __ can open strong emphasis iff it is part of a left-flanking delimiter run and either (a) not part of a right-flanking delimiter run or (b) part of a right-flanking delimiter run preceded by punctuation.
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-391):
|
||||||
|
__foo bar__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Bold with __'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-392):
|
||||||
|
__ foo bar__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not strong emphasis, because the opening delimiter is followed by whitespace'
|
||||||
|
AssertEqual '', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-393):
|
||||||
|
__
|
||||||
|
foo bar__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'A newline counts as whitespace'
|
||||||
|
AssertEqual '', SyntaxAt(2, 4)
|
||||||
|
AssertEqual '', SyntaxAt(3, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-394):
|
||||||
|
a__"foo"__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is not strong emphasis, because the opening __ is preceded by an alphanumeric and followed by punctuation'
|
||||||
|
AssertEqual '', SyntaxAt(1, 6)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-395):
|
||||||
|
foo__bar__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Intraword strong emphasis is forbidden with __'
|
||||||
|
AssertEqual '', SyntaxAt(1, 7)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-395):
|
||||||
|
5__6__78
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Intraword strong emphasis is forbidden with __ (2)'
|
||||||
|
AssertEqual '', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-397):
|
||||||
|
пристаням__стремятся__
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Intraword strong emphasis is forbidden with __ (3)'
|
||||||
|
AssertEqual '', SyntaxAt(1, 13)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-398):
|
||||||
|
__foo, __bar__, baz__
|
||||||
|
1234567890
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-399):
|
||||||
|
foo-__(bar)__
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'This is strong emphasis, even though the opening delimiter is both left- and right-flanking, because it is preceded by punctuation'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 9)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 7 {{{1
|
||||||
|
# A double ** can close strong emphasis iff it is part of a right-flanking delimiter run.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-400):
|
||||||
|
**foo bar **
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Rule 7: Passed: IDEA improve that'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 8 {{{1
|
||||||
|
# A double __ can close strong emphasis iff it is part of a right-flanking delimiter run and either (a) not part of a left-flanking delimiter run or (b) part of a left-flanking delimiter run followed by punctuation.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-406):
|
||||||
|
__foo bar __
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Rule 8: Passed: IDEA improve that'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 9 {{{1
|
||||||
|
# Emphasis begins with a delimiter that can open emphasis and ends with a delimiter that can close emphasis, and that uses the same character (_ or *) as the opening delimiter. The opening and closing delimiters must belong to separate delimiter runs. If one of the delimiters can both open and close emphasis, then the sum of the lengths of the delimiter runs containing the opening and closing delimiters must not be a multiple of 3 unless both lengths are multiples of 3.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-413):
|
||||||
|
*foo [bar](/url)*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Any nonempty sequence of inline elements can be the contents of an emphasized span'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 9)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-414):
|
||||||
|
*foo
|
||||||
|
bar*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Any nonempty sequence of inline elements can be the contents of an emphasized span (2)'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(2, 3)
|
||||||
|
AssertEqual '', SyntaxAt(3, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-415):
|
||||||
|
_foo __bar__ baz_
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'In particular, emphasis and strong emphasis can be nested inside emphasis'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 3)
|
||||||
|
AssertEqual 'VimwikiItalicBold', SyntaxAt(1, 9)
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 14)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-416):
|
||||||
|
_foo _bar_ baz_
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO not implemented nested Italic, as the close of one region closes the other'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-425):
|
||||||
|
foo***bar***baz
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Italic Bold'
|
||||||
|
AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 8)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 10 {{{1
|
||||||
|
# Strong emphasis begins with a delimiter that can open strong emphasis and ends with a delimiter that can close strong emphasis, and that uses the same character (_ or *) as the opening delimiter. The opening and closing delimiters must belong to separate delimiter runs. If one of the delimiters can both open and close strong emphasis, then the sum of the lengths of the delimiter runs containing the opening and closing delimiters must not be a multiple of 3 unless both lengths are multiples of 3.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-431):
|
||||||
|
**foo [bar](/url)**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Any nonempty sequence of inline elements can be the contents of an strongly emphasized span'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 8)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-432):
|
||||||
|
**foo
|
||||||
|
bar**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 3)
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(2, 3)
|
||||||
|
AssertEqual '', SyntaxAt(3, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-433):
|
||||||
|
__foo _bar_ baz__
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'In particular, emphasis and strong emphasis can be nested inside strong emphasis'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 9)
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 14)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-434):
|
||||||
|
__foo __bar__ baz__
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO passed as nested bold is hard'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-437):
|
||||||
|
**foo *bar* baz**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Same as 433 but with *'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 9)
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 14)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-443):
|
||||||
|
__ is not an empty emphasis
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'There can be no empty emphasis or strong emphasis:'
|
||||||
|
AssertEqual '', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 7)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-444):
|
||||||
|
____ is not an empty strong emphasis
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO: There can be no empty emphasis or strong emphasis (2)'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 11 {{{1
|
||||||
|
# A literal * character cannot occur at the beginning or end of *-delimited emphasis or **-delimited strong emphasis, unless it is backslash-escaped.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-445):
|
||||||
|
foo ***
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Empty emphasis'
|
||||||
|
AssertEqual '1', SyntaxAt(1, 1) . 1
|
||||||
|
AssertEqual '2', SyntaxAt(2, 1) . 2
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-446):
|
||||||
|
foo *\**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Emphasis an escaped *'
|
||||||
|
AssertEqual '', SyntaxAt(1, 1)
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 7)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-447):
|
||||||
|
foo *_*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Emphasis a lonely _'
|
||||||
|
Log 'TODO, this is bold italic for now as we got it as special case'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
# AssertEqual 'VimwikiItalic', SyntaxAt(1, 6)
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-448):
|
||||||
|
foo *****
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Nothing happen'
|
||||||
|
let var = SyntaxAt(1, 7)
|
||||||
|
AssertEqual 1, var == '' || var == 'VimwikiDelimiter'
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-449):
|
||||||
|
foo **\***
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Emphasis a lonely *'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 8)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-450):
|
||||||
|
foo **_**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
# CommentLine 'Bold a single _ between **'
|
||||||
|
# AssertEqual 'VimwikiBold', SyntaxAt(1, 7)
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-451):
|
||||||
|
**foo*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'IDEA: the rest is for haskell or yacc more than vim'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 12 {{{1
|
||||||
|
# A literal _ character cannot occur at the beginning or end of _-delimited emphasis or __-delimited strong emphasis, unless it is backslash-escaped.
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 13 {{{1
|
||||||
|
# The number of nestings should be minimized. Thus, for example, an interpretation <strong>...</strong> is always preferred to <em><em>...</em></em>.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-469):
|
||||||
|
**foo**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Basic bold'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-470):
|
||||||
|
*_foo_*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO Change that'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
# CommentLine 'Double italic'
|
||||||
|
# AssertEqual 'VimwikiItalic', SyntaxAt(1, 4)
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-471):
|
||||||
|
__foo__
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Basic bold (2)'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-472):
|
||||||
|
_*foo*_
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Double italic (2)'
|
||||||
|
AssertEqual 'VimwikiItalic', SyntaxAt(1, 4)
|
||||||
|
AssertEqual '', SyntaxAt(2, 4)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-473):
|
||||||
|
****foo****
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Double bold with ****'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 6)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-474):
|
||||||
|
____foo____
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Double bold with ____'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 6)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-475):
|
||||||
|
******foo******
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Triple bold with ******'
|
||||||
|
AssertEqual 'VimwikiBold', SyntaxAt(1, 8)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 14 {{{1
|
||||||
|
# An interpretation <em><strong>...</strong></em> is always preferred to <strong><em>...</em></strong>.
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-476):
|
||||||
|
***foo***
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Bold Italic normal, with 3 *'
|
||||||
|
AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 5)
|
||||||
|
AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-477):
|
||||||
|
_____foo_____
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'Bold Italic with 5 _'
|
||||||
|
CommentLine 'TODO Passed'
|
||||||
|
# AssertEqual 'VimwikiBoldItalic', SyntaxAt(1, 7)
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 15 {{{1
|
||||||
|
# When two potential emphasis or strong emphasis spans overlap, so that the second begins before the first ends and ends after the first ends, the first takes precedence. Thus, for example, *foo _bar* baz_ is parsed as <em>foo _bar</em> baz_ rather than *foo <em>bar* baz</em>.
|
||||||
|
|
||||||
|
|
||||||
|
# Rule 16 {{{1
|
||||||
|
# When there are two potential emphasis or strong emphasis spans with the same closing delimiter, the shorter one (the one that opens later) takes precedence. Thus, for example, **foo **bar baz** is parsed as **foo <strong>bar baz</strong> rather than <strong>foo **bar baz</strong>.
|
||||||
|
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-480):
|
||||||
|
**foo **bar baz**
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'All bold as the ** inside is not closing, Passed as vimwiki do not follow the spec'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
# CommentLine 'Double bold (2)'
|
||||||
|
# AssertEqual 'VimwikiBold', SyntaxAt(1, 6)
|
||||||
|
# AssertEqual '', SyntaxAt(2, 1)
|
||||||
|
|
||||||
|
# Rule 17 {{{1
|
||||||
|
# Inline code spans, links, images, and HTML tags group more tightly than emphasis. So, when there is a choice between an interpretation that contains one of these elements and one that does not, the former always wins. Thus, for example, *[foo*](bar) is parsed as *<a href="bar">foo*</a> rather than as <em>[foo</em>](bar).
|
||||||
|
|
||||||
|
Given vimwiki (Typeface: https://github.github.com/gfm/#example-485):
|
||||||
|
*a `*` b*
|
||||||
|
*a `a a*a a` b*
|
||||||
|
12345678901234
|
||||||
|
|
||||||
|
Execute (Set Markdown):
|
||||||
|
call SetSyntax('markdown')
|
||||||
|
|
||||||
|
Execute (Assert Syntax):
|
||||||
|
CommentLine 'TODO with a * as unique code, a nice trap'
|
||||||
|
AssertEqual 0, 0
|
||||||
|
|
||||||
|
|
||||||
# vim: foldmethod=marker foldlevel=30 sw=2
|
# vim: foldmethod=marker foldlevel=30 sw=2
|
||||||
|
|||||||
+250
@@ -4,6 +4,95 @@
|
|||||||
Execute (Setup):
|
Execute (Setup):
|
||||||
set sw=4
|
set sw=4
|
||||||
AssertEqual 4, &sw
|
AssertEqual 4, &sw
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
Do (Create File Content with default tags {{{1):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-default.md\<CR>
|
||||||
|
I
|
||||||
|
:tag1:tag2:\<CR>
|
||||||
|
\<Esc>
|
||||||
|
:write\<CR>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
:VimwikiGenerateTagLinks\<CR>
|
||||||
|
gg
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Generate tags for default):
|
||||||
|
edit $HOME/testmarkdown/Test-Tag-default.md
|
||||||
|
AssertEqual 'VimwikiTag', SyntaxAt(1, 2)
|
||||||
|
1
|
||||||
|
VimwikiGenerateTagLinks
|
||||||
|
write
|
||||||
|
|
||||||
|
|
||||||
|
Expect (Tags default):
|
||||||
|
:tag1:tag2:
|
||||||
|
|
||||||
|
|
||||||
|
# Generated Tags
|
||||||
|
|
||||||
|
## tag1
|
||||||
|
|
||||||
|
- [Test-Tag-default](Test-Tag-default)
|
||||||
|
|
||||||
|
## tag2
|
||||||
|
|
||||||
|
- [Test-Tag-default](Test-Tag-default)
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Clean tag file for default):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
|
||||||
|
|
||||||
|
Do (Create File Content with default tags):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-default.md\<CR>
|
||||||
|
ggdG
|
||||||
|
I
|
||||||
|
# Generated Tags\<Cr>
|
||||||
|
\<Cr>
|
||||||
|
# Heading with my tags\<Cr>
|
||||||
|
\<Cr>
|
||||||
|
:tag1:tag2:\<CR>
|
||||||
|
\<Cr>
|
||||||
|
Dummy content 1
|
||||||
|
\<Cr>
|
||||||
|
# Another heading\<Cr>
|
||||||
|
\<Cr>
|
||||||
|
Dummy content 2
|
||||||
|
\<Esc>
|
||||||
|
:write\<CR>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
:VimwikiGenerateTagLinks\<CR>
|
||||||
|
gg
|
||||||
|
|
||||||
|
|
||||||
|
Expect (Tags default with Generated Tags heading):
|
||||||
|
# Generated Tags
|
||||||
|
|
||||||
|
## tag1
|
||||||
|
|
||||||
|
- [Heading with my tags](Test-Tag-default#heading-with-my-tags)
|
||||||
|
|
||||||
|
## tag2
|
||||||
|
|
||||||
|
- [Heading with my tags](Test-Tag-default#heading-with-my-tags)
|
||||||
|
|
||||||
|
# Heading with my tags
|
||||||
|
|
||||||
|
:tag1:tag2:
|
||||||
|
|
||||||
|
Dummy content 1
|
||||||
|
# Another heading
|
||||||
|
|
||||||
|
Dummy content 2
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Clean file for tag default):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
call system("rm $HOME/testmarkdown/Test-Tag-default.md")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
@@ -16,6 +105,7 @@ Execute (Change delimiter <tag1|tag2> {{{1):
|
|||||||
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
Do (Create File Content with <>):
|
Do (Create File Content with <>):
|
||||||
:edit $HOME/testmarkdown/Test-Tag.md\<CR>
|
:edit $HOME/testmarkdown/Test-Tag.md\<CR>
|
||||||
I
|
I
|
||||||
@@ -40,6 +130,7 @@ Execute (Generate tags):
|
|||||||
VimwikiGenerateTagLinks
|
VimwikiGenerateTagLinks
|
||||||
set tw=200
|
set tw=200
|
||||||
|
|
||||||
|
|
||||||
Expect (Correctly generated tags section {{{3):
|
Expect (Correctly generated tags section {{{3):
|
||||||
<tag-bar-1>
|
<tag-bar-1>
|
||||||
|
|
||||||
@@ -77,12 +168,14 @@ Do (Write a quick tag for a quick jump):
|
|||||||
ggl\<Cr>A __HERE1__\<Esc>
|
ggl\<Cr>A __HERE1__\<Esc>
|
||||||
ggjl\<Cr>A __HERE2__\<Esc>
|
ggjl\<Cr>A __HERE2__\<Esc>
|
||||||
|
|
||||||
|
|
||||||
Expect (Good jump {{{3):
|
Expect (Good jump {{{3):
|
||||||
[go1](Test-Tag#tag-bar-1)
|
[go1](Test-Tag#tag-bar-1)
|
||||||
[go2](#tag-bar-1)
|
[go2](#tag-bar-1)
|
||||||
bla
|
bla
|
||||||
<tag-bar-1> __HERE1__ __HERE2__
|
<tag-bar-1> __HERE1__ __HERE2__
|
||||||
|
|
||||||
|
|
||||||
Execute (Clean Test-Tag and .vimwiki_tags -2):
|
Execute (Clean Test-Tag and .vimwiki_tags -2):
|
||||||
let g:vimwiki_tag_format = {}
|
let g:vimwiki_tag_format = {}
|
||||||
unlet g:vimwiki_syntaxlocal_vars
|
unlet g:vimwiki_syntaxlocal_vars
|
||||||
@@ -101,6 +194,7 @@ Execute (Default tag generation {{{1):
|
|||||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
set tw=200
|
set tw=200
|
||||||
|
|
||||||
|
|
||||||
Do (Single file Part1):
|
Do (Single file Part1):
|
||||||
:edit $HOME/testmarkdown/Test-Tag.md\<Cr>
|
:edit $HOME/testmarkdown/Test-Tag.md\<Cr>
|
||||||
ggdGO
|
ggdGO
|
||||||
@@ -108,12 +202,14 @@ Do (Single file Part1):
|
|||||||
:write\<Cr>
|
:write\<Cr>
|
||||||
:VimwikiRebuildTags!\<Cr>
|
:VimwikiRebuildTags!\<Cr>
|
||||||
|
|
||||||
|
|
||||||
Execute (Generate tags):
|
Execute (Generate tags):
|
||||||
edit $HOME/testmarkdown/Test-Tag.md
|
edit $HOME/testmarkdown/Test-Tag.md
|
||||||
AssertEqual 'VimwikiTag', SyntaxAt(1, 1)
|
AssertEqual 'VimwikiTag', SyntaxAt(1, 1)
|
||||||
VimwikiGenerateTagLinks
|
VimwikiGenerateTagLinks
|
||||||
write
|
write
|
||||||
|
|
||||||
|
|
||||||
Expect (Single tags toc):
|
Expect (Single tags toc):
|
||||||
:single-tag:
|
:single-tag:
|
||||||
|
|
||||||
@@ -145,12 +241,14 @@ Do (Create File Content):
|
|||||||
:write\<CR>
|
:write\<CR>
|
||||||
:VimwikiRebuildTags\<CR>
|
:VimwikiRebuildTags\<CR>
|
||||||
|
|
||||||
|
|
||||||
Execute (Edit tags file):
|
Execute (Edit tags file):
|
||||||
edit $HOME/testmarkdown/.vimwiki_tags
|
edit $HOME/testmarkdown/.vimwiki_tags
|
||||||
AssertEqual $HOME . '/testmarkdown/.vimwiki_tags', expand('%')
|
AssertEqual $HOME . '/testmarkdown/.vimwiki_tags', expand('%')
|
||||||
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
# Note: tags file uses tabs
|
# Note: tags file uses tabs
|
||||||
Expect (Correctly formatted tags file):
|
Expect (Correctly formatted tags file):
|
||||||
!_TAG_FILE_FORMAT 2
|
!_TAG_FILE_FORMAT 2
|
||||||
@@ -164,10 +262,12 @@ Expect (Correctly formatted tags file):
|
|||||||
test-tag Test-Tag.md 5;" vimwiki:Test-Tag\tTest-Tag#a-header\tA header
|
test-tag Test-Tag.md 5;" vimwiki:Test-Tag\tTest-Tag#a-header\tA header
|
||||||
top-tag Test-Tag.md 1;" vimwiki:Test-Tag\tTest-Tag\tTest-Tag
|
top-tag Test-Tag.md 1;" vimwiki:Test-Tag\tTest-Tag\tTest-Tag
|
||||||
|
|
||||||
|
|
||||||
Execute (Generate tags):
|
Execute (Generate tags):
|
||||||
edit $HOME/testmarkdown/Test-Tag.md
|
edit $HOME/testmarkdown/Test-Tag.md
|
||||||
VimwikiGenerateTagLinks
|
VimwikiGenerateTagLinks
|
||||||
|
|
||||||
|
|
||||||
Expect (Correctly generated tags section):
|
Expect (Correctly generated tags section):
|
||||||
:top-tag:
|
:top-tag:
|
||||||
|
|
||||||
@@ -198,6 +298,7 @@ Expect (Correctly generated tags section):
|
|||||||
|
|
||||||
- [Test-Tag](Test-Tag)
|
- [Test-Tag](Test-Tag)
|
||||||
|
|
||||||
|
|
||||||
Execute (Clean Test-Tag and .vimwiki_tags -1 ):
|
Execute (Clean Test-Tag and .vimwiki_tags -1 ):
|
||||||
call system("rm $HOME/testmarkdown/Test.md")
|
call system("rm $HOME/testmarkdown/Test.md")
|
||||||
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
@@ -214,6 +315,7 @@ Execute (Check first tags file):
|
|||||||
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
Do (Build first tags file):
|
Do (Build first tags file):
|
||||||
:edit $HOME/testmarkdown/Test-Tag-1.md\<Cr>
|
:edit $HOME/testmarkdown/Test-Tag-1.md\<Cr>
|
||||||
ggI
|
ggI
|
||||||
@@ -228,12 +330,14 @@ Do (Build first tags file):
|
|||||||
:write\<Cr>
|
:write\<Cr>
|
||||||
:VimwikiRebuildTags!\<CR>
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
|
||||||
|
|
||||||
Execute (Check second tags file):
|
Execute (Check second tags file):
|
||||||
edit $HOME/testmarkdown/subdir1/Test-Tag-2.md
|
edit $HOME/testmarkdown/subdir1/Test-Tag-2.md
|
||||||
AssertEqual $HOME . '/testmarkdown/subdir1/Test-Tag-2.md', expand('%')
|
AssertEqual $HOME . '/testmarkdown/subdir1/Test-Tag-2.md', expand('%')
|
||||||
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
Do (Build second tags file):
|
Do (Build second tags file):
|
||||||
:edit $HOME/testmarkdown/subdir1/Test-Tag-2.md\<Cr>
|
:edit $HOME/testmarkdown/subdir1/Test-Tag-2.md\<Cr>
|
||||||
ggI
|
ggI
|
||||||
@@ -248,6 +352,7 @@ Do (Build second tags file):
|
|||||||
:write\<Cr>
|
:write\<Cr>
|
||||||
:VimwikiRebuildTags!\<CR>
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
|
||||||
|
|
||||||
Execute (Build tag links in third file):
|
Execute (Build tag links in third file):
|
||||||
edit $HOME/testmarkdown/subdir1/subdir11/Test-Tag-Links.md
|
edit $HOME/testmarkdown/subdir1/subdir11/Test-Tag-Links.md
|
||||||
AssertEqual $HOME . '/testmarkdown/subdir1/subdir11/Test-Tag-Links.md', expand('%')
|
AssertEqual $HOME . '/testmarkdown/subdir1/subdir11/Test-Tag-Links.md', expand('%')
|
||||||
@@ -256,6 +361,7 @@ Execute (Build tag links in third file):
|
|||||||
VimwikiGenerateTagLinks
|
VimwikiGenerateTagLinks
|
||||||
write
|
write
|
||||||
|
|
||||||
|
|
||||||
Expect (Tag links relative to current file):
|
Expect (Tag links relative to current file):
|
||||||
|
|
||||||
|
|
||||||
@@ -276,6 +382,7 @@ Expect (Tag links relative to current file):
|
|||||||
- [standalone-tag-1](../../Test-Tag-1#standalone-tag-1)
|
- [standalone-tag-1](../../Test-Tag-1#standalone-tag-1)
|
||||||
- [standalone-tag-1](../Test-Tag-2#standalone-tag-1)
|
- [standalone-tag-1](../Test-Tag-2#standalone-tag-1)
|
||||||
|
|
||||||
|
|
||||||
Do (Delete some existing links to test updating generated tag links):
|
Do (Delete some existing links to test updating generated tag links):
|
||||||
:edit $HOME/testmarkdown/subdir1/subdir11/Test-Tag-Links.md\<Cr>
|
:edit $HOME/testmarkdown/subdir1/subdir11/Test-Tag-Links.md\<Cr>
|
||||||
7G
|
7G
|
||||||
@@ -285,6 +392,7 @@ Do (Delete some existing links to test updating generated tag links):
|
|||||||
:write\<Cr>
|
:write\<Cr>
|
||||||
:call vimwiki#tags#generate_tags(0)\<Cr>
|
:call vimwiki#tags#generate_tags(0)\<Cr>
|
||||||
|
|
||||||
|
|
||||||
Expect (Only update generated tag links for tags already existing in the file):
|
Expect (Only update generated tag links for tags already existing in the file):
|
||||||
|
|
||||||
|
|
||||||
@@ -300,6 +408,148 @@ Expect (Only update generated tag links for tags already existing in the file):
|
|||||||
- [Another Header](../../Test-Tag-1#another-header)
|
- [Another Header](../../Test-Tag-1#another-header)
|
||||||
- [Another Header](../Test-Tag-2#another-header)
|
- [Another Header](../Test-Tag-2#another-header)
|
||||||
|
|
||||||
|
|
||||||
Execute (Clean relative tag setup):
|
Execute (Clean relative tag setup):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
call system("rm -rf $HOME/testmarkdown/subdir1")
|
call system("rm -rf $HOME/testmarkdown/subdir1")
|
||||||
call system("rm $HOME/testmarkdown/Test-Tag-1.md")
|
call system("rm $HOME/testmarkdown/Test-Tag-1.md")
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
Execute (Change delimiter #tag1content1|content2#tag2 as for issue #1316 {{{1):
|
||||||
|
let g:vimwiki_tag_format = {'pre_mark': '#tag1', 'post_mark': '#tag2', 'sep': '|'}
|
||||||
|
unlet g:vimwiki_syntaxlocal_vars
|
||||||
|
call vimwiki#vars#init()
|
||||||
|
edit $HOME/testmarkdown/Test-Tag-1316.md
|
||||||
|
AssertEqual $HOME . '/testmarkdown/Test-Tag-1316.md', expand('%')
|
||||||
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
|
Do (Create File Content with #tag1 #tag2 as for issue #1316):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-issue-1316.md\<CR>
|
||||||
|
I
|
||||||
|
# Line1: Heading
|
||||||
|
# A header\<CR>
|
||||||
|
# Line2: Tag not in header
|
||||||
|
bla #tag1content01|content02#tag2\<CR>
|
||||||
|
# Line3: Tag in header
|
||||||
|
#tag1content11|content12#tag2\<CR>
|
||||||
|
# Line4: empty
|
||||||
|
\<CR>
|
||||||
|
# Line5: dummy content
|
||||||
|
Words here.
|
||||||
|
\<Esc>
|
||||||
|
:write\<CR>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
gg
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Generate tags for issue #1316):
|
||||||
|
edit $HOME/testmarkdown/Test-Tag-issue-1316.md
|
||||||
|
AssertEqual 'VimwikiTag', SyntaxAt(2, 5)
|
||||||
|
1
|
||||||
|
VimwikiGenerateTagLinks
|
||||||
|
write
|
||||||
|
|
||||||
|
|
||||||
|
Expect (Single tags toc):
|
||||||
|
# A header
|
||||||
|
bla #tag1content01|content02#tag2
|
||||||
|
#tag1content11|content12#tag2
|
||||||
|
|
||||||
|
Words here.
|
||||||
|
|
||||||
|
# Generated Tags
|
||||||
|
|
||||||
|
## content01
|
||||||
|
|
||||||
|
- [A header](Test-Tag-issue-1316#a-header)
|
||||||
|
|
||||||
|
## content02
|
||||||
|
|
||||||
|
- [A header](Test-Tag-issue-1316#a-header)
|
||||||
|
|
||||||
|
## content11
|
||||||
|
|
||||||
|
- [tag2](Test-Tag-issue-1316#tag1content11content12tag2)
|
||||||
|
|
||||||
|
## content12
|
||||||
|
|
||||||
|
- [tag2](Test-Tag-issue-1316#tag1content11content12tag2)
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Clean file for tag #1316):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
call system("rm $HOME/testmarkdown/Test-Tag-issue-1316.md")
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Change delimiter #first_tag #vim #mo as for issue #1316 (2) {{{1):
|
||||||
|
let g:vimwiki_tag_format = {'pre_mark': '#\w\@=', 'post_mark': '', 'sep': '[#[:space:]]\+', 'in': '[^#:[:space:]]\+' }
|
||||||
|
unlet g:vimwiki_syntaxlocal_vars
|
||||||
|
call vimwiki#vars#init()
|
||||||
|
edit $HOME/testmarkdown/Test-Tag-issue-1316-bis.md
|
||||||
|
AssertEqual $HOME . '/testmarkdown/Test-Tag-issue-1316-bis.md', expand('%')
|
||||||
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
|
||||||
|
|
||||||
|
Do (Create File Content with #tag1 #tag2 as for issue #1316):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-issue-1316-bis.md\<CR>
|
||||||
|
I
|
||||||
|
# Line1: Heading
|
||||||
|
# A header\<CR>
|
||||||
|
# Line2: Tag not in header
|
||||||
|
bla #first_tag\<Cr>
|
||||||
|
# Line3: Tag in header
|
||||||
|
#vim #mono\<Cr>
|
||||||
|
# Line4: empty
|
||||||
|
\<CR>
|
||||||
|
# Line5: dummy content
|
||||||
|
Words here.
|
||||||
|
\<Esc>
|
||||||
|
:write\<CR>
|
||||||
|
:VimwikiRebuildTags!\<CR>
|
||||||
|
gg
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Assert some file info for #1316):
|
||||||
|
edit $HOME/testmarkdown/Test-Tag-issue-1316-bis.md
|
||||||
|
AssertEqual $HOME . '/testmarkdown/Test-Tag-issue-1316-bis.md', expand('%')
|
||||||
|
AssertEqual 'markdown', vimwiki#vars#get_wikilocal('syntax')
|
||||||
|
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||||
|
AssertEqual 'VimwikiTag', SyntaxAt(2, 6)
|
||||||
|
|
||||||
|
|
||||||
|
Do (Append something at first_tag):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-issue-1316-bis.md\<CR>
|
||||||
|
# Some bug with loclist for vim7.3 and vim8.0
|
||||||
|
:if v:version > 810\<Cr>
|
||||||
|
VimwikiSearchTags first_tag\<Cr>
|
||||||
|
else\<Cr>
|
||||||
|
2\<Cr>
|
||||||
|
endif\<Cr>
|
||||||
|
A Content1\<Esc>
|
||||||
|
|
||||||
|
|
||||||
|
Do (Append something at mono tag):
|
||||||
|
:edit $HOME/testmarkdown/Test-Tag-issue-1316-bis.md\<CR>
|
||||||
|
:if v:version > 810\<Cr>
|
||||||
|
VimwikiSearchTags mono\<Cr>
|
||||||
|
else\<Cr>
|
||||||
|
3\<Cr>
|
||||||
|
endif\<Cr>
|
||||||
|
A Content2\<Esc>
|
||||||
|
|
||||||
|
|
||||||
|
Expect (Content appended at tags):
|
||||||
|
# A header
|
||||||
|
bla #first_tag Content1
|
||||||
|
#vim #mono Content2
|
||||||
|
|
||||||
|
Words here.
|
||||||
|
|
||||||
|
|
||||||
|
Execute (Clean file for tag #1316):
|
||||||
|
call system("rm $HOME/testmarkdown/.vimwiki_tags")
|
||||||
|
call system("rm $HOME/testmarkdown/Test-Tag-issue-1316-bis.md")
|
||||||
|
|||||||
Reference in New Issue
Block a user