Permalink
Browse files

Bug fix for note to Markdown conversion of list items (issue #44)

See issue #44 on GitHub:
  #44
  • Loading branch information...
1 parent 2805297 commit 1fe9135e482d18b8474fa5a508d5cc58fe22ec08 @xolox committed Jul 18, 2013
Showing with 18 additions and 12 deletions.
  1. +2 −2 autoload/xolox/notes.vim
  2. +16 −10 autoload/xolox/notes/parser.vim
@@ -1,12 +1,12 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: July 16, 2013
+" Last Change: July 18, 2013
" URL: http://peterodding.com/code/vim/notes/
" Note: This file is encoded in UTF-8 including a byte order mark so
" that Vim loads the script using the right encoding transparently.
-let g:xolox#notes#version = '0.23'
+let g:xolox#notes#version = '0.23.1'
let g:xolox#notes#url_pattern = '\<\(mailto:\|javascript:\|\w\{3,}://\)\(\S*\w\)\+/\?'
let s:scriptdir = expand('<sfile>:p:h')
@@ -1,6 +1,6 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: June 23, 2013
+" Last Change: July 18, 2013
" URL: http://peterodding.com/code/vim/notes/
function! xolox#notes#parser#parse_note(text) " {{{1
@@ -256,16 +256,22 @@ function! s:parse_paragraph(context) " {{{1
" Parse the upcoming paragraph in the input stream.
let lines = []
while a:context.has_more()
- let line = s:match_line(a:context)
- call add(lines, line)
- if line =~ '^\_s*$'
- " An empty line marks the end of the paragraph.
- break
- elseif line[-1:] != "\n"
- " XXX When match_line() returns a line that doesn't end in a newline
- " character, it means either we hit the end of the input or the current
- " line continues in a code block (which is not ours to parse :-).
+ if !empty(s:match_bullet_or_divider(a:context, 0))
+ " If the next line starts with a list bullet it shouldn't
+ " be included in the paragraph we're currently parsing.
break
+ else
+ let line = s:match_line(a:context)
+ call add(lines, line)
+ if line =~ '^\_s*$'
+ " An empty line marks the end of the paragraph.
+ break
+ elseif line[-1:] != "\n"
+ " XXX When match_line() returns a line that doesn't end in a newline
+ " character, it means either we hit the end of the input or the current
+ " line continues in a code block (which is not ours to parse :-).
+ break
+ endif
endif
endwhile
" Don't include empty paragraphs in the output.

0 comments on commit 1fe9135

Please sign in to comment.