Add option to configure date string format

This commit is contained in:
yhu266
2020-12-28 17:27:54 -08:00
committed by Tinmarino
parent 8c7937c765
commit 036a7d24f9
3 changed files with 18 additions and 2 deletions
+1 -1
View File
@@ -1803,7 +1803,7 @@ function! s:convert_file_to_lines(wikifile, current_html_file) abort
let result['template_name'] = template_name
let result['title'] = s:process_title(placeholders, fnamemodify(a:wikifile, ':t:r'))
let result['date'] = s:process_date(placeholders, strftime('%Y-%m-%d'))
let result['date'] = s:process_date(placeholders, strftime(vimwiki#vars#get_wikilocal('template_date_format')))
let result['wiki_path'] = strpart(s:current_wiki_file, strlen(vimwiki#vars#get_wikilocal('path')))
return result
+1
View File
@@ -522,6 +522,7 @@ function! s:get_default_wikilocal() abort
\ 'template_default': {'type': type(''), 'default': 'default', 'min_length': 1},
\ 'template_ext': {'type': type(''), 'default': '.tpl'},
\ 'template_path': {'type': type(''), 'default': $HOME . '/vimwiki/templates/'},
\ 'template_date_format': {'type': type(''), 'default': '%Y-%m-%d'},
\ 'text_ignore_newline': {'type': type(0), 'default': 1, 'min': 0, 'max': 1},
\ 'tag_format': {'type': type({}), 'default': {
\ 'pre': '^\|\s',
+16 -1
View File
@@ -1691,7 +1691,8 @@ See |vimwiki-option-template_path| for details.
%date *vimwiki-date*
The date of the wiki page. The value can be used in the HTML template, see
|vimwiki-option-template_path| for details.
|vimwiki-option-template_path| for details. To set a specific date string
format, see |vimwiki-option-template_date_format| for details.
%date 2017-07-08
%date
@@ -2375,6 +2376,17 @@ Setup template filename extension.
See |vimwiki-option-template_path| for details.
*vimwiki-option-template_date_format*
------------------------------------------------------------------------------
Key Default value~
template_date_format %Y-%m-%d
Description~
Setup date string format in templates.
See |vimwiki-date| for details.
*vimwiki-option-css_name*
------------------------------------------------------------------------------
Key Default value~
@@ -3865,6 +3877,7 @@ Contributors and their Github usernames in roughly chronological order:
- Rajesh Sharem (@deepredsky)
- Amit Beka (@amitbeka)
- Yuuy Wei
- Yifan Hu (@yhu266)
==============================================================================
16. Changelog *vimwiki-changelog*
@@ -3876,6 +3889,8 @@ http://code.google.com/p/vimwiki/issues/list. They may be accessible from
https://github.com/vimwiki-backup/vimwiki/issues.
New:~
* Feature: Add option |vimwiki-option-template_date_format| to configure
alternative date string format
* Feature: PR #686: add a flag lists_return to disable mappings
to <CR> and <S-CR> in insert mode
* Feature: enable re-mapping insert mode table mappings