commit 52634a6753d4745bbd63052e23508562782affd9
parent 642a94ffaedc68f7ea63df16a3a946927805aa95
Author: EinfachToll <istjanichtzufassen@googlemail.com>
Date: Tue, 10 Nov 2015 14:37:25 +0100
add HTML processing for tags
Ref #85
Diffstat:
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim
@@ -289,6 +289,27 @@ function! s:tag_strong(value, header_ids) "{{{
\ .id.'">'.text.'</strong>'
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, '<span id="'.complete_id.'-'.id.'"></span><span class="tag" id="'
+ \ .id.'">'.tag.'</span>')
+ endfor
+ return join(result)
+endfunction "}}}
+
function! s:tag_todo(value) "{{{
return '<span class="todo">'.a:value.'</span>'
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
@@ -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 {