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:
Tinmarino
2020-08-24 00:17:34 -04:00
parent 8e5274b1a2
commit dc63a5dacc
10 changed files with 421 additions and 195 deletions

View File

@ -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:

View File

@ -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

View File

@ -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):

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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 (%%):

View File

@ -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