This commit is contained in:
EinfachToll 2017-02-19 21:53:34 +01:00
commit ed7230707d
8 changed files with 36 additions and 15 deletions

View File

@ -860,7 +860,11 @@ function! s:process_tag_list(line, lists) "{{{
let chk = matchlist(a:line, a:rx_list)
if !empty(chk) && len(chk[1]) > 0
let completion = index(g:vimwiki_listsyms_list, chk[1])
if completion >= 0 && completion <=4
let n = len(g:vimwiki_listsyms_list)
if completion == 0
let st_tag = '<li class="done0">'
elseif completion > 0 && completion < n
let completion = float2nr(round(completion / (n-1.0) * 3.0 + 0.5 ))
let st_tag = '<li class="done'.completion.'">'
endif
endif
@ -979,7 +983,11 @@ function! s:process_tag_para(line, para) "{{{
let para = 1
endif
let processed = 1
if g:vimwiki_text_ignore_newline == 1
call add(lines, a:line)
else
call add(lines, a:line."<br />")
endif
elseif para && a:line =~# '^\s*$'
call add(lines, "</p>")
let para = 0

View File

@ -693,7 +693,8 @@ function! s:get_rate(item) "{{{
return -1
endif
let state = a:item.cb
return index(g:vimwiki_listsyms_list, state) * 25
let n=len(g:vimwiki_listsyms_list)
return index(g:vimwiki_listsyms_list, state) * 100/(n-1)
endfunction "}}}
"Set state of the list item to [ ] or [o] or whatever
@ -729,16 +730,14 @@ endfunction "}}}
"Returns: the appropriate symbol for a given percent rate
function! s:rate_to_state(rate) "{{{
let state = ''
let n=len(g:vimwiki_listsyms_list)
if a:rate == 100
let state = g:vimwiki_listsyms_list[4]
let state = g:vimwiki_listsyms_list[n-1]
elseif a:rate == 0
let state = g:vimwiki_listsyms_list[0]
elseif a:rate >= 67
let state = g:vimwiki_listsyms_list[3]
elseif a:rate >= 34
let state = g:vimwiki_listsyms_list[2]
else
let state = g:vimwiki_listsyms_list[1]
let index = float2nr(ceil(a:rate/100.0*(n-2)))
let state = g:vimwiki_listsyms_list[index]
endif
return state
endfunction "}}}

View File

@ -2255,11 +2255,11 @@ Default: 'Vimwiki'
------------------------------------------------------------------------------
*g:vimwiki_listsyms*
String of 5 symbols to show the progression of todo list items.
String of at least two symbols to show the progression of todo list items.
Default value is ' .oOX'.
The first char is for 0% done items.
The fifth is for 100% done items.
The last is for 100% done items.
You can set it to some more fancy symbols like this:
>
@ -2312,6 +2312,19 @@ Value Description~
Default: 1
------------------------------------------------------------------------------
*g:vimwiki_text_ignore_newline*
This is HTML related.
Convert newlines to <br />s in text.
Value Description~
0 Newlines in text are converted to <br />s.
1 Ignore newlines.
Default: 1
------------------------------------------------------------------------------
*g:vimwiki_use_calendar*

View File

@ -369,6 +369,7 @@ call s:default('ext2syntax', {}) " syntax map keyed on extension
call s:default('hl_headers', 0)
call s:default('hl_cb_checked', 0)
call s:default('list_ignore_newline', 1)
call s:default('text_ignore_newline', 1)
call s:default('listsyms', ' .oOX')
call s:default('use_calendar', 1)
call s:default('table_mappings', 1)

View File

@ -413,7 +413,7 @@ execute 'syntax match VimwikiList /'.g:vimwiki_rxListDefine.'/'
execute 'syntax match VimwikiListTodo /'.g:vimwiki_rxListItem.'/'
if g:vimwiki_hl_cb_checked == 1
execute 'syntax match VimwikiCheckBoxDone /'.g:vimwiki_rxListItemWithoutCB.'\s*\['.g:vimwiki_listsyms_list[4].'\]\s.*$/ '.
execute 'syntax match VimwikiCheckBoxDone /'.g:vimwiki_rxListItemWithoutCB.'\s*\['.g:vimwiki_listsyms_list[-1].'\]\s.*$/ '.
\ 'contains=VimwikiNoExistsLink,VimwikiLink,@Spell'
elseif g:vimwiki_hl_cb_checked == 2
execute 'syntax match VimwikiCheckBoxDone /'.g:vimwiki_rxListItemAndChildren.'/ contains=VimwikiNoExistsLink,VimwikiLink,@Spell'

View File

@ -80,7 +80,7 @@ call vimwiki#lst#setup_marker_infos()
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.g:vimwiki_listsyms.']\)\]\s\)\?'
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms_list[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms_list[-1].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
" Preformatted text
let g:vimwiki_rxPreStart = '{{{'

View File

@ -77,7 +77,7 @@ call vimwiki#lst#setup_marker_infos()
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.g:vimwiki_listsyms.']\)\]\s\)\?'
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms_list[4].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
let g:vimwiki_rxListItemAndChildren = '^\(\s*\)\%('.g:vimwiki_rxListBullet.'\|'.g:vimwiki_rxListNumber.'\)\s\+\['.g:vimwiki_listsyms_list[-1].'\]\s.*\%(\n\%(\1\s.*\|^$\)\)*'
" Preformatted text
let g:vimwiki_rxPreStart = '```'

View File

@ -58,7 +58,7 @@ call vimwiki#lst#setup_marker_infos()
let g:vimwiki_rxListItemWithoutCB = '^\s*\%(\('.g:vimwiki_rxListBullet.'\)\|\('.g:vimwiki_rxListNumber.'\)\)\s'
let g:vimwiki_rxListItem = g:vimwiki_rxListItemWithoutCB . '\+\%(\[\(['.g:vimwiki_listsyms.']\)\]\s\)\?'
let g:vimwiki_rxListItemAndChildren = '^\('.g:vimwiki_rxListBullet.'\)\s\+\['.g:vimwiki_listsyms_list[4].'\]\s.*\%(\n\%(\1\%('.g:vimwiki_rxListBullet.'\).*\|^$\|\s.*\)\)*'
let g:vimwiki_rxListItemAndChildren = '^\('.g:vimwiki_rxListBullet.'\)\s\+\['.g:vimwiki_listsyms_list[-1].'\]\s.*\%(\n\%(\1\%('.g:vimwiki_rxListBullet.'\).*\|^$\|\s.*\)\)*'
" Preformatted text
let g:vimwiki_rxPreStart = '<pre>'