commit 867d81a50cc3b8cbe09966445ef0b8d103c052a7
parent 6a0210c6441b46bc07bcb19c58b835c3bb3e9cd7
Author: kaphula <vaaka@protonmail.com>
Date: Sun, 24 Nov 2019 18:51:51 +0200
Added new feature to insert plaintext to the final html conversion file.
Diffstat:
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim
@@ -1223,6 +1223,42 @@ function! s:parse_line(line, state) abort
let processed = 0
+ if !processed
+ " allows insertion of plain text to the final html conversion
+ " for example:
+ " %plainhtml <div class="mycustomdiv">
+ " inserts that line to the final html file (without %plainhtml prefix)
+ let trigger = '%plainhtml'
+ if line =~# '^\s*' . trigger
+ let lines = []
+ let processed = 1
+
+ " if something precedes the plain text line,
+ " make sure everything gets closed properly
+ " before inserting plain text. this ensures that
+ " the plain text is not considered as
+ " part of the preceding structure
+ if processed && len(state.table)
+ let state.table = s:close_tag_table(state.table, lines, state.header_ids)
+ endif
+ if processed && state.deflist
+ let state.deflist = s:close_tag_def_list(state.deflist, lines)
+ endif
+ if processed && state.quote
+ let state.quote = s:close_tag_quote(state.quote, lines)
+ endif
+ if processed && state.para
+ let state.para = s:close_tag_para(state.para, lines)
+ endif
+
+ " remove the trigger prefix
+ let pp = split(line, trigger)[0]
+
+ call add(lines, pp)
+ call extend(res_lines, lines)
+ endif
+ endif
+
" pres
if !processed
let [processed, lines, state.pre] = s:process_tag_pre(line, state.pre)
diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt
@@ -3487,6 +3487,7 @@ Contributors and their Github usernames in roughly chronological order:
- Dave Gauer (@ratfactor)
- Martin Tourneboeuf (@tinmarino)
- Mauro Morales (@mauromorales)
+ - Valtteri Vallius (@kaphula)
==============================================================================