')
- 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, '')
+ call add(lines, '')
+ 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, ' '.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)
diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt
index 2517db0..1bdc367 100644
--- a/doc/vimwiki.txt
+++ b/doc/vimwiki.txt
@@ -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
diff --git a/test/html_blockquote.vader b/test/html_blockquote.vader
index a779f33..327cb4d 100644
--- a/test/html_blockquote.vader
+++ b/test/html_blockquote.vader
@@ -1,6 +1,76 @@
-# Blockquotes in html convertion
+# Blockquotes in html convertion #55
+# TODO replace remove newline before end of pre tag: \n ->
-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):
+
+
+ Item 1
+
+
+ Item 2
+
Block Quote Text
+
+
+
+ Item 3
+
+
+
+
+#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):
+
+ Before
+
+
line 1
+ line 2
+
+
+ After
+
+
+
+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\
-# Goto body
- gg/\
-# 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"
-
-
-
- first paragraph
-
-
-
-
- block
- quote
-
-
-
-
- last paragraph
-
-
-
-
-# vim: sw=2:foldlevel=30:foldmethod=indent:
+#Given (Void):
+#
+#
+#Do (Get Html body):
+# :read $HOME/html/default/TestHtml.html\
+## Goto body
+# gg/\
+## 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"
+#
+#
+#
+# first paragraph
+#
+#
+#
+#
+# block
+# quote
+#
+#
+#
+#
+# last paragraph
+#
+#
+#
+#
+## vim: sw=2:foldlevel=30:foldmethod=indent:
diff --git a/test/html_diary_rss_feed.vader b/test/html_diary_rss_feed.vader
index 83e3600..1f8ec7e 100644
--- a/test/html_diary_rss_feed.vader
+++ b/test/html_diary_rss_feed.vader
@@ -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\
-# Go to line with RSS link
- gg/RSS\
-# 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):
-
-
-Do (Get RSS feed):
- :read $HOME/html/default/rss.xml\
-# Remove first line
- ggdd
-# Replace pubDate with dummy as it's based on file modification time
- :%s@.*@...@g\
-# Save (Not necessary)
-# :write
-
-Expect (RSS):
-# TODO the next line is deleted with -Es
-#
-
-
- Diary
- https://example.com/diary/diary.html
- Diary
- ...
-
-
- day 4
- https://example.com/diary/2020-07-25.html
- 2020-07-25
-