Fix: Typeface font highlight VimwikiBoldItalicUnderline was not bold
Fix 2: s:setup_cleared_syntax() was reconfiguring badly Test: for hi VimwikiBold -> cterm=bold
This commit is contained in:
@@ -189,7 +189,7 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:populate_global_variables() abort
|
function! s:populate_global_variables() abort
|
||||||
" Populate global variable <- user & default
|
" Populate: global variable <- user & default
|
||||||
" Called: s:vimwiki#vars#init
|
" Called: s:vimwiki#vars#init
|
||||||
call s:read_global_settings_from_user()
|
call s:read_global_settings_from_user()
|
||||||
call s:normalize_global_settings()
|
call s:normalize_global_settings()
|
||||||
@@ -198,25 +198,32 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:internal_global_settings() abort
|
function! s:internal_global_settings() abort
|
||||||
" Read nromalized settings and create some more usefull variables to use internally
|
" Declare: normalized settings -> more usefull variables to use internally
|
||||||
" non-configurable global variables:
|
" non-configurable global variables:
|
||||||
|
|
||||||
" Scheme regexes must be defined even if syntax file is not loaded yet cause users should be
|
" Scheme regexes must be defined even if syntax file is not loaded yet cause users should be
|
||||||
" able to <leader>w<leader>w without opening any vimwiki file first
|
" able to <leader>w<leader>w without opening any vimwiki file first
|
||||||
|
|
||||||
|
" Know internal schemes
|
||||||
let g:vimwiki_global_vars.schemes = join(['wiki\d\+', 'diary', 'local'], '\|')
|
let g:vimwiki_global_vars.schemes = join(['wiki\d\+', 'diary', 'local'], '\|')
|
||||||
|
|
||||||
|
" Are used in markdown for image links
|
||||||
let g:vimwiki_global_vars.web_schemes1 = join(['http', 'https', 'file', 'ftp', 'gopher',
|
let g:vimwiki_global_vars.web_schemes1 = join(['http', 'https', 'file', 'ftp', 'gopher',
|
||||||
\ 'telnet', 'nntp', 'ldap', 'rsync', 'imap', 'pop', 'irc', 'ircs', 'cvs', 'svn', 'svn+ssh',
|
\ 'telnet', 'nntp', 'ldap', 'rsync', 'imap', 'pop', 'irc', 'ircs', 'cvs', 'svn', 'svn+ssh',
|
||||||
\ 'git', 'ssh', 'fish', 'sftp'], '\|')
|
\ 'git', 'ssh', 'fish', 'sftp'], '\|')
|
||||||
|
|
||||||
|
" Other possible schemes
|
||||||
let web_schemes2 =
|
let web_schemes2 =
|
||||||
\ join(['mailto', 'news', 'xmpp', 'sip', 'sips', 'doi', 'urn', 'tel', 'data'], '\|')
|
\ join(['mailto', 'news', 'xmpp', 'sip', 'sips', 'doi', 'urn', 'tel', 'data'], '\|')
|
||||||
|
|
||||||
|
" Concatenate known schemes => regex
|
||||||
let g:vimwiki_global_vars.rxSchemes = '\%('.
|
let g:vimwiki_global_vars.rxSchemes = '\%('.
|
||||||
\ g:vimwiki_global_vars.schemes . '\|'.
|
\ g:vimwiki_global_vars.schemes . '\|'.
|
||||||
\ g:vimwiki_global_vars.web_schemes1 . '\|'.
|
\ g:vimwiki_global_vars.web_schemes1 . '\|'.
|
||||||
\ web_schemes2 .
|
\ web_schemes2 .
|
||||||
\ '\)'
|
\ '\)'
|
||||||
|
|
||||||
" match URL for common protocols; see http://en.wikipedia.org/wiki/URI_scheme
|
" Match URL for common protocols; see http://en.wikipedia.org/wiki/URI_scheme
|
||||||
" http://tools.ietf.org/html/rfc3986
|
" http://tools.ietf.org/html/rfc3986
|
||||||
let rxWebProtocols =
|
let rxWebProtocols =
|
||||||
\ '\%('.
|
\ '\%('.
|
||||||
@@ -227,7 +234,6 @@ function! s:internal_global_settings() abort
|
|||||||
\ '\|'.
|
\ '\|'.
|
||||||
\ '\%('.web_schemes2.'\):'.
|
\ '\%('.web_schemes2.'\):'.
|
||||||
\ '\)'
|
\ '\)'
|
||||||
|
|
||||||
let g:vimwiki_global_vars.rxWeblinkUrl = rxWebProtocols . '\S\{-1,}'. '\%(([^ \t()]*)\)\='
|
let g:vimwiki_global_vars.rxWeblinkUrl = rxWebProtocols . '\S\{-1,}'. '\%(([^ \t()]*)\)\='
|
||||||
|
|
||||||
let wikilink_prefix = '[['
|
let wikilink_prefix = '[['
|
||||||
|
|||||||
+5
-5
@@ -1150,24 +1150,24 @@ The primary purpose for wiki-include links is to include images.
|
|||||||
Transclude from a local URL: >
|
Transclude from a local URL: >
|
||||||
{{file:../../images/vimwiki_logo.png}}
|
{{file:../../images/vimwiki_logo.png}}
|
||||||
or from a universal URL: >
|
or from a universal URL: >
|
||||||
{{http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png}}
|
{{https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png}}
|
||||||
|
|
||||||
Transclude image with alternate text: >
|
Transclude image with alternate text: >
|
||||||
{{http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png|Vimwiki}}
|
{{https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png|Vimwiki}}
|
||||||
in HTML: >
|
in HTML: >
|
||||||
<img src="http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png"
|
<img src="https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png"
|
||||||
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;"}}
|
{{http://.../vimwiki_logo.png|cool stuff|style="width:150px;height:120px;"}}
|
||||||
in HTML: >
|
in HTML: >
|
||||||
<img src="http://vimwiki.googlecode.com/hg/images/vimwiki_logo.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"}}
|
{{http://.../vimwiki_logo.png||class="center flow blabla"}}
|
||||||
in HTML: >
|
in HTML: >
|
||||||
<img src="http://vimwiki.googlecode.com/hg/images/vimwiki_logo.png"
|
<img src="https://raw.githubusercontent.com/vimwiki/vimwiki/master/doc/splash.png"
|
||||||
alt="" class="center flow blabla"/>
|
alt="" class="center flow blabla"/>
|
||||||
|
|
||||||
A trial feature allows you to supply your own handler for wiki-include links.
|
A trial feature allows you to supply your own handler for wiki-include links.
|
||||||
|
|||||||
+2
-2
@@ -129,8 +129,8 @@ function! s:setup_cleared_syntax() abort
|
|||||||
" on colorscheme change because they are not linked to Vim-predefined groups
|
" on colorscheme change because they are not linked to Vim-predefined groups
|
||||||
hi def VimwikiBold term=bold cterm=bold gui=bold
|
hi def VimwikiBold term=bold cterm=bold gui=bold
|
||||||
hi def VimwikiItalic term=italic cterm=italic gui=italic
|
hi def VimwikiItalic term=italic cterm=italic gui=italic
|
||||||
hi def VimwikiBoldItalic term=bold cterm=bold gui=bold,italic
|
hi def VimwikiBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
|
||||||
hi def VimwikiUnderline gui=underline
|
hi def VimwikiUnderline term=underline cterm=underline gui=underline
|
||||||
if vimwiki#vars#get_global('hl_headers') == 1
|
if vimwiki#vars#get_global('hl_headers') == 1
|
||||||
for i in range(1,6)
|
for i in range(1,6)
|
||||||
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='
|
execute 'hi def VimwikiHeader'.i.' guibg=bg guifg='
|
||||||
|
|||||||
+5
-5
@@ -257,10 +257,12 @@ 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').'/'
|
||||||
|
|
||||||
|
" Preformated Text: `like that`
|
||||||
let concealpre = vimwiki#vars#get_global('conceal_pre') ? ' concealends' : ''
|
let concealpre = vimwiki#vars#get_global('conceal_pre') ? ' concealends' : ''
|
||||||
execute 'syntax region VimwikiPre matchgroup=VimwikiPreDelim start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
|
execute 'syntax region VimwikiPre matchgroup=VimwikiPreDelim start=/'.vimwiki#vars#get_syntaxlocal('rxPreStart').
|
||||||
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@NoSpell'.concealpre
|
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxPreEnd').'/ contains=@NoSpell'.concealpre
|
||||||
|
|
||||||
|
" Equation Text: $like that$
|
||||||
execute 'syntax region VimwikiMath start=/'.vimwiki#vars#get_syntaxlocal('rxMathStart').
|
execute 'syntax region VimwikiMath start=/'.vimwiki#vars#get_syntaxlocal('rxMathStart').
|
||||||
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@NoSpell'
|
\ '/ end=/'.vimwiki#vars#get_syntaxlocal('rxMathEnd').'/ contains=@NoSpell'
|
||||||
|
|
||||||
@@ -281,7 +283,7 @@ if vimwiki#vars#get_global('valid_html_tags') !=? ''
|
|||||||
let s:html_tags = join(split(vimwiki#vars#get_global('valid_html_tags'), '\s*,\s*'), '\|')
|
let s:html_tags = join(split(vimwiki#vars#get_global('valid_html_tags'), '\s*,\s*'), '\|')
|
||||||
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.s:html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
|
exe 'syntax match VimwikiHTMLtag #\c</\?\%('.s:html_tags.'\)\%(\s\{-1}\S\{-}\)\{-}\s*/\?>#'
|
||||||
|
|
||||||
" Typeface:
|
" Html Typeface: <b>bold text</b>
|
||||||
let html_typeface = {
|
let html_typeface = {
|
||||||
\ 'bold': [['<b>', '</b\_s*>'], ['<strong>', '</strong\_s*>']],
|
\ 'bold': [['<b>', '</b\_s*>'], ['<strong>', '</strong\_s*>']],
|
||||||
\ 'italic': [['<i>', '</i\_s*>'], ['<em>', '</em\_s*>']],
|
\ 'italic': [['<i>', '</i\_s*>'], ['<em>', '</em\_s*>']],
|
||||||
@@ -292,6 +294,7 @@ if vimwiki#vars#get_global('valid_html_tags') !=? ''
|
|||||||
\ 'sup': [['<sup>', '</sup\_s*>']],
|
\ 'sup': [['<sup>', '</sup\_s*>']],
|
||||||
\ 'sub': [['<sub>', '</sub\_s*>']],
|
\ 'sub': [['<sub>', '</sub\_s*>']],
|
||||||
\ }
|
\ }
|
||||||
|
" Highlight now
|
||||||
call vimwiki#u#hi_typeface(html_typeface)
|
call vimwiki#u#hi_typeface(html_typeface)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -401,16 +404,13 @@ hi def VimwikiItalicUnderline term=italic,underline cterm=italic,underline gui=i
|
|||||||
hi def link VimwikiUnderlineItalic VimwikiItalicUnderline
|
hi def link VimwikiUnderlineItalic VimwikiItalicUnderline
|
||||||
|
|
||||||
" Typeface 3
|
" Typeface 3
|
||||||
hi def VimwikiItalicUnderline term=italic,underline cterm=italic,underline gui=italic,underline
|
hi def VimwikiBoldItalicUnderline term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline
|
||||||
hi def link VimwikiBoldUnderlineItalic VimwikiBoldItalicUnderline
|
hi def link VimwikiBoldUnderlineItalic VimwikiBoldItalicUnderline
|
||||||
hi def link VimwikiItalicBoldUnderline VimwikiBoldItalicUnderline
|
hi def link VimwikiItalicBoldUnderline VimwikiBoldItalicUnderline
|
||||||
hi def link VimwikiItalicUnderlineBold VimwikiBoldItalicUnderline
|
hi def link VimwikiItalicUnderlineBold VimwikiBoldItalicUnderline
|
||||||
hi def link VimwikiUnderlineBoldItalic VimwikiBoldItalicUnderline
|
hi def link VimwikiUnderlineBoldItalic VimwikiBoldItalicUnderline
|
||||||
hi def link VimwikiUnderlineItalicBold VimwikiBoldItalicUnderline
|
hi def link VimwikiUnderlineItalicBold VimwikiBoldItalicUnderline
|
||||||
|
|
||||||
" Typeface 2
|
|
||||||
hi def VimwikiBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline
|
|
||||||
|
|
||||||
" Code
|
" Code
|
||||||
hi def link VimwikiCode PreProc
|
hi def link VimwikiCode PreProc
|
||||||
hi def link VimwikiCodeT VimwikiCode
|
hi def link VimwikiCodeT VimwikiCode
|
||||||
|
|||||||
+36
-2
@@ -1,7 +1,5 @@
|
|||||||
# Syntax and Highlight
|
# Syntax and Highlight
|
||||||
|
|
||||||
#Given vimwiki (bold and pre):
|
|
||||||
|
|
||||||
# 1 Typeface {{{1
|
# 1 Typeface {{{1
|
||||||
#################
|
#################
|
||||||
|
|
||||||
@@ -726,4 +724,40 @@ Execute (Assert math syntax 2):
|
|||||||
let syntax_12 = SyntaxAt(12, 1)
|
let syntax_12 = SyntaxAt(12, 1)
|
||||||
Assert syntax_12 == 'texStatement' || syntax_5 == 'texMathSymbol'
|
Assert syntax_12 == 'texStatement' || syntax_5 == 'texMathSymbol'
|
||||||
|
|
||||||
|
# 21 Highlight {{{1
|
||||||
|
##################
|
||||||
|
Given vimwiki (One line):
|
||||||
|
content
|
||||||
|
|
||||||
|
Execute (Assert highlight typeface 1):
|
||||||
|
" Typeface 1
|
||||||
|
AssertEqual ['bold'], GetHighlightTerm('VimwikiBold', 'term')
|
||||||
|
AssertEqual ['bold'], GetHighlightTerm('VimwikiBold', 'cterm')
|
||||||
|
AssertEqual ['bold'], GetHighlightTerm('VimwikiBold', 'gui')
|
||||||
|
|
||||||
|
AssertEqual ['italic'], GetHighlightTerm('VimwikiItalic', 'cterm')
|
||||||
|
AssertEqual ['underline'], GetHighlightTerm('VimwikiUnderline', 'gui')
|
||||||
|
|
||||||
|
Execute (Assert highlight typeface 2):
|
||||||
|
" Bold > Italic > Underline
|
||||||
|
AssertEqual sort(['bold', 'italic', '1']), sort(add(GetHighlightTerm('VimwikiBoldItalic', 'gui'), '1'))
|
||||||
|
AssertEqual sort(['bold', 'italic', '2']), sort(add(GetHighlightTerm('VimwikiBoldItalic', 'term'), '2'))
|
||||||
|
|
||||||
|
AssertEqual sort(['bold', 'underline', '3']), sort(add(GetHighlightTerm('VimwikiBoldUnderline', 'cterm'), '3'))
|
||||||
|
AssertEqual sort(['bold', 'underline', '4']), sort(add(GetHighlightTerm('VimwikiUnderlineBold', 'term'), '4'))
|
||||||
|
|
||||||
|
AssertEqual sort(['italic', 'underline', '5']), sort(add(GetHighlightTerm('VimwikiItalicUnderline', 'cterm'), '5'))
|
||||||
|
|
||||||
|
Execute (Assert highlight typeface 3):
|
||||||
|
AssertEqual sort(['bold', 'italic', 'underline', '1']), sort(add(GetHighlightTerm('VimwikiBoldItalicUnderline', 'gui'), '1'))
|
||||||
|
AssertEqual sort(['bold', 'italic', 'underline', '2']), sort(add(GetHighlightTerm('VimwikiBoldUnderlineItalic', 'cterm'), '2'))
|
||||||
|
AssertEqual sort(['bold', 'italic', 'underline', '3']), sort(add(GetHighlightTerm('VimwikiItalicBoldUnderline', 'term'), '3'))
|
||||||
|
AssertEqual sort(['bold', 'italic', 'underline', '4']), sort(add(GetHighlightTerm('VimwikiItalicUnderlineBold', 'gui'), '4'))
|
||||||
|
AssertEqual sort(['bold', 'italic', 'underline', '5']), sort(add(GetHighlightTerm('VimwikiUnderlineBoldItalic', 'cterm'), '5'))
|
||||||
|
AssertEqual sort(['bold', 'italic', 'underline', '6']), sort(add(GetHighlightTerm('VimwikiUnderlineItalicBold', 'term'), '6'))
|
||||||
|
|
||||||
|
Expect (One line):
|
||||||
|
content
|
||||||
|
|
||||||
|
|
||||||
# vim: foldmethod=marker foldlevel=30 sw=2
|
# vim: foldmethod=marker foldlevel=30 sw=2
|
||||||
|
|||||||
+38
-19
@@ -87,8 +87,8 @@
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Define functions
|
" Define functions
|
||||||
" Change the syntax using a temporary wiki
|
|
||||||
function! SetSyntax(vw_syn)
|
function! SetSyntax(vw_syn)
|
||||||
|
" Change the syntax using a temporary wiki
|
||||||
" Change extension and wiki_nr
|
" Change extension and wiki_nr
|
||||||
let index=0
|
let index=0
|
||||||
if a:vw_syn ==# 'default'
|
if a:vw_syn ==# 'default'
|
||||||
@@ -164,13 +164,13 @@
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Source plugin
|
|
||||||
function! LoadVimwiki()
|
function! LoadVimwiki()
|
||||||
|
" Source plugin
|
||||||
runtime! plugin/vimwiki.vim
|
runtime! plugin/vimwiki.vim
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Reload plugin to change settings
|
|
||||||
function! ReloadVimwiki()
|
function! ReloadVimwiki()
|
||||||
|
" Reload plugin to change settings
|
||||||
call UnloadVimwiki()
|
call UnloadVimwiki()
|
||||||
|
|
||||||
" Reset list
|
" Reset list
|
||||||
@@ -185,17 +185,17 @@
|
|||||||
call vimwiki#vars#init()
|
call vimwiki#vars#init()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Copy wiki test resources so that vimtest user can write them
|
|
||||||
function! CopyResources()
|
function! CopyResources()
|
||||||
|
" Copy wiki test resources so that vimtest user can write them
|
||||||
call system('cp -r /testplugin/test/resources/* $HOME/')
|
call system('cp -r /testplugin/test/resources/* $HOME/')
|
||||||
" Make diary directory
|
" Make diary directory
|
||||||
call system('mkdir $HOME/testwiki/diary')
|
call system('mkdir $HOME/testwiki/diary')
|
||||||
call system('mkdir $HOME/testmarkdown/diary')
|
call system('mkdir $HOME/testmarkdown/diary')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Delete Hidden buffer, usefull to clean
|
|
||||||
" Stole from: https://stackoverflow.com/a/8459043/2544873
|
|
||||||
function! DeleteHiddenBuffers()
|
function! DeleteHiddenBuffers()
|
||||||
|
" Delete Hidden buffer, usefull to clean
|
||||||
|
" See: https://stackoverflow.com/a/8459043/2544873
|
||||||
let tpbl=[]
|
let tpbl=[]
|
||||||
call map(range(1, tabpagenr('$')), 'extend(tpbl, tabpagebuflist(v:val))')
|
call map(range(1, tabpagenr('$')), 'extend(tpbl, tabpagebuflist(v:val))')
|
||||||
for buf in filter(range(1, bufnr('$')), 'bufexists(v:val) && index(tpbl, v:val)==-1')
|
for buf in filter(range(1, bufnr('$')), 'bufexists(v:val) && index(tpbl, v:val)==-1')
|
||||||
@@ -206,14 +206,14 @@
|
|||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Write current file: helper to hide `set bt=`
|
|
||||||
function! WriteMe()
|
function! WriteMe()
|
||||||
|
" Write current file: helper to hide `set bt=`
|
||||||
set buftype=
|
set buftype=
|
||||||
write! %
|
write! %
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Delete a file <- path <string>
|
|
||||||
function! DeleteFile(path)
|
function! DeleteFile(path)
|
||||||
|
" Delete a file <- path <string>
|
||||||
let path = expand(a:path)
|
let path = expand(a:path)
|
||||||
" Delete file
|
" Delete file
|
||||||
try
|
try
|
||||||
@@ -225,8 +225,8 @@
|
|||||||
catch | endtry
|
catch | endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Print a command output to the buffer
|
|
||||||
function! PrintCommand(cmd)
|
function! PrintCommand(cmd)
|
||||||
|
" Print a command output to the buffer
|
||||||
redir => message
|
redir => message
|
||||||
silent execute a:cmd
|
silent execute a:cmd
|
||||||
redir END
|
redir END
|
||||||
@@ -237,21 +237,21 @@
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Destroy a variable is exists (unlet)
|
|
||||||
function! DestroyVar(var)
|
function! DestroyVar(var)
|
||||||
|
" Destroy a variable is exists (unlet)
|
||||||
if ! exists(a:var) | return | endif
|
if ! exists(a:var) | return | endif
|
||||||
execute 'unlet ' . a:var
|
execute 'unlet ' . a:var
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Assert current tab is desired tab
|
|
||||||
function! AssertTab(nr)
|
function! AssertTab(nr)
|
||||||
|
" Assert current tab is desired tab
|
||||||
" Vader is creating 2 tabs
|
" Vader is creating 2 tabs
|
||||||
AssertEqual a:nr + 2, tabpagenr()
|
AssertEqual a:nr + 2, tabpagenr()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Convert current buffer: wiki -> html
|
|
||||||
" No side effect (if no bug)
|
|
||||||
function! ConvertWiki2Html()
|
function! ConvertWiki2Html()
|
||||||
|
" Convert current buffer: wiki -> html
|
||||||
|
" No side effect (if no bug)
|
||||||
" Save fbuffer number (to come back)
|
" Save fbuffer number (to come back)
|
||||||
let g:buf_vader = bufnr('%')
|
let g:buf_vader = bufnr('%')
|
||||||
|
|
||||||
@@ -287,8 +287,8 @@
|
|||||||
call DeleteFile('$HOME/testwiki/test_Convert2Html.wiki')
|
call DeleteFile('$HOME/testwiki/test_Convert2Html.wiki')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Get only body
|
|
||||||
function! ConvertWiki2Body()
|
function! ConvertWiki2Body()
|
||||||
|
" Get only body
|
||||||
call ConvertWiki2Html()
|
call ConvertWiki2Html()
|
||||||
|
|
||||||
" Empty b register
|
" Empty b register
|
||||||
@@ -307,28 +307,47 @@
|
|||||||
0d
|
0d
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Get normalized syntax group: usefull for boldItalic Vs italicBold
|
|
||||||
" -- Here, Vader's SyntaxAt is not enough
|
|
||||||
" From: https://stackoverflow.com/questions/9464844
|
|
||||||
function! GetSyntaxGroup(line, col)
|
function! GetSyntaxGroup(line, col)
|
||||||
|
" Get normalized syntax group: usefull for boldItalic Vs italicBold
|
||||||
|
" -- Here, Vader's SyntaxAt is not enough
|
||||||
|
" From: https://stackoverflow.com/questions/9464844
|
||||||
let l:s = synID(a:line, a:col, 1)
|
let l:s = synID(a:line, a:col, 1)
|
||||||
return synIDattr(synIDtrans(l:s), 'name')
|
return synIDattr(synIDtrans(l:s), 'name')
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
" Debug helper
|
|
||||||
function! GetSyntaxStack()
|
function! GetSyntaxStack()
|
||||||
|
" Debug helper
|
||||||
if !exists('*synstack')
|
if !exists('*synstack')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
return map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
return map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Run Assert only if vim version higth enough
|
|
||||||
function! AssertIfVersion(version, one, two)
|
function! AssertIfVersion(version, one, two)
|
||||||
|
" Run Assert only if vim version higth enough
|
||||||
if v:version < a:version | return | endif
|
if v:version < a:version | return | endif
|
||||||
AssertEqual a:one, a:two
|
AssertEqual a:one, a:two
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! GetHighlightTerm(group, term)
|
||||||
|
" Get output of `hi group`
|
||||||
|
" From: https://vi.stackexchange.com/a/12294/5026
|
||||||
|
" Return list ['bold','underline']
|
||||||
|
" Store output of group to variable
|
||||||
|
let out = execute('hi ' . a:group)
|
||||||
|
|
||||||
|
" If links to, call parent
|
||||||
|
let parent = matchstr(out, 'links to *\zs[^ \t\n\r]*')
|
||||||
|
if parent !=# ''
|
||||||
|
" Return list_of_parent, parent
|
||||||
|
return GetHighlightTerm(parent, a:term)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Return the unique term we are looking for
|
||||||
|
let stg = matchstr(out, a:term.'=\zs[^ \t\n\r]*')
|
||||||
|
return split(stg, ',')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" Copy Wiki's Resources
|
" Copy Wiki's Resources
|
||||||
call CopyResources()
|
call CopyResources()
|
||||||
|
|||||||
Reference in New Issue
Block a user