Use new access functions for wiki-local variables -- part 2

Ref #256
This commit is contained in:
EinfachToll 2016-12-22 19:12:03 +01:00
parent 6221861957
commit 61910cd93a
5 changed files with 13 additions and 20 deletions

View File

@ -88,13 +88,13 @@ endfunction "}}}
function! s:template_full_name(name) "{{{ function! s:template_full_name(name) "{{{
if a:name == '' if a:name == ''
let name = VimwikiGet('template_default') let name = vimwiki#vars#get_wikilocal('template_default')
else else
let name = a:name let name = a:name
endif endif
let fname = expand(VimwikiGet('template_path'). let fname = expand(vimwiki#vars#get_wikilocal('template_path').
\ name.VimwikiGet('template_ext')) \ name . vimwiki#vars#get_wikilocal('template_ext'))
if filereadable(fname) if filereadable(fname)
return fname return fname
@ -1361,9 +1361,9 @@ function! vimwiki#html#CustomWiki2HTML(path, wikifile, force) "{{{
\ shellescape(a:path). ' '. \ shellescape(a:path). ' '.
\ shellescape(a:wikifile). ' '. \ shellescape(a:wikifile). ' '.
\ shellescape(s:default_CSS_full_name(a:path)). ' '. \ shellescape(s:default_CSS_full_name(a:path)). ' '.
\ (len(VimwikiGet('template_path')) > 1 ? shellescape(expand(VimwikiGet('template_path'))) : '-'). ' '. \ (len(vimwiki#vars#get_wikilocal('template_path')) > 1 ? shellescape(expand(vimwiki#vars#get_wikilocal('template_path'))) : '-'). ' '.
\ (len(VimwikiGet('template_default')) > 0 ? VimwikiGet('template_default') : '-'). ' '. \ (len(vimwiki#vars#get_wikilocal('template_default')) > 0 ? vimwiki#vars#get_wikilocal('template_default') : '-'). ' '.
\ (len(VimwikiGet('template_ext')) > 0 ? VimwikiGet('template_ext') : '-'). ' '. \ (len(vimwiki#vars#get_wikilocal('template_ext')) > 0 ? vimwiki#vars#get_wikilocal('template_ext') : '-'). ' '.
\ (len(VimwikiGet('subdir')) > 0 ? shellescape(s:root_path(VimwikiGet('subdir'))) : '-')) \ (len(VimwikiGet('subdir')) > 0 ? shellescape(s:root_path(VimwikiGet('subdir'))) : '-'))
endfunction " }}} endfunction " }}}

View File

@ -101,6 +101,7 @@ function! s:populate_wikilocal_options()
\ 'auto_export': 0, \ 'auto_export': 0,
\ 'auto_tags': 0, \ 'auto_tags': 0,
\ 'auto_toc': 0, \ 'auto_toc': 0,
\ 'automatic_nested_syntaxes': 1,
\ 'css_name': 'style.css', \ 'css_name': 'style.css',
\ 'custom_wiki2html': '', \ 'custom_wiki2html': '',
\ 'diary_header': 'Diary', \ 'diary_header': 'Diary',

View File

@ -639,7 +639,7 @@ nnoremap <silent><buffer> <Plug>VimwikiRemoveHeaderLevel :
" KEYBINDINGS }}} " KEYBINDINGS }}}
" AUTOCOMMANDS {{{ " AUTOCOMMANDS {{{
if VimwikiGet('auto_export') if vimwiki#vars#get_wikilocal('auto_export')
" Automatically generate HTML on page write. " Automatically generate HTML on page write.
augroup vimwiki augroup vimwiki
au BufWritePost <buffer> au BufWritePost <buffer>
@ -648,7 +648,7 @@ if VimwikiGet('auto_export')
augroup END augroup END
endif endif
if VimwikiGet('auto_toc') if vimwiki#vars#get_wikilocal('auto_toc')
" Automatically update the TOC *before* the file is written " Automatically update the TOC *before* the file is written
augroup vimwiki augroup vimwiki
au BufWritePre <buffer> call vimwiki#base#table_of_contents(0) au BufWritePre <buffer> call vimwiki#base#table_of_contents(0)

View File

@ -42,8 +42,8 @@ endfunction "}}}
function! Validate_wiki_options(idx) " {{{ function! Validate_wiki_options(idx) " {{{
call VimwikiSet('path', s:normalize_path(VimwikiGet('path', a:idx)), a:idx) call VimwikiSet('path', s:normalize_path(VimwikiGet('path', a:idx)), a:idx)
call VimwikiSet('path_html', s:normalize_path(s:path_html(a:idx)), a:idx) call VimwikiSet('path_html', s:normalize_path(s:path_html(a:idx)), a:idx)
call VimwikiSet('template_path', call vimwiki#vars#set_wikilocal('template_path',
\ s:normalize_path(VimwikiGet('template_path', a:idx)), a:idx) \ s:normalize_path(vimwiki#vars#get_wikilocal('template_path', a:idx)), a:idx)
call vimwiki#vars#set_wikilocal('diary_rel_path', call vimwiki#vars#set_wikilocal('diary_rel_path',
\ s:normalize_path(vimwiki#vars#get_wikilocal('diary_rel_path', a:idx)), a:idx) \ s:normalize_path(vimwiki#vars#get_wikilocal('diary_rel_path', a:idx)), a:idx)
endfunction " }}} endfunction " }}}
@ -328,14 +328,6 @@ let s:vimwiki_defaults.ext = '.wiki'
let s:vimwiki_defaults.maxhi = 0 let s:vimwiki_defaults.maxhi = 0
let s:vimwiki_defaults.syntax = 'default' let s:vimwiki_defaults.syntax = 'default'
let s:vimwiki_defaults.template_path = '~/vimwiki/templates/'
let s:vimwiki_defaults.template_default = 'default'
let s:vimwiki_defaults.template_ext = '.tpl'
let s:vimwiki_defaults.nested_syntaxes = {}
let s:vimwiki_defaults.automatic_nested_syntaxes = 1
let s:vimwiki_defaults.auto_export = 0
let s:vimwiki_defaults.auto_toc = 0
" is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki " is wiki temporary -- was added to g:vimwiki_list by opening arbitrary wiki
" file. " file.
let s:vimwiki_defaults.temp = 0 let s:vimwiki_defaults.temp = 0

View File

@ -572,8 +572,8 @@ call vimwiki#u#reload_regexes_custom()
let b:current_syntax="vimwiki" let b:current_syntax="vimwiki"
" EMBEDDED syntax setup "{{{ " EMBEDDED syntax setup "{{{
let s:nested = VimwikiGet('nested_syntaxes') let s:nested = vimwiki#vars#get_wikilocal('nested_syntaxes')
if VimwikiGet('automatic_nested_syntaxes') if vimwiki#vars#get_wikilocal('automatic_nested_syntaxes')
let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax(), "keep") let s:nested = extend(s:nested, vimwiki#base#detect_nested_syntax(), "keep")
endif endif
if !empty(s:nested) if !empty(s:nested)