Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Implement multi-paragraph footnotes crapily

  • Loading branch information...
commit 5f86a0853b3a5b1087c3d56a57fe0bff018dca53 1 parent 51da2bd
@drbrain drbrain authored
Showing with 22 additions and 1 deletion.
  1. +3 −1 pegdown.kpeg
  2. +19 −0 test/test_pegdown.rb
View
4 pegdown.kpeg
@@ -6,6 +6,7 @@
#
# * Link titles are not used
# * Image links are not always generated correctly
+# * Footnotes are collapsed into a single paragraph
require 'rubygems'
require 'rdoc'
@@ -798,11 +799,12 @@ NoteReference = &{ notes? }
RawNoteReference = "[^" < ( !Newline !"]" . )+ > "]" { text }
+# TODO multiple paragraphs for a footnote
Note = &{ notes? }
NonindentSpace RawNoteReference:ref ":" Sp
StartList:a
( RawNoteBlock:l )
- ( &Indent RawNoteBlock { raise " a = cons($$, a); " } )*
+ ( &Indent RawNoteBlock:i { a.concat i } )*
{ a.unshift note ref
@footnotes << RDoc::Markup::Paragraph.new(*a)
nil
View
19 test/test_pegdown.rb
@@ -334,6 +334,25 @@ def test_parse_note
assert_equal expected, doc
end
+ def test_parse_note_indent
+ @parser.notes = true
+
+ doc = parse <<-MD
+Some text.[^1]
+
+[^1]: With a footnote
+
+ more
+ MD
+
+ expected = doc(
+ para("Some text.{*1}[rdoc-label:foottext-1:footmark-1]"),
+ @RM::Rule.new(1),
+ para("{^1}[rdoc-label:footmark-1:foottext-1] With a footnote\n\nmore\n"))
+
+ assert_equal expected, doc
+ end
+
def test_parse_note_inline
@parser.notes = true
Please sign in to comment.
Something went wrong with that request. Please try again.