Test: Add option to configure date string format #1073
This commit is contained in:
@@ -118,14 +118,20 @@ endfunction
|
||||
|
||||
|
||||
function! s:template_full_name(name) abort
|
||||
if a:name ==? ''
|
||||
let name = vimwiki#vars#get_wikilocal('template_default')
|
||||
else
|
||||
let name = a:name
|
||||
if name ==? ''
|
||||
let name = vimwiki#vars#get_wikilocal('template_default')
|
||||
endif
|
||||
|
||||
let fname = expand(vimwiki#vars#get_wikilocal('template_path').
|
||||
\ name . vimwiki#vars#get_wikilocal('template_ext'))
|
||||
" Suffix Path by a / is not
|
||||
let path = vimwiki#vars#get_wikilocal('template_path')
|
||||
if strridx(path, '/') +1 != len(path)
|
||||
let path .= '/'
|
||||
endif
|
||||
|
||||
let ext = vimwiki#vars#get_wikilocal('template_ext')
|
||||
|
||||
let fname = expand(path . name . ext)
|
||||
|
||||
if filereadable(fname)
|
||||
return fname
|
||||
|
||||
@@ -1286,7 +1286,6 @@ endfunction
|
||||
" 4. Command (exported) {{{1
|
||||
" ----------------------------------------------------------
|
||||
|
||||
|
||||
function! s:get_anywhere(key, ...) abort
|
||||
" Get variable anywhere
|
||||
" Returns: [value, location] where loc=global|wikilocal|syntaxlocal|bufferlocal|none
|
||||
@@ -1390,7 +1389,7 @@ endfunction
|
||||
|
||||
function! vimwiki#vars#cmd(arg) abort
|
||||
" Set or Get a vimwiki variable
|
||||
" :param: (1) key <string> [space] value <string>
|
||||
" :param: (1) <string> command parameter: key [space] value
|
||||
" -- name of the variable [space] value to evaluate and set the variable
|
||||
" Called: VimwikiVar
|
||||
" Get key and value
|
||||
|
||||
+2
-1
@@ -240,8 +240,9 @@ reasons for such a complex system is:
|
||||
|
||||
* [Vimwiki syntax specification](./specification.wiki)
|
||||
* [Syntax region](../syntax/vimwiki.vim)
|
||||
* [Nesting manager]( ../autoload/vimwiki/u.vim): vimwiki#u#hi_typeface(dic)
|
||||
|
||||
TODO currently the typeface delmiters are customized that way:
|
||||
TODO currently the typeface delimiters are customized that way:
|
||||
|
||||
```vim
|
||||
" Typeface: -> u.vim
|
||||
|
||||
@@ -280,7 +280,33 @@ Expect (Plain Html):
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
Execute (Delete):
|
||||
call DeleteFile('$HOME/testwiki/TestHtml.wiki')
|
||||
|
||||
|
||||
Given vimwiki (PR: Add option to configure date string format 1073) {{{1):
|
||||
%template template_1073
|
||||
content
|
||||
|
||||
Do (template_date_format):
|
||||
# Set conf
|
||||
:let g:vimwiki_wikilocal_vars[0]['template_date_format'] = '%b %d, %Y'\<Cr>
|
||||
# Convert
|
||||
:call ConvertWiki2Html()\<Cr>
|
||||
# Erase oth and date
|
||||
:%s/[0-9]\+/Z/g\<Cr>
|
||||
:%s/[A-Z][a-z][a-z]/Z/g\<Cr>
|
||||
# Restore peace
|
||||
:let g:vimwiki_wikilocal_vars[0]['template_date_format'] = ''\<Cr>
|
||||
|
||||
Expect (Date proper format):
|
||||
<html>
|
||||
<body>
|
||||
<div class="content">
|
||||
<p><small>Zt updated on Z Z, Z</small></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
# vim: sw=2 foldmethod=marker foldlevel=30
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
<div class="content">
|
||||
<p><small>Last updated on %date%</small></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+2
-2
@@ -1,8 +1,7 @@
|
||||
" TODO treat if local (see $HOME in all tests)
|
||||
" TODO mutualise call CopyResources()
|
||||
" TODO mutualise (to prettify output) mode(1) to check if in -Es or not
|
||||
" TODO test tabnext in at least one travis job (without -Es)
|
||||
" TODO (idea) fasten travis difefrent job with the same vimwiki git (-8s)
|
||||
" IDEA fasten travis difefrent job with the same vimwiki git (-8s)
|
||||
|
||||
" Declare tipical Vim preambule
|
||||
" vint: -ProhibitSetNoCompatible
|
||||
@@ -29,6 +28,7 @@
|
||||
let vimwiki_default = {}
|
||||
let vimwiki_default.path = $HOME . '/testwiki'
|
||||
let vimwiki_default.path_html = $HOME . '/html/default'
|
||||
let vimwiki_default.template_path = $HOME . '/testwiki/templates/'
|
||||
let vimwiki_default.syntax = 'default'
|
||||
let vimwiki_default.ext = '.wiki'
|
||||
let vimwiki_default.name = 'DefaultSyntax'
|
||||
|
||||
Reference in New Issue
Block a user