Skip to content

Commit

Permalink
Bug fix for note to Markdown conversion of list items (issue #44)
Browse files Browse the repository at this point in the history
See issue #44 on GitHub:
  #44
  • Loading branch information
xolox committed Jul 18, 2013
1 parent 2805297 commit 1fe9135
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions autoload/xolox/notes.vim
Original file line number Diff line number Diff line change
@@ -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')

Expand Down
26 changes: 16 additions & 10 deletions autoload/xolox/notes/parser.vim
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 1fe9135

Please sign in to comment.