Skip to content

Commit ab209df

Browse files
authored
Merge pull request #14 from dkarter/support-pandoc-fancy-lists
Support for pandoc bullets
2 parents 21466fa + 477146a commit ab209df

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

plugin/bullets.vim

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
" Vim plugin for automated bulleted lists
2-
" Last Change: Tue 18 Apr 2017
2+
" Last Change: Sun 15 Oct 2017
33
" Maintainer: Dorian Karter
44
" License: MIT
55
" FileTypes: markdown, text, gitcommit
@@ -85,7 +85,7 @@ fun! s:match_roman_list_item(input_text)
8585
endfun
8686

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

9191
if empty(l:matches)

spec/bullets_spec.rb

+23
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,28 @@
5353
EOF
5454
end
5555

56+
it 'adds a pandoc bullet if the prev line had one' do
57+
filename = "#{SecureRandom.hex(6)}.md"
58+
write_file(filename, <<-EOF)
59+
Hello there
60+
#. this is the first bullet
61+
EOF
62+
63+
vim.edit filename
64+
vim.type 'GA'
65+
vim.feedkeys '\<cr>'
66+
vim.type 'second bullet'
67+
vim.write
68+
69+
file_contents = IO.read(filename)
70+
71+
expect(file_contents).to eq normalize_string_indent(<<-EOF)
72+
Hello there
73+
#. this is the first bullet
74+
#. second bullet\n
75+
EOF
76+
end
77+
5678
it 'adds a new numeric bullet if the previous line had numeric bullet' do
5779
filename = "#{SecureRandom.hex(6)}.md"
5880
write_file(filename, <<-EOF)
@@ -96,6 +118,7 @@
96118
second line\n
97119
EOF
98120
end
121+
99122
it 'adds a new roman numeral bullet' do
100123
filename = "#{SecureRandom.hex(6)}.md"
101124
write_file(filename, <<-EOF)

spec/spec_helper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'vimrunner'
22
require 'vimrunner/rspec'
3+
require 'securerandom'
34

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

0 commit comments

Comments
 (0)