From 52634a6753d4745bbd63052e23508562782affd9 Mon Sep 17 00:00:00 2001 From: EinfachToll Date: Tue, 10 Nov 2015 14:37:25 +0100 Subject: [PATCH] add HTML processing for tags Ref #85 --- autoload/vimwiki/html.vim | 22 ++++++++++++++++++++++ autoload/vimwiki/style.css | 1 + 2 files changed, 23 insertions(+) diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim index 60f77f9..43c9603 100644 --- a/autoload/vimwiki/html.vim +++ b/autoload/vimwiki/html.vim @@ -289,6 +289,27 @@ function! s:tag_strong(value, header_ids) "{{{ \ .id.'">'.text.'' endfunction "}}} +function! s:tag_tags(value, header_ids) "{{{ + let complete_id = '' + for level in range(6) + if a:header_ids[level][0] != '' + let complete_id .= a:header_ids[level][0].'-' + endif + endfor + if a:header_ids[5][0] == '' + let complete_id = complete_id[:-2] + endif + let complete_id = s:safe_html_anchor(complete_id) + + let result = [] + for tag in split(a:value, ':') + let id = s:safe_html_anchor(tag) + call add(result, ''.tag.'') + endfor + return join(result) +endfunction "}}} + function! s:tag_todo(value) "{{{ return ''.a:value.'' endfunction "}}} @@ -552,6 +573,7 @@ function! s:process_tags_typefaces(line, header_ids) "{{{ let line = s:make_tag(line, g:vimwiki_rxSubScript, 's:tag_sub') let line = s:make_tag(line, g:vimwiki_rxCode, 's:tag_code') let line = s:make_tag(line, g:vimwiki_rxEqIn, 's:tag_eqin') + let line = s:make_tag(line, g:vimwiki_rxTags, 's:tag_tags', a:header_ids) return line endfunction " }}} diff --git a/autoload/vimwiki/style.css b/autoload/vimwiki/style.css index 752867b..b9d1c02 100644 --- a/autoload/vimwiki/style.css +++ b/autoload/vimwiki/style.css @@ -24,6 +24,7 @@ del {text-decoration: line-through; color: #777777;} .justright {text-align: right;} .justcenter {text-align: center;} .center {margin-left: auto; margin-right: auto;} +.tag {background-color: #eeeeee; font-family: monospace; padding: 2px;} /* classes for items of todo lists */ .done0 {