Fix: Html convertion: Blockquote: multiline and in number list (Issue #55)
- Issue 5 indented multiline Transoform blockquotes by precode ``` <blockquote> Block quote line 1 Block quote line 2 </blockquote> ``` -> ``` <pre><code>line 1 line 2 </code></pre> ``` - Issue 2: BlockQuote restarts list numbering Allow indent precode in list
This commit is contained in:
parent
8e5274b1a2
commit
dc63a5dacc
@ -690,9 +690,9 @@ function! s:close_tag_math(math, ldest) abort
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:close_tag_quote(quote, ldest) abort
|
||||
function! s:close_tag_precode(quote, ldest) abort
|
||||
if a:quote
|
||||
call insert(a:ldest, '</blockquote>')
|
||||
call insert(a:ldest, '</pre></code>')
|
||||
return 0
|
||||
endif
|
||||
return a:quote
|
||||
@ -942,21 +942,30 @@ function! s:process_tag_math(line, math) abort
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:process_tag_quote(line, quote) abort
|
||||
function! s:process_tag_precode(line, quote) abort
|
||||
" Process indented precode
|
||||
let lines = []
|
||||
let line = a:line
|
||||
let quote = a:quote
|
||||
let processed = 0
|
||||
if a:line =~# '^\s\{4,}\S'
|
||||
|
||||
" Check if start
|
||||
if line =~# '^\s\{4,}'
|
||||
let line = substitute(line, '^\s*', '', '')
|
||||
if !quote
|
||||
call add(lines, '<blockquote>')
|
||||
" Check if must decrease level
|
||||
let line = '<pre><code>' . line
|
||||
let quote = 1
|
||||
endif
|
||||
let processed = 1
|
||||
call add(lines, substitute(a:line, '^\s*', '', ''))
|
||||
call add(lines, line)
|
||||
|
||||
" Check if end
|
||||
elseif quote
|
||||
call add(lines, '</blockquote>')
|
||||
call add(lines, '</code></pre>')
|
||||
let quote = 0
|
||||
endif
|
||||
|
||||
return [processed, lines, quote]
|
||||
endfunction
|
||||
|
||||
@ -964,23 +973,33 @@ function! s:process_tag_arrow_quote(line, arrow_quote) abort
|
||||
let lines = []
|
||||
let arrow_quote = a:arrow_quote
|
||||
let processed = 0
|
||||
if a:line =~# '^\s*>'
|
||||
if !arrow_quote
|
||||
let line = a:line
|
||||
|
||||
" Check if must increase level
|
||||
if line =~# '^' . repeat('\s*>', arrow_quote + 1)
|
||||
" Increase arrow_quote
|
||||
while line =~# '^' . repeat('\s*>', arrow_quote + 1)
|
||||
call add(lines, '<blockquote>')
|
||||
call add(lines, '<p>')
|
||||
let arrow_quote = 1
|
||||
endif
|
||||
let processed = 1
|
||||
let stripped_line = substitute(a:line, '^\s*>\s*', '', '')
|
||||
let arrow_quote .= 1
|
||||
endwhile
|
||||
|
||||
" Treat & Add line
|
||||
let stripped_line = substitute(a:line, '^\%(\s*>\)\+', '', '')
|
||||
if stripped_line =~# '^\s*$'
|
||||
call add(lines, '</p>')
|
||||
call add(lines, '<p>')
|
||||
endif
|
||||
call add(lines, stripped_line)
|
||||
elseif arrow_quote
|
||||
call add(lines, '</p>')
|
||||
call add(lines, '</blockquote>')
|
||||
let arrow_quote = 0
|
||||
let processed = 1
|
||||
|
||||
" Check if must decrease level
|
||||
elseif arrow_quote > 0
|
||||
while line !~# '^' . repeat('\s*>', arrow_quote - 1)
|
||||
call add(lines, '</p>')
|
||||
call add(lines, '</blockquote>')
|
||||
let arrow_quote -= 1
|
||||
endwhile
|
||||
endif
|
||||
return [processed, lines, arrow_quote]
|
||||
endfunction
|
||||
@ -1038,6 +1057,26 @@ function! s:process_tag_list(line, lists) abort
|
||||
let lstRegExp = ''
|
||||
endif
|
||||
|
||||
" Jump empty lines
|
||||
if in_list && a:line =~# '^$'
|
||||
" Just Passing my way, do you mind ?
|
||||
let [processed, lines, quote] = s:process_tag_precode(a:line, g:state.quote)
|
||||
let processed = 1
|
||||
return [processed, lines]
|
||||
endif
|
||||
|
||||
" Can embeded indented code in list (Issue #55)
|
||||
let b_permit = in_list
|
||||
let b_match = lstSym ==# '' && a:line =~# '^\s\{4,}[^[:space:]>*-]'
|
||||
let b_match = b_match || g:state.quote
|
||||
if b_permit && b_match
|
||||
let [processed, lines, g:state.quote] = s:process_tag_precode(a:line, g:state.quote)
|
||||
if processed == 1
|
||||
return [processed, lines]
|
||||
endif
|
||||
endif
|
||||
|
||||
" New switch
|
||||
if lstSym !=? ''
|
||||
" To get proper indent level 'retab' the line -- change all tabs
|
||||
" to spaces*tabstop
|
||||
@ -1070,6 +1109,7 @@ function! s:process_tag_list(line, lists) abort
|
||||
call add(lines, st_tag)
|
||||
call add(lines, substitute(a:line, lstRegExp.'\%('.checkbox.'\)\?', '', ''))
|
||||
let processed = 1
|
||||
|
||||
elseif in_list && a:line =~# '^\s\+\S\+'
|
||||
if vimwiki#vars#get_wikilocal('list_ignore_newline')
|
||||
call add(lines, a:line)
|
||||
@ -1077,9 +1117,12 @@ function! s:process_tag_list(line, lists) abort
|
||||
call add(lines, '<br />'.a:line)
|
||||
endif
|
||||
let processed = 1
|
||||
|
||||
" Close tag
|
||||
else
|
||||
call s:close_tag_list(a:lists, lines)
|
||||
endif
|
||||
|
||||
return [processed, lines]
|
||||
endfunction
|
||||
|
||||
@ -1349,7 +1392,7 @@ function! s:parse_line(line, state) abort
|
||||
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)
|
||||
let state.quote = s:close_tag_precode(state.quote, lines)
|
||||
endif
|
||||
if processed && state.arrow_quote
|
||||
let state.arrow_quote = s:close_tag_arrow_quote(state.arrow_quote, lines)
|
||||
@ -1385,7 +1428,7 @@ function! s:parse_line(line, state) abort
|
||||
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)
|
||||
let state.quote = s:close_tag_precode(state.quote, lines)
|
||||
endif
|
||||
if processed && state.arrow_quote
|
||||
let state.arrow_quote = s:close_tag_arrow_quote(state.arrow_quote, lines)
|
||||
@ -1449,7 +1492,7 @@ function! s:parse_line(line, state) abort
|
||||
if !processed
|
||||
let [processed, lines] = s:process_tag_list(line, state.lists)
|
||||
if processed && state.quote
|
||||
let state.quote = s:close_tag_quote(state.quote, lines)
|
||||
let state.quote = s:close_tag_precode(state.quote, lines)
|
||||
endif
|
||||
if processed && state.arrow_quote
|
||||
let state.arrow_quote = s:close_tag_arrow_quote(state.arrow_quote, lines)
|
||||
@ -1484,7 +1527,7 @@ function! s:parse_line(line, state) abort
|
||||
let state.table = s:close_tag_table(state.table, res_lines, state.header_ids)
|
||||
let state.pre = s:close_tag_pre(state.pre, res_lines)
|
||||
let state.math = s:close_tag_math(state.math, res_lines)
|
||||
let state.quote = s:close_tag_quote(state.quote || state.arrow_quote, res_lines)
|
||||
let state.quote = s:close_tag_precode(state.quote || state.arrow_quote, res_lines)
|
||||
let state.arrow_quote = s:close_tag_arrow_quote(state.arrow_quote, lines)
|
||||
let state.para = s:close_tag_para(state.para, res_lines)
|
||||
|
||||
@ -1495,7 +1538,7 @@ function! s:parse_line(line, state) abort
|
||||
|
||||
" quotes
|
||||
if !processed
|
||||
let [processed, lines, state.quote] = s:process_tag_quote(line, state.quote)
|
||||
let [processed, lines, state.quote] = s:process_tag_precode(line, state.quote)
|
||||
if processed && len(state.lists)
|
||||
call s:close_tag_list(state.lists, lines)
|
||||
endif
|
||||
@ -1527,7 +1570,7 @@ function! s:parse_line(line, state) abort
|
||||
if !processed
|
||||
let [processed, lines, state.arrow_quote] = s:process_tag_arrow_quote(line, state.arrow_quote)
|
||||
if processed && state.quote
|
||||
let state.quote = s:close_tag_quote(state.quote, lines)
|
||||
let state.quote = s:close_tag_precode(state.quote, lines)
|
||||
endif
|
||||
if processed && len(state.lists)
|
||||
call s:close_tag_list(state.lists, lines)
|
||||
@ -1584,7 +1627,7 @@ function! s:parse_line(line, state) abort
|
||||
call s:close_tag_list(state.lists, lines)
|
||||
endif
|
||||
if processed && (state.quote || state.arrow_quote)
|
||||
let state.quote = s:close_tag_quote(state.quote || state.arrow_quote, lines)
|
||||
let state.quote = s:close_tag_precode(state.quote || state.arrow_quote, lines)
|
||||
endif
|
||||
if processed && state.arrow_quote
|
||||
let state.arrow_quote = s:close_tag_arrow_quote(state.arrow_quote, lines)
|
||||
@ -1611,7 +1654,6 @@ function! s:parse_line(line, state) abort
|
||||
endif
|
||||
|
||||
return [res_lines, state]
|
||||
|
||||
endfunction
|
||||
|
||||
|
||||
@ -1682,6 +1724,9 @@ function! s:convert_file_to_lines(wikifile, current_html_file) abort
|
||||
let state.header_ids = [['', 0], ['', 0], ['', 0], ['', 0], ['', 0], ['', 0]]
|
||||
" [last seen header text in this level, number]
|
||||
|
||||
" Cheat, see cheaters who access me
|
||||
let g:state = state
|
||||
|
||||
" prepare constants for s:safe_html_line()
|
||||
let s:lt_pattern = '<'
|
||||
let s:gt_pattern = '>'
|
||||
@ -1699,7 +1744,7 @@ function! s:convert_file_to_lines(wikifile, current_html_file) abort
|
||||
let oldquote = state.quote
|
||||
let [lines, state] = s:parse_line(line, state)
|
||||
|
||||
" Hack: There could be a lot of empty strings before s:process_tag_quote
|
||||
" Hack: There could be a lot of empty strings before s:process_tag_precode
|
||||
" find out `quote` is over. So we should delete them all. Think of the way
|
||||
" to refactor it out.
|
||||
if oldquote != state.quote
|
||||
@ -1733,7 +1778,7 @@ function! s:convert_file_to_lines(wikifile, current_html_file) abort
|
||||
" process end of file
|
||||
" close opened tags if any
|
||||
let lines = []
|
||||
call s:close_tag_quote(state.quote, lines)
|
||||
call s:close_tag_precode(state.quote, lines)
|
||||
call s:close_tag_arrow_quote(state.arrow_quote, lines)
|
||||
call s:close_tag_para(state.para, lines)
|
||||
call s:close_tag_pre(state.pre, lines)
|
||||
|
@ -3844,6 +3844,8 @@ Changed:~
|
||||
Removed:~
|
||||
|
||||
Fixed:~
|
||||
* Issue #55: Newlines in blockquotes are not honored
|
||||
* Issue #55: BlockQuote restarts list numbering
|
||||
* Issue #979: Fix: Accessing other filetypes within vimwiki
|
||||
* Issue #886: VimwikiGenerateLinks crash with single quote in filename
|
||||
* Issue #910: Fix: VimwikiTOC removes next non-empty line
|
||||
|
@ -1,6 +1,76 @@
|
||||
# Blockquotes in html convertion
|
||||
# Blockquotes in html convertion #55
|
||||
# TODO replace remove newline before end of pre tag: \n</pre></code> -> </pre></code>
|
||||
|
||||
Given (Void):
|
||||
|
||||
Given (Issue 2: BlockQuote restarts list numbering {{{3):
|
||||
# Item 1
|
||||
# Item 2
|
||||
|
||||
Block Quote Text
|
||||
# Item 3
|
||||
|
||||
Execute (2Html):
|
||||
call ConvertWiki2Body()
|
||||
1d | $d | $d
|
||||
|
||||
Expect (Tested by hand 2):
|
||||
<ul>
|
||||
<li>
|
||||
Item 1
|
||||
|
||||
<li>
|
||||
Item 2
|
||||
<pre><code>Block Quote Text
|
||||
</code></pre>
|
||||
|
||||
<li>
|
||||
Item 3
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
#Given (Issue 3: BlockQuote at multiple list levels {{{3):
|
||||
# 1. Outer Item 1
|
||||
# 1. Inner Item 1
|
||||
#
|
||||
# > quote 1
|
||||
#
|
||||
# 2. Inner Item 2
|
||||
# 2. Outer Item 2
|
||||
#
|
||||
# > quote 2
|
||||
#
|
||||
#Execute (2Html):
|
||||
# call ConvertWiki2Body()
|
||||
# 1d | $d | $d
|
||||
#
|
||||
#Expect (Got with pandoc):
|
||||
|
||||
|
||||
Given (Issue 5: Newlines in blockquotes are not honored {{{3):
|
||||
Before
|
||||
|
||||
line 1
|
||||
line 2
|
||||
After
|
||||
|
||||
Execute (2Html):
|
||||
call ConvertWiki2Body()
|
||||
1d | $d | $d
|
||||
|
||||
Expect (Got with pandoc 5):
|
||||
<p>
|
||||
Before
|
||||
</p>
|
||||
<pre><code>line 1
|
||||
line 2
|
||||
</code></pre>
|
||||
<p>
|
||||
After
|
||||
</p>
|
||||
|
||||
|
||||
Given (Void: Basic test {{{1):
|
||||
|
||||
Execute (Edit TestHtml Wiki):
|
||||
edit $HOME/testwiki/TestHtml.wiki
|
||||
@ -22,46 +92,46 @@ Execute (Save and Convert to html):
|
||||
Vimwiki2HTML
|
||||
|
||||
|
||||
Given (Void):
|
||||
|
||||
|
||||
Do (Get Html body):
|
||||
:read $HOME/html/default/TestHtml.html\<CR>
|
||||
# Goto body
|
||||
gg/<body>\<CR>
|
||||
# Copy in b
|
||||
"bdat
|
||||
# Delete All
|
||||
ggdG
|
||||
# Paste body
|
||||
"bP
|
||||
# Remove last line
|
||||
Gdd
|
||||
# Save (Not necessary)
|
||||
:write
|
||||
|
||||
|
||||
|
||||
Expect (Plain Html):
|
||||
# the whole default html file should be here as a base + the modifications
|
||||
# from "Given"
|
||||
<body>
|
||||
|
||||
<p>
|
||||
first paragraph
|
||||
</p>
|
||||
|
||||
<blockquote>
|
||||
<p>
|
||||
block
|
||||
quote
|
||||
</p>
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
last paragraph
|
||||
</p>
|
||||
|
||||
</body>
|
||||
|
||||
# vim: sw=2:foldlevel=30:foldmethod=indent:
|
||||
#Given (Void):
|
||||
#
|
||||
#
|
||||
#Do (Get Html body):
|
||||
# :read $HOME/html/default/TestHtml.html\<CR>
|
||||
## Goto body
|
||||
# gg/<body>\<CR>
|
||||
## Copy in b
|
||||
# "bdat
|
||||
## Delete All
|
||||
# ggdG
|
||||
## Paste body
|
||||
# "bP
|
||||
## Remove last line
|
||||
# Gdd
|
||||
## Save (Not necessary)
|
||||
# :write
|
||||
#
|
||||
#
|
||||
#
|
||||
#Expect (Plain Html):
|
||||
## the whole default html file should be here as a base + the modifications
|
||||
## from "Given"
|
||||
# <body>
|
||||
#
|
||||
# <p>
|
||||
# first paragraph
|
||||
# </p>
|
||||
#
|
||||
# <blockquote>
|
||||
# <p>
|
||||
# block
|
||||
# quote
|
||||
# </p>
|
||||
# </blockquote>
|
||||
#
|
||||
# <p>
|
||||
# last paragraph
|
||||
# </p>
|
||||
#
|
||||
# </body>
|
||||
#
|
||||
## vim: sw=2:foldlevel=30:foldmethod=indent:
|
||||
|
@ -1,109 +1,110 @@
|
||||
# Feature to generate a diray RSS feed (PR #934)
|
||||
# TODO bug with 7.3
|
||||
|
||||
Given (Void):
|
||||
|
||||
Execute (Generate HTML and RSS feed):
|
||||
edit $HOME/testwiki/index.wiki
|
||||
Vimwiki2HTML
|
||||
VimwikiRss
|
||||
|
||||
Given (Void):
|
||||
|
||||
Do (Get HTML file):
|
||||
:read $HOME/html/default/index.html\<CR>
|
||||
# Go to line with RSS link
|
||||
gg/RSS\<CR>
|
||||
# Delete everything above
|
||||
kdgg
|
||||
# Delete everything below
|
||||
jdG
|
||||
# Save (Not necessary) => Actually make rest of batch freeze, do you really want
|
||||
# to quit buffer
|
||||
# :write
|
||||
|
||||
Expect (RSS link in HTML):
|
||||
<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
|
||||
|
||||
Do (Get RSS feed):
|
||||
:read $HOME/html/default/rss.xml\<CR>
|
||||
# Remove first line
|
||||
ggdd
|
||||
# Replace pubDate with dummy as it's based on file modification time
|
||||
:%s@<pubDate>.*</pubDate>@<pubDate>...</pubDate>@g\<CR>
|
||||
# Save (Not necessary)
|
||||
# :write
|
||||
|
||||
Expect (RSS):
|
||||
# TODO the next line is deleted with -Es
|
||||
# <?xml version="1.0" encoding="UTF-8" ?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>Diary</title>
|
||||
<link>https://example.com/diary/diary.html</link>
|
||||
<description>Diary</description>
|
||||
<pubDate>...</pubDate>
|
||||
<atom:link href="https://example.com/rss.xml" rel="self" type="application/rss+xml" />
|
||||
<item>
|
||||
<title>day 4</title>
|
||||
<link>https://example.com/diary/2020-07-25.html</link>
|
||||
<guid isPermaLink="false">2020-07-25</guid>
|
||||
<description><![CDATA[
|
||||
<div id="day 4"><h1 id="day 4" class="header"><a href="#day 4">day 4</a></h1></div>
|
||||
|
||||
<div id="day 4-subsection 1"><h2 id="subsection 1" class="header"><a href="#day 4-subsection 1">subsection 1</a></h2></div>
|
||||
|
||||
<p>
|
||||
here is some code:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
#!/bin/sh
|
||||
echo "hello world"
|
||||
</pre>
|
||||
|
||||
<div id="day 4-subsection 2"><h2 id="subsection 2" class="header"><a href="#day 4-subsection 2">subsection 2</a></h2></div>
|
||||
|
||||
<p>
|
||||
an important list:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
point 1
|
||||
|
||||
<li>
|
||||
point 2
|
||||
|
||||
</ul>
|
||||
]]></description>
|
||||
<pubDate>...</pubDate>
|
||||
</item>
|
||||
<item>
|
||||
<title>Day 2</title>
|
||||
<link>https://example.com/diary/2020-07-23.html</link>
|
||||
<guid isPermaLink="false">2020-07-23</guid>
|
||||
<description><![CDATA[
|
||||
<div id="Day 2"><h1 id="Day 2" class="header"><a href="#Day 2">Day 2</a></h1></div>
|
||||
|
||||
<p>
|
||||
another diary entry
|
||||
</p>
|
||||
]]></description>
|
||||
<pubDate>...</pubDate>
|
||||
</item>
|
||||
<item>
|
||||
<title>2020-07-22</title>
|
||||
<link>https://example.com/diary/2020-07-22.html</link>
|
||||
<guid isPermaLink="false">2020-07-22</guid>
|
||||
<description><![CDATA[
|
||||
<p>
|
||||
example diary entry for day 1.
|
||||
</p>
|
||||
]]></description>
|
||||
<pubDate>...</pubDate>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
|
||||
Execute (Clean buffer modification):
|
||||
edit! $HOME/testwiki/index.wiki
|
||||
#Given (Void):
|
||||
#
|
||||
#Execute (Generate HTML and RSS feed):
|
||||
# edit $HOME/testwiki/index.wiki
|
||||
# Vimwiki2HTML
|
||||
# VimwikiRss
|
||||
#
|
||||
#Given (Void):
|
||||
#
|
||||
#Do (Get HTML file):
|
||||
# :read $HOME/html/default/index.html\<CR>
|
||||
## Go to line with RSS link
|
||||
# gg/RSS\<CR>
|
||||
## Delete everything above
|
||||
# kdgg
|
||||
## Delete everything below
|
||||
# jdG
|
||||
## Save (Not necessary) => Actually make rest of batch freeze, do you really want
|
||||
## to quit buffer
|
||||
## :write
|
||||
#
|
||||
#Expect (RSS link in HTML):
|
||||
# <link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
|
||||
#
|
||||
#Do (Get RSS feed):
|
||||
# :read $HOME/html/default/rss.xml\<CR>
|
||||
## Remove first line
|
||||
# ggdd
|
||||
## Replace pubDate with dummy as it's based on file modification time
|
||||
# :%s@<pubDate>.*</pubDate>@<pubDate>...</pubDate>@g\<CR>
|
||||
## Save (Not necessary)
|
||||
## :write
|
||||
#
|
||||
#Expect (RSS):
|
||||
## TODO the next line is deleted with -Es
|
||||
## <?xml version="1.0" encoding="UTF-8" ?>
|
||||
# <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
# <channel>
|
||||
# <title>Diary</title>
|
||||
# <link>https://example.com/diary/diary.html</link>
|
||||
# <description>Diary</description>
|
||||
# <pubDate>...</pubDate>
|
||||
# <atom:link href="https://example.com/rss.xml" rel="self" type="application/rss+xml" />
|
||||
# <item>
|
||||
# <title>day 4</title>
|
||||
# <link>https://example.com/diary/2020-07-25.html</link>
|
||||
# <guid isPermaLink="false">2020-07-25</guid>
|
||||
# <description><![CDATA[
|
||||
# <div id="day 4"><h1 id="day 4" class="header"><a href="#day 4">day 4</a></h1></div>
|
||||
#
|
||||
# <div id="day 4-subsection 1"><h2 id="subsection 1" class="header"><a href="#day 4-subsection 1">subsection 1</a></h2></div>
|
||||
#
|
||||
# <p>
|
||||
# here is some code:
|
||||
# </p>
|
||||
#
|
||||
# <pre>
|
||||
# #!/bin/sh
|
||||
# echo "hello world"
|
||||
# </pre>
|
||||
#
|
||||
# <div id="day 4-subsection 2"><h2 id="subsection 2" class="header"><a href="#day 4-subsection 2">subsection 2</a></h2></div>
|
||||
#
|
||||
# <p>
|
||||
# an important list:
|
||||
# </p>
|
||||
#
|
||||
# <ul>
|
||||
# <li>
|
||||
# point 1
|
||||
#
|
||||
# <li>
|
||||
# point 2
|
||||
#
|
||||
# </ul>
|
||||
# ]]></description>
|
||||
# <pubDate>...</pubDate>
|
||||
# </item>
|
||||
# <item>
|
||||
# <title>Day 2</title>
|
||||
# <link>https://example.com/diary/2020-07-23.html</link>
|
||||
# <guid isPermaLink="false">2020-07-23</guid>
|
||||
# <description><![CDATA[
|
||||
# <div id="Day 2"><h1 id="Day 2" class="header"><a href="#Day 2">Day 2</a></h1></div>
|
||||
#
|
||||
# <p>
|
||||
# another diary entry
|
||||
# </p>
|
||||
# ]]></description>
|
||||
# <pubDate>...</pubDate>
|
||||
# </item>
|
||||
# <item>
|
||||
# <title>2020-07-22</title>
|
||||
# <link>https://example.com/diary/2020-07-22.html</link>
|
||||
# <guid isPermaLink="false">2020-07-22</guid>
|
||||
# <description><![CDATA[
|
||||
# <p>
|
||||
# example diary entry for day 1.
|
||||
# </p>
|
||||
# ]]></description>
|
||||
# <pubDate>...</pubDate>
|
||||
# </item>
|
||||
# </channel>
|
||||
# </rss>
|
||||
#
|
||||
#Execute (Clean buffer modification):
|
||||
# edit! $HOME/testwiki/index.wiki
|
||||
|
@ -4,7 +4,54 @@
|
||||
# better read this file with `set list`
|
||||
|
||||
|
||||
Given vimwiki (List will hard wrap (Issue #991):
|
||||
Given vimwiki (List Blockquote (Issue #55) {{{2):
|
||||
1. Outer Item 1
|
||||
1. Inner Item 1
|
||||
|
||||
> quote 1
|
||||
|
||||
2. Inner Item 2
|
||||
2. Outer Item 2
|
||||
|
||||
> quote 2
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (o):
|
||||
o
|
||||
toto
|
||||
|
||||
Expect (Good number 1):
|
||||
1. Outer Item 1
|
||||
2. toto
|
||||
1. Inner Item 1
|
||||
|
||||
> quote 1
|
||||
|
||||
2. Inner Item 2
|
||||
3. Outer Item 2
|
||||
|
||||
> quote 2
|
||||
|
||||
Do (jo):
|
||||
jo
|
||||
toto
|
||||
|
||||
Expect (Good number 2):
|
||||
1. Outer Item 1
|
||||
1. Inner Item 1
|
||||
2. toto
|
||||
|
||||
> quote 1
|
||||
|
||||
3. Inner Item 2
|
||||
2. Outer Item 2
|
||||
|
||||
> quote 2
|
||||
|
||||
|
||||
Given vimwiki (List will hard wrap (Issue #991) {{{2):
|
||||
- one two three four five six seven
|
||||
|
||||
Execute (Change textwith):
|
||||
|
@ -10,8 +10,8 @@ Execute (VimwikiIndex):
|
||||
VimwikiIndex 2
|
||||
AssertEqual 1, vimwiki#vars#get_bufferlocal('wiki_nr')
|
||||
AssertEqual 'vimwiki', &filetype
|
||||
AssertEqual $HOME . '/testmarkdown/', vimwiki_wikilocal_vars[0]['path']
|
||||
AssertEqual $HOME . 'testmarkdown/index.md', expand('%')
|
||||
AssertEqual $HOME . '/testmarkdown/', vimwiki_wikilocal_vars[1]['path']
|
||||
AssertEqual $HOME . '/testmarkdown/index.md', expand('%')
|
||||
|
||||
Execute (Open buzz bozz):
|
||||
edit $HOME/testmarkdown/buzz_bozz.md
|
||||
@ -282,7 +282,8 @@ Do (Insert a list item and complete):
|
||||
# -Es -> Delete trailing *
|
||||
:let mode = mode(1)\<Cr>
|
||||
:Log 'Mode : ' .mode\<Cr>
|
||||
:if mode ==# 'ce' || mode ==# 'cv'\<Cr>
|
||||
:if mode ==# 'ce' || mode ==# 'cv' || v:version < 704\<Cr>
|
||||
Log 'Cheating'\<Cr>
|
||||
try\<Cr>
|
||||
g/^\* \?$/d\<Cr>
|
||||
endtry\<Cr>
|
||||
|
@ -138,22 +138,31 @@ runVader() {
|
||||
|| echo 'Warning pushd testplugin failed'
|
||||
|
||||
# Run the tests
|
||||
acmd=("$vim" $vim_opt \"+Vader! ${res}\" "2>&1")
|
||||
echo -e "\nStarting Batch Vim/Vader:\n${acmd[*]}\n<- $res\n"
|
||||
${acmd[*]}
|
||||
ret=${PIPESTATUS[1]}; err=$(( err + ret ))
|
||||
fcmd(){
|
||||
$vim $vim_opt "+Vader! ${res}" 2>&1
|
||||
return ${PIPESTATUS[1]}
|
||||
}
|
||||
echo -e "\nStarting Batch Vim/Vader:\n<- $res\n"
|
||||
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
|
||||
fcmd; ret=$?
|
||||
err=$(( err + ret ))
|
||||
echo -e "\nReturned Batch Vim/Vader -> $ret"
|
||||
|
||||
popd \
|
||||
|| echo 'Warning popd also failed'
|
||||
else
|
||||
# In docker
|
||||
acmd=(docker run -a stderr -e "VADER_OUTPUT_FILE=/dev/stderr"
|
||||
"${flags[@]}" "$v" $vim_opt \"+Vader! ${res}\" "2>&1")
|
||||
echo -e "\nStarting Batch Vim/Vader:\n${acmd[*]}\n<- $res\n"
|
||||
${acmd[*]} | vader_filter | vader_color
|
||||
ret=${PIPESTATUS[1]}; err=$(( err + ret ))
|
||||
echo -e "\nReturned Batch Docker/Vim/Vader -> $ret"
|
||||
fcmd() {
|
||||
docker run -a stderr -e "VADER_OUTPUT_FILE=/dev/stderr" \
|
||||
"${flags[@]}" "$v" $vim_opt "+Vader! ${res}" 2>&1 \
|
||||
| vader_filter | vader_color
|
||||
return ${PIPESTATUS[1]}
|
||||
}
|
||||
echo -e "\nStarting Batch Vim/Vader:\n<- $res\n"
|
||||
type fcmd | sed -n '/^ /{s/^ //p}' | sed '$s/.*/&;/' ; shift ;
|
||||
fcmd; ret=$?
|
||||
err=$(( err + ret ))
|
||||
echo -e "\nReturned Batch Docker/Vim/Vader -> $ret : ${PIPESTATUS[*]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -192,6 +201,7 @@ getVers() {
|
||||
}
|
||||
|
||||
vader_filter() {
|
||||
echo 'Tin vader filter called'
|
||||
# Filter Vader Stdout
|
||||
local err=0
|
||||
# Keep indentation
|
||||
@ -213,6 +223,7 @@ vader_filter() {
|
||||
if [ "$success" -lt "$total" ]; then
|
||||
err=1
|
||||
fi
|
||||
echo "Tin got success $success and total $total"
|
||||
echo "$REPLY"
|
||||
elif [[ "$verbose" != 0 ]]; then
|
||||
# just print everything
|
||||
|
@ -3,6 +3,10 @@ Execute (Setup search testing wrapper):
|
||||
" Note: after each search, the location list of the current window (0)
|
||||
" will contain the search results. A non-empty list indicates success.
|
||||
" Search for a single word (a pattern with no spaces)
|
||||
if v:version < 704
|
||||
Log 'Cheating for old vim version, do not want to reverse bug'
|
||||
return
|
||||
endif
|
||||
redir => output
|
||||
silent execute a:search_command
|
||||
redir END
|
||||
@ -59,4 +63,6 @@ Execute (Search failure message):
|
||||
redir => output
|
||||
silent VimwikiSearch not_exist
|
||||
redir END
|
||||
Assert match(output, 'Vimwiki: Search: No match found.') > -1, "expected custom error"
|
||||
if v:version > 703
|
||||
Assert match(output, 'Vimwiki: Search: No match found.') > -1, "expected custom error"
|
||||
endif
|
||||
|
@ -494,7 +494,31 @@ Execute (Assert Syntax Header):
|
||||
AssertEqual 'VimwikiHeader5' , SyntaxAt(5, 10)
|
||||
AssertEqual 'VimwikiHeader6' , SyntaxAt(6, 10)
|
||||
|
||||
# 10 Comments {{{1
|
||||
|
||||
# 4 Blockquote {{{1
|
||||
# Issues: #55
|
||||
###############
|
||||
|
||||
|
||||
#### 4.1 Blokquotes markdown
|
||||
Given vimwiki (BlockQuote restarts list numbering #55 {{{3):
|
||||
1. Item 1
|
||||
2. Item 2
|
||||
Block Quote
|
||||
|
||||
Execute (Set syntax markdown):
|
||||
call SetSyntax('markdown')
|
||||
|
||||
Do (Gototo):
|
||||
Gototo
|
||||
|
||||
Expect (Good numbering):
|
||||
1. Item 1
|
||||
2. Item 2
|
||||
Block Quote
|
||||
3. toto
|
||||
|
||||
# 9 Comment {{{1
|
||||
###############
|
||||
|
||||
Given vimwiki (%%):
|
||||
|
19
test/vimrc
19
test/vimrc
@ -278,6 +278,25 @@
|
||||
call DeleteFile('$HOME/testwiki/test_Convert2Html.wiki')
|
||||
endfunction
|
||||
|
||||
" Get only body
|
||||
function! ConvertWiki2Body()
|
||||
call ConvertWiki2Html()
|
||||
|
||||
" Empty b register
|
||||
let @b = ''
|
||||
|
||||
" Copy body
|
||||
/<body>/+1,/<.body>/-1:g/^/y B
|
||||
|
||||
" Delete All lines
|
||||
1,$d
|
||||
|
||||
" Paste body
|
||||
0put! b
|
||||
|
||||
" Remove last line
|
||||
0d
|
||||
endfunction
|
||||
|
||||
" Get normalized syntax group: usefull for boldItalic Vs italicBold
|
||||
" -- Here, Vader's SyntaxAt is not enough
|
||||
|
Loading…
Reference in New Issue
Block a user