Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
0c82d9dcb8
5
DesignNotes.wiki
Normal file
5
DesignNotes.wiki
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
= Design Notes =
|
||||||
|
|
||||||
|
This file is meant to document design decisions and algorithms inside vimwiki
|
||||||
|
which are too large for code comments, and not necessarily interesting to
|
||||||
|
users. Please create a new section to document each behavior.
|
@ -1618,7 +1618,10 @@ function! vimwiki#base#TO_table_col(inner, visual)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#base#AddHeaderLevel()
|
function! vimwiki#base#AddHeaderLevel(...)
|
||||||
|
if a:1 > 1
|
||||||
|
call vimwiki#base#AddHeaderLevel(a:1 - 1)
|
||||||
|
endif
|
||||||
let lnum = line('.')
|
let lnum = line('.')
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
let rxHdr = vimwiki#vars#get_syntaxlocal('rxH')
|
let rxHdr = vimwiki#vars#get_syntaxlocal('rxH')
|
||||||
@ -1646,7 +1649,10 @@ function! vimwiki#base#AddHeaderLevel()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
function! vimwiki#base#RemoveHeaderLevel()
|
function! vimwiki#base#RemoveHeaderLevel(...)
|
||||||
|
if a:1 > 1
|
||||||
|
call vimwiki#base#RemoveHeaderLevel(a:1 - 1)
|
||||||
|
endif
|
||||||
let lnum = line('.')
|
let lnum = line('.')
|
||||||
let line = getline(lnum)
|
let line = getline(lnum)
|
||||||
let rxHdr = vimwiki#vars#get_syntaxlocal('rxH')
|
let rxHdr = vimwiki#vars#get_syntaxlocal('rxH')
|
||||||
|
@ -344,7 +344,27 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! s:tag_code(value)
|
function! s:tag_code(value)
|
||||||
return '<code>'.s:safe_html_preformatted(s:mid(a:value, 1)).'</code>'
|
let l:retstr = '<code'
|
||||||
|
|
||||||
|
let l:str = s:mid(a:value, 1)
|
||||||
|
let l:match = match(l:str, '^#[a-fA-F0-9]\{6\}$')
|
||||||
|
|
||||||
|
if l:match != -1
|
||||||
|
let l:r = eval("0x".l:str[1:2])
|
||||||
|
let l:g = eval("0x".l:str[3:4])
|
||||||
|
let l:b = eval("0x".l:str[5:6])
|
||||||
|
|
||||||
|
let l:fg_color =
|
||||||
|
\ (((0.299 * r + 0.587 * g + 0.114 * b) / 0xFF) > 0.5)
|
||||||
|
\ ? "black" : "white"
|
||||||
|
|
||||||
|
let l:retstr .=
|
||||||
|
\ " style='background-color:" . l:str .
|
||||||
|
\ ";color:" . l:fg_color . ";'"
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:retstr .= '>'.s:safe_html_preformatted(l:str).'</code>'
|
||||||
|
return l:retstr
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
@ -1529,6 +1549,7 @@ function! s:convert_file(path_html, wikifile)
|
|||||||
|
|
||||||
let title = s:process_title(placeholders, fnamemodify(a:wikifile, ":t:r"))
|
let title = s:process_title(placeholders, fnamemodify(a:wikifile, ":t:r"))
|
||||||
let date = s:process_date(placeholders, strftime('%Y-%m-%d'))
|
let date = s:process_date(placeholders, strftime('%Y-%m-%d'))
|
||||||
|
let wiki_path = strpart(s:current_wiki_file, strlen(vimwiki#vars#get_wikilocal('path')))
|
||||||
|
|
||||||
let html_lines = s:get_html_template(template_name)
|
let html_lines = s:get_html_template(template_name)
|
||||||
|
|
||||||
@ -1537,6 +1558,7 @@ function! s:convert_file(path_html, wikifile)
|
|||||||
call map(html_lines, 'substitute(v:val, "%date%", "'. date .'", "g")')
|
call map(html_lines, 'substitute(v:val, "%date%", "'. date .'", "g")')
|
||||||
call map(html_lines, 'substitute(v:val, "%root_path%", "'.
|
call map(html_lines, 'substitute(v:val, "%root_path%", "'.
|
||||||
\ s:root_path(vimwiki#vars#get_bufferlocal('subdir')) .'", "g")')
|
\ s:root_path(vimwiki#vars#get_bufferlocal('subdir')) .'", "g")')
|
||||||
|
call map(html_lines, 'substitute(v:val, "%wiki_path%", "'. wiki_path .'", "g")')
|
||||||
|
|
||||||
let css_name = expand(vimwiki#vars#get_wikilocal('css_name'))
|
let css_name = expand(vimwiki#vars#get_wikilocal('css_name'))
|
||||||
let css_name = substitute(css_name, '\', '/', 'g')
|
let css_name = substitute(css_name, '\', '/', 'g')
|
||||||
|
@ -892,6 +892,12 @@ For Markdown syntax these variations are used: >
|
|||||||
Furthermore, there are a number of words which are highlighted extra flashy:
|
Furthermore, there are a number of words which are highlighted extra flashy:
|
||||||
TODO, DONE, STARTED, FIXME, FIXED, XXX.
|
TODO, DONE, STARTED, FIXME, FIXED, XXX.
|
||||||
|
|
||||||
|
When rendered as HTML, code blocks containing only a hash prefixed 6 digit hex
|
||||||
|
number will be colored as themselves. For example >
|
||||||
|
`#ffe119`
|
||||||
|
Becomes >
|
||||||
|
<code style='background-color:#ffe119;color:black;'>#ffe119</code>
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
5.2. Links *vimwiki-syntax-links*
|
5.2. Links *vimwiki-syntax-links*
|
||||||
|
|
||||||
@ -2064,13 +2070,17 @@ Each template could look like: >
|
|||||||
</html>
|
</html>
|
||||||
|
|
||||||
where
|
where
|
||||||
%title% is replaced by a wiki page name or by a |vimwiki-title|
|
`%title%` is replaced by a wiki page name or by a |vimwiki-title|
|
||||||
%date% is replaced with the current date or by |vimwiki-date|
|
`%date%` is replaced with the current date or by |vimwiki-date|
|
||||||
%root_path% is replaced by a count of ../ for pages buried in subdirs:
|
`%root_path%` is replaced by a count of ../ for pages buried in subdirs:
|
||||||
if you have wikilink [[dir1/dir2/dir3/my page in a subdir]] then
|
if you have wikilink [[dir1/dir2/dir3/my page in a subdir]] then
|
||||||
%root_path% is replaced by '../../../'.
|
`%root_path%` is replaced by '../../../'.
|
||||||
|
`%wiki_path%` Path to current wiki-file.` The file path to the current wiki
|
||||||
|
file. For example, if you are on page a/b.wiki %wiki-path% contains
|
||||||
|
"a/b.wiki". Mostly useful if you want to link the to raw wiki page from
|
||||||
|
the rendered version.
|
||||||
|
|
||||||
%content% is replaced by a wiki file content.
|
`%content%` is replaced by a wiki file content.
|
||||||
|
|
||||||
|
|
||||||
The default template will be applied to all wiki pages unless a page specifies
|
The default template will be applied to all wiki pages unless a page specifies
|
||||||
|
@ -635,13 +635,14 @@ vnoremap <silent><buffer> il :<C-U>call vimwiki#lst#TO_list_item(1, 1)<CR>
|
|||||||
if !hasmapto('<Plug>VimwikiAddHeaderLevel')
|
if !hasmapto('<Plug>VimwikiAddHeaderLevel')
|
||||||
nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel
|
nmap <silent><buffer> = <Plug>VimwikiAddHeaderLevel
|
||||||
endif
|
endif
|
||||||
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :<C-U>call vimwiki#base#AddHeaderLevel()<CR>
|
nnoremap <silent><buffer> <Plug>VimwikiAddHeaderLevel :
|
||||||
|
\<C-U>call vimwiki#base#AddHeaderLevel(v:count)<CR>
|
||||||
|
|
||||||
if !hasmapto('<Plug>VimwikiRemoveHeaderLevel')
|
if !hasmapto('<Plug>VimwikiRemoveHeaderLevel')
|
||||||
nmap <silent><buffer> - <Plug>VimwikiRemoveHeaderLevel
|
nmap <silent><buffer> - <Plug>VimwikiRemoveHeaderLevel
|
||||||
endif
|
endif
|
||||||
nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
|
nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
|
||||||
\<C-U>call vimwiki#base#RemoveHeaderLevel()<CR>
|
\<C-U>call vimwiki#base#RemoveHeaderLevel(v:count)<CR>
|
||||||
|
|
||||||
if !hasmapto('<Plug>VimwikiGoToParentHeader')
|
if !hasmapto('<Plug>VimwikiGoToParentHeader')
|
||||||
nmap <silent><buffer> ]u <Plug>VimwikiGoToParentHeader
|
nmap <silent><buffer> ]u <Plug>VimwikiGoToParentHeader
|
||||||
|
Loading…
Reference in New Issue
Block a user