From 28727b3971f8daa5e251e6d684942483e522fe0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 11 Oct 2018 14:25:55 +0200 Subject: [PATCH 1/3] Add %wiki_path% template variable. --- autoload/vimwiki/html.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim index bce5465..54a8346 100644 --- a/autoload/vimwiki/html.vim +++ b/autoload/vimwiki/html.vim @@ -1533,6 +1533,7 @@ function! s:convert_file(path_html, wikifile) let title = s:process_title(placeholders, fnamemodify(a:wikifile, ":t:r")) 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) @@ -1541,6 +1542,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, "%root_path%", "'. \ 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 = substitute(css_name, '\', '/', 'g') From 6f7e40ff781994564a680f402003178e8f7f95e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 21 Oct 2018 20:50:16 +0200 Subject: [PATCH 2/3] Add short documentation for %wiki_path%. --- doc/vimwiki.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index fcea9eb..01e3bfd 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -1475,6 +1475,14 @@ The date of the wiki page. The value can be used in the HTML template, see If you omit the date after the placeholder, the date of the HTML conversion is used. +------------------------------------------------------------------------------ +%wiki_path% *vimwiki-path* + +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. ============================================================================== 8. Lists *vimwiki-lists* From 6f687aff5257cb3867fe3f8586f6234e4c15ba54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 17 Mar 2019 22:22:55 +0100 Subject: [PATCH 3/3] Move location of %wiki_path% documentation. --- doc/vimwiki.txt | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt index 01e3bfd..c88d7a6 100644 --- a/doc/vimwiki.txt +++ b/doc/vimwiki.txt @@ -1475,14 +1475,6 @@ The date of the wiki page. The value can be used in the HTML template, see If you omit the date after the placeholder, the date of the HTML conversion is used. ------------------------------------------------------------------------------- -%wiki_path% *vimwiki-path* - -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. ============================================================================== 8. Lists *vimwiki-lists* @@ -2051,13 +2043,17 @@ Each template could look like: > where - %title% is replaced by a wiki page name or by a |vimwiki-title| - %date% is replaced with the current date or by |vimwiki-date| - %root_path% is replaced by a count of ../ for pages buried in subdirs: + `%title%` is replaced by a wiki page name or by a |vimwiki-title| + `%date%` is replaced with the current date or by |vimwiki-date| + `%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 - %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