vimwiki/test/convert_default_html.vader

278 lines
4.4 KiB
Plaintext

Include: vader_includes/vader_setup.vader
Execute (Copy Wiki's Resources):
Log "Start: Copy Resources"
call CopyResources()
Given vimwiki (Table no heading {{{1):
| header1 | header2 |
| val1 | val2 |
| val1 | val2 |
| val1 | val2 |
Do (Convert):
# Note: gg"bdG = Cut
# Note: ggdG"bp = Replace file content by clipboard "b
# Fill file with a name
:let g:buf_vader = bufnr('%')\<Cr>
gg"bdG
:edit $HOME/testwiki/test_html_table.wiki\<Cr>
ggdG"bp
:call WriteMe()\<Cr>
# Convert
:Vimwiki2HTML\<Cr>
# Copy output
:edit $HOME/html/default/test_html_table.html\<Cr>
gg"bdG
# Paste output in [Vader] buffer
:execute 'buffer ' . g:buf_vader\<Cr>
ggdG"bp
# Keep only body
ggd/<body>\<Cr>
Expect (Table no heading):
<body>
<table>
<tr>
<td>
header1
</td>
<td>
header2
</td>
</tr>
<tr>
<td>
val1
</td>
<td>
val2
</td>
</tr>
<tr>
<td>
val1
</td>
<td>
val2
</td>
</tr>
<tr>
<td>
val1
</td>
<td>
val2
</td>
</tr>
</table>
</body>
</html>
Execute(Delete):
call DeleteFile('$HOME/testwiki/test_html_table.wiki')
call DeleteFile('$HOME/html/default/test_html_table.html')
Given vimwiki (Table with heading {{{1):
| header1 | header2 | header3 |
|---------|---------|---------|
| val1 | val2 | var3 |
| val4 | val5 | var6 |
Do (Convert):
# Note: gg"bdG = Cut
# Note: ggdG"bp = Replace file content by clipboard "b
# Fill file with a name
:let g:buf_vader = bufnr('%')\<Cr>
gg"bdG
:edit $HOME/testwiki/test_html_table.wiki\<Cr>
ggdG"bp
:call WriteMe()\<Cr>
# Convert
:Vimwiki2HTML\<Cr>
# Copy output
:edit $HOME/html/default/test_html_table.html\<Cr>
gg"bdG
# Paste output in [Vader] buffer
:execute 'buffer ' . g:buf_vader\<Cr>
ggdG"bp
# Keep only body
ggd/<body>\<Cr>
Expect (Table with heading):
<body>
<table>
<thead>
<tr>
<th>
header1
</th>
<th>
header2
</th>
<th>
header3
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
val1
</td>
<td>
val2
</td>
<td>
var3
</td>
</tr>
<tr>
<td>
val4
</td>
<td>
val5
</td>
<td>
var6
</td>
</tr>
</tbody>
</table>
</body>
</html>
Execute(Delete):
call DeleteFile('$HOME/testwiki/test_html_table.wiki')
call DeleteFile('$HOME/html/default/test_html_table.html')
#################################################
Execute (Log):
Log '#473: Syntax "local:" doesnt work as expected. #473'
Given vimwiki (Void Md):
Execute (Edit Test473 Wiki):
edit $HOME/testwiki/TestHtml.wiki
Do (Add local link: [[local:$HOME/here|Link]]):
:edit $HOME/testwiki/Test473.wiki\<CR>
i
[[local:
\<C-r>=$HOME\<Cr>
/here|Link]]
\<Esc>
:call WriteMe()\<Cr>
:Vimwiki2HTML\<Cr>
Execute (Save and Convert to html):
edit $HOME/testwiki/Test473.wiki
Vimwiki2HTML
AssertEqual '[[local:'.$HOME.'/here|Link]]', getline(1)
Given (Void Html):
# TODO mutualise
Do (Get Html body):
:read $HOME/html/default/Test473.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 (Local link):
<body>
<p>
<a href="../../here">Link</a>
</p>
</body>
Execute (Delete):
call DeleteFile(' $HOME/testwiki/Test473.wiki')
#################################################
Given (Void):
Execute (Edit TestHtml Wiki):
edit $HOME/testwiki/TestHtml.wiki
AssertEqual $HOME . '/testwiki/TestHtml.wiki', expand('%')
AssertEqual 'default', vimwiki#vars#get_wikilocal('syntax')
AssertEqual 0, vimwiki#vars#get_bufferlocal('wiki_nr')
Do (Markdwon with %plainhtml):
:edit $HOME/testwiki/TestHtml.wiki\<CR>
i%plainhtml<div id="test">\<CR>
my paragraph\<CR>
%plainhtml</div>\<CR>\<Esc>
:set bt=\<CR>
:write\<CR>
Execute (Save and Convert to html):
edit $HOME/testwiki/TestHtml.wiki
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>
<div id="test">
<p>
my paragraph
</p>
</div>
</body>
Execute (Delete):
call DeleteFile('$HOME/testwiki/TestHtml.wiki')
Include: vader_includes/vader_teardown.vader
# vim: sw=2 foldmethod=marker foldlevel=30