getReferences() {
return references;
diff --git a/src/main/java/org/pegdown/ast/Visitor.java b/src/main/java/org/pegdown/ast/Visitor.java
index 7cc4269..e941bad 100644
--- a/src/main/java/org/pegdown/ast/Visitor.java
+++ b/src/main/java/org/pegdown/ast/Visitor.java
@@ -28,6 +28,8 @@ public interface Visitor {
void visit(DefinitionListNode node);
void visit(DefinitionNode node);
void visit(DefinitionTermNode node);
+ void visit(FootnoteNode node);
+ void visit(FootnoteRefNode node);
void visit(ExpImageNode node);
void visit(ExpLinkNode node);
void visit(HeaderNode node);
diff --git a/src/test/resources/OptionalExtensions/footnotes-ext.ast b/src/test/resources/OptionalExtensions/footnotes-ext.ast
new file mode 100644
index 0000000..0b4f1d8
--- /dev/null
+++ b/src/test/resources/OptionalExtensions/footnotes-ext.ast
@@ -0,0 +1,22 @@
+RootNode [0-403]
+ ParaNode [0-61]
+ SuperNode [0-61]
+ TextNode [0-29] 'This paragraph has a footnote'
+ FootnoteRefNode [29-33] '[^1]'
+ TextNode [33-54] ' and another footnote'
+ FootnoteRefNode [54-60] '[^two]'
+ SpecialTextNode [60-61] '.'
+ ParaNode [63-119]
+ SuperNode [63-119]
+ TextNode [63-100] 'This one has more but out of sequence'
+ FootnoteRefNode [100-104] '[^4]'
+ TextNode [104-109] ' and '
+ FootnoteRefNode [109-117] '[^eight]'
+ SpecialTextNode [117-118] '.'
+ TextNode [118-119] ' '
+ FootnoteNode [122-195] '[^two]: '
+ FootnoteNode [201-217] '[^1]: '
+ FootnoteNode [219-292] '[^un-used]: '
+ FootnoteNode [294-324] '[^4]: '
+ FootnoteNode [326-358] '[^eight]: '
+ FootnoteNode [360-403] '[^another_unused]: '
diff --git a/src/test/resources/OptionalExtensions/footnotes-ext.html b/src/test/resources/OptionalExtensions/footnotes-ext.html
new file mode 100644
index 0000000..6993ecb
--- /dev/null
+++ b/src/test/resources/OptionalExtensions/footnotes-ext.html
@@ -0,0 +1,10 @@
+This paragraph has a footnote and another footnote.
+This one has more but out of sequence and .
diff --git a/src/test/resources/OptionalExtensions/footnotes-no-ext.ast b/src/test/resources/OptionalExtensions/footnotes-no-ext.ast
new file mode 100644
index 0000000..ceaee5a
--- /dev/null
+++ b/src/test/resources/OptionalExtensions/footnotes-no-ext.ast
@@ -0,0 +1,75 @@
+RootNode [0-403]
+ ParaNode [0-61]
+ SuperNode [0-61]
+ TextNode [0-29] 'This paragraph has a footnote'
+ RefLinkNode [29-33]
+ SuperNode [0-0]
+ TextNode [30-32] '^1'
+ TextNode [33-54] ' and another footnote'
+ RefLinkNode [54-60]
+ SuperNode [0-0]
+ TextNode [55-59] '^two'
+ SpecialTextNode [60-61] '.'
+ ParaNode [63-119]
+ SuperNode [63-119]
+ TextNode [63-100] 'This one has more but out of sequence'
+ RefLinkNode [100-104]
+ SuperNode [0-0]
+ TextNode [101-103] '^4'
+ TextNode [104-109] ' and '
+ RefLinkNode [109-117]
+ SuperNode [0-0]
+ TextNode [110-116] '^eight'
+ SpecialTextNode [117-118] '.'
+ TextNode [118-119] ' '
+ ParaNode [122-195]
+ SuperNode [122-195]
+ RefLinkNode [122-128]
+ SuperNode [0-0]
+ TextNode [123-127] '^two'
+ SpecialTextNode [128-129] ':'
+ TextNode [129-161] ' Footnote 2 with a bit more text'
+ SimpleNode [161-162] Linebreak
+ TextNode [162-195] ' and another continuation line'
+ ParaNode [201-217]
+ SuperNode [201-217]
+ RefLinkNode [201-205]
+ SuperNode [0-0]
+ TextNode [202-204] '^1'
+ SpecialTextNode [205-206] ':'
+ TextNode [206-217] ' Footnote 1'
+ ParaNode [219-292]
+ SuperNode [219-292]
+ RefLinkNode [219-229]
+ SuperNode [0-0]
+ TextNode [220-223] '^un'
+ SpecialTextNode [223-224] '-'
+ TextNode [224-228] 'used'
+ SpecialTextNode [229-230] ':'
+ TextNode [230-291] ' Unused footnote, it will not be added to the end of the page'
+ SpecialTextNode [291-292] '.'
+ ParaNode [294-324]
+ SuperNode [294-324]
+ RefLinkNode [294-298]
+ SuperNode [0-0]
+ TextNode [295-297] '^4'
+ SpecialTextNode [298-299] ':'
+ TextNode [299-324] ' Out of sequence footnote'
+ ParaNode [326-358]
+ SuperNode [326-358]
+ RefLinkNode [326-334]
+ SuperNode [0-0]
+ TextNode [327-333] '^eight'
+ SpecialTextNode [334-335] ':'
+ TextNode [335-357] ' Have one that is used'
+ SpecialTextNode [357-358] '.'
+ ParaNode [360-403]
+ SuperNode [360-403]
+ RefLinkNode [360-377]
+ SuperNode [0-0]
+ TextNode [361-369] '^another'
+ SpecialTextNode [369-370] '_'
+ TextNode [370-376] 'unused'
+ SpecialTextNode [377-378] ':'
+ TextNode [378-402] ' This will not be output'
+ SpecialTextNode [402-403] '.'
diff --git a/src/test/resources/OptionalExtensions/footnotes-no-ext.html b/src/test/resources/OptionalExtensions/footnotes-no-ext.html
new file mode 100644
index 0000000..3992286
--- /dev/null
+++ b/src/test/resources/OptionalExtensions/footnotes-no-ext.html
@@ -0,0 +1,12 @@
+This paragraph has a footnote[^1] and another
+footnote[^two].
+This one has more but out of sequence[^4] and [^eight].
+[^two]: Footnote 2 with a bit more text
+ and another continuation line
+[^1]: Footnote 1
+[^un-used]: Unused footnote, it will not be added to the end of
+the page.
+[^4]: Out of sequence footnote
+[^eight]: Have one that is used.
+[^another_unused]: This will not be output.
+
diff --git a/src/test/resources/OptionalExtensions/footnotes.md b/src/test/resources/OptionalExtensions/footnotes.md
new file mode 100644
index 0000000..1da34f1
--- /dev/null
+++ b/src/test/resources/OptionalExtensions/footnotes.md
@@ -0,0 +1,17 @@
+This paragraph has a footnote[^1] and another footnote[^two].
+
+This one has more but out of sequence[^4] and [^eight].
+
+
+[^two]: Footnote 2 with a bit more text
+ and another continuation line
+
+[^1]: Footnote 1
+
+[^un-used]: Unused footnote, it will not be added to the end of the page.
+
+[^4]: Out of sequence footnote
+
+[^eight]: Have one that is used.
+
+[^another_unused]: This will not be output.
diff --git a/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.ast b/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.ast
index c430abf..5027046 100644
--- a/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.ast
+++ b/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.ast
@@ -1,4 +1,4 @@
-RootNode [0-1235]
+RootNode [0-1336]
ParaNode [0-20]
SuperNode [0-20]
TextNode [0-19] 'A fenced code block'
@@ -18,3 +18,14 @@ RootNode [0-1235]
SuperNode [787-822]
TextNode [787-822] 'test opening with more than 3 ticks'
VerbatimNode [824-1235] 'public static String message(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) {\n return CommonBundle.message(BUNDLE, key, params);\n}\n\npublic static String messageOrBlank(@PropertyKey(resourceBundle = BUNDLE_NAME) String key, Object... params) {\n return CommonBundle.messageOrDefault(BUNDLE, key, "", params);\n}\n```\nshould still be fenced\n`````\nshould still be fenced\n'
+ ParaNode [1236-1303]
+ SuperNode [1236-1303]
+ TextNode [1236-1265] 'test false opening code fence'
+ SimpleNode [1265-1266] Linebreak
+ CodeNode [1266-1283] 'inline code'
+ SimpleNode [1283-1284] Linebreak
+ CodeNode [1284-1303] 'inline code 2'
+ ParaNode [1305-1313]
+ SuperNode [1305-1313]
+ TextNode [1305-1313] 'not code'
+ VerbatimNode [1315-1336] 'fenced block\n'
diff --git a/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.html b/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.html
index a6e4267..66b05e7 100644
--- a/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.html
+++ b/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.html
@@ -48,3 +48,13 @@
`````
should still be fenced
+
+test false opening code fence
+inline code
+inline code 2
+not code
+
+
+fenced block
+
+
diff --git a/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.md b/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.md
index c198d9d..a3ddb5e 100644
--- a/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.md
+++ b/src/test/resources/pegdown/GFM_Fenced_Code_Blocks.md
@@ -47,4 +47,14 @@ public static String messageOrBlank(@PropertyKey(resourceBundle = BUNDLE_NAME) S
should still be fenced
`````
should still be fenced
-````
\ No newline at end of file
+````
+
+test false opening code fence
+```inline code```
+```inline code 2```
+
+not code
+
+```
+fenced block
+```
diff --git a/src/test/resources/pegdown/GFM_Fenced_Code_Blocks_reversed_all.html b/src/test/resources/pegdown/GFM_Fenced_Code_Blocks_reversed_all.html
index a389360..01f3643 100644
--- a/src/test/resources/pegdown/GFM_Fenced_Code_Blocks_reversed_all.html
+++ b/src/test/resources/pegdown/GFM_Fenced_Code_Blocks_reversed_all.html
@@ -57,4 +57,12 @@
+test false opening code fence inline code
+inline code 2
+not code
+
+
+kcolb decnef
+
+
diff --git a/src/test/resources/pegdown/GFM_Fenced_Code_Blocks_reversed_scala.html b/src/test/resources/pegdown/GFM_Fenced_Code_Blocks_reversed_scala.html
index 96f575c..a4cf044 100644
--- a/src/test/resources/pegdown/GFM_Fenced_Code_Blocks_reversed_scala.html
+++ b/src/test/resources/pegdown/GFM_Fenced_Code_Blocks_reversed_scala.html
@@ -50,3 +50,11 @@
should still be fenced
+test false opening code fence inline code
+inline code 2
+not code
+
+
+fenced block
+
+
diff --git a/src/test/resources/pegdown/Tables.html b/src/test/resources/pegdown/Tables.html
index 2548c4e..42afc2f 100644
--- a/src/test/resources/pegdown/Tables.html
+++ b/src/test/resources/pegdown/Tables.html
@@ -100,4 +100,30 @@
this is the caption
-
\ No newline at end of file
+Tables with divider looking table cell:
+
+
+
+ | Name |
+ Firstname |
+ Age |
+
+
+
+
+ | Fox |
+ Peter |
+ 42 |
+
+
+ | —— |
+ ———– |
+ —-: |
+
+
+ | Guy |
+ Ritchie |
+ ca. 60 |
+
+
+
diff --git a/src/test/resources/pegdown/Tables.md b/src/test/resources/pegdown/Tables.md
index 5a12e4d..8e9caaf 100644
--- a/src/test/resources/pegdown/Tables.md
+++ b/src/test/resources/pegdown/Tables.md
@@ -38,3 +38,12 @@ Content | **Cell** | Cell |
New section | More | Data |
And more | | And more |
[this is the caption]
+
+Tables with divider looking table cell:
+
+ Name | Firstname | Age
+------|-----------|----:
+ Fox | Peter | 42
+------|-----------|----:
+ Guy | Ritchie | ca. 60
+
diff --git a/src/test/resources/pegdown/Wikilinks.html b/src/test/resources/pegdown/Wikilinks.html
index 0b53bd9..b8a8539 100644
--- a/src/test/resources/pegdown/Wikilinks.html
+++ b/src/test/resources/pegdown/Wikilinks.html
@@ -1,14 +1,10 @@
-Wikilinks are simple URIs like Autolinks,
-which will be converted by pegdown.
-Another example provides a separate link text page link text,
-which will be converted by pegdown.
-Another example with spaces: Special Chars,
-with square brackets: [Square]Brackets.
+Wikilinks are simple URIs like Autolinks,
which will be converted by pegdown.
+Another example provides a separate link text page link text,
Let’s not forget anchor refs page name#ref,
Let’s not forget anchor refs provides a separate link text page link title text,
which will be converted by pegdown.
+Another example with spaces: Special Chars,
with square brackets: [Square]Brackets.
The following links should work just normally:
diff --git a/src/test/resources/pegdown/Wikilinks.md b/src/test/resources/pegdown/Wikilinks.md
index 83767d0..6325c8c 100644
--- a/src/test/resources/pegdown/Wikilinks.md
+++ b/src/test/resources/pegdown/Wikilinks.md
@@ -4,6 +4,8 @@ Wikilinks are simple URIs like [[Autolinks]],
which will be converted by pegdown.
Another example provides a separate link text [[page name|page link text]],
+Let's not forget anchor refs [[page name#ref]],
+Let's not forget anchor refs provides a separate link text [[page name#ref|page link title text]],
which will be converted by pegdown.
Another example with spaces: [[Special Chars]],
diff --git a/src/test/scala/org/pegdown/AbstractPegDownSpec.scala b/src/test/scala/org/pegdown/AbstractPegDownSpec.scala
index 501a9f8..8760cbc 100644
--- a/src/test/scala/org/pegdown/AbstractPegDownSpec.scala
+++ b/src/test/scala/org/pegdown/AbstractPegDownSpec.scala
@@ -41,7 +41,7 @@ abstract class AbstractPegDownSpec extends Specification {
// actualHtml === ""
// tidy up html for fair equality test
- val tidyHtml = tidy(actualHtml)
+ var tidyHtml = tidy(actualHtml)
normalize(tidyHtml) === normalize(expectedOutput)
}
@@ -88,6 +88,8 @@ abstract class AbstractPegDownSpec extends Specification {
out.toString
}
- def normalize(string: String) = string.replace("\r\n", "\n").replace("\r", "\n")
+ // vsch: seems like there is a bug in Tidy, passing in HTML with
\n results in
\n\n, and passing one with
\n\n results in
\n
+ // didn't look too deep into it but the following for now solves the problem.
+ def normalize(string: String) = string.replace("\r\n", "\n").replace("\r", "\n").replace("
\n\n", "
\n")
}
diff --git a/src/test/scala/org/pegdown/OptionalExtensionsSpec.scala b/src/test/scala/org/pegdown/OptionalExtensionsSpec.scala
index 7f3c33e..017d577 100644
--- a/src/test/scala/org/pegdown/OptionalExtensionsSpec.scala
+++ b/src/test/scala/org/pegdown/OptionalExtensionsSpec.scala
@@ -80,6 +80,26 @@ class OptionalExtensionsSpec extends AbstractPegDownSpec {
implicit val processor = new PegDownProcessor(ALL | EXTANCHORLINKS)
testASTAlt("OptionalExtensions/extanchors", "-ext")
}
+
+ "footnotes-no-ext" in {
+ implicit val processor = new PegDownProcessor(ALL)
+ testAlt("OptionalExtensions/footnotes", "-no-ext")
+ }
+
+ "footnotes-no-ext AST" in {
+ implicit val processor = new PegDownProcessor(ALL)
+ testASTAlt("OptionalExtensions/footnotes", "-no-ext")
+ }
+
+ "footnotes-ext" in {
+ implicit val processor = new PegDownProcessor(ALL | FOOTNOTES)
+ testAlt("OptionalExtensions/footnotes", "-ext")
+ }
+
+ "footnotes-ext AST" in {
+ implicit val processor = new PegDownProcessor(ALL | FOOTNOTES)
+ testASTAlt("OptionalExtensions/footnotes", "-ext")
+ }
}
}
}