Skip to content

Commit

Permalink
Merge pull request #14 from dkarter/support-pandoc-fancy-lists
Browse files Browse the repository at this point in the history
Support for pandoc bullets
  • Loading branch information
dkarter committed Oct 15, 2017
2 parents 21466fa + 477146a commit ab209df
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin/bullets.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
" Vim plugin for automated bulleted lists
" Last Change: Tue 18 Apr 2017
" Last Change: Sun 15 Oct 2017
" Maintainer: Dorian Karter
" License: MIT
" FileTypes: markdown, text, gitcommit
Expand Down Expand Up @@ -85,7 +85,7 @@ fun! s:match_roman_list_item(input_text)
endfun

fun! s:match_bullet_list_item(input_text)
let l:std_bullet_regex = '\v(^\s*(-|*|\\item)( \[[x ]?\])? )(.*)'
let l:std_bullet_regex = '\v(^\s*(-|*|#.|\\item)( \[[x ]?\])? )(.*)'
let l:matches = matchlist(a:input_text, l:std_bullet_regex)

if empty(l:matches)
Expand Down
23 changes: 23 additions & 0 deletions spec/bullets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,28 @@
EOF
end

it 'adds a pandoc bullet if the prev line had one' do
filename = "#{SecureRandom.hex(6)}.md"
write_file(filename, <<-EOF)
Hello there
#. this is the first bullet
EOF

vim.edit filename
vim.type 'GA'
vim.feedkeys '\<cr>'
vim.type 'second bullet'
vim.write

file_contents = IO.read(filename)

expect(file_contents).to eq normalize_string_indent(<<-EOF)
Hello there
#. this is the first bullet
#. second bullet\n
EOF
end

it 'adds a new numeric bullet if the previous line had numeric bullet' do
filename = "#{SecureRandom.hex(6)}.md"
write_file(filename, <<-EOF)
Expand Down Expand Up @@ -96,6 +118,7 @@
second line\n
EOF
end

it 'adds a new roman numeral bullet' do
filename = "#{SecureRandom.hex(6)}.md"
write_file(filename, <<-EOF)
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'vimrunner'
require 'vimrunner/rspec'
require 'securerandom'

Vimrunner::RSpec.configure do |config|
# Use a single Vim instance for the test suite. Set to false to use an
Expand Down

0 comments on commit ab209df

Please sign in to comment.