add a test for issue 10 (footnotes not working)
This commit is contained in:
parent
d8d44deb74
commit
5d66898cd7
|
@ -12,7 +12,7 @@ import (
|
|||
// for each pair of .text/.html files in the given subdirectory
|
||||
// of `./tests' compare the expected html output with
|
||||
// the output of Parser.Markdown.
|
||||
func runDirTests(dir string, t *testing.T) {
|
||||
func runDirTests(dir string, opt *Extensions, t *testing.T) {
|
||||
|
||||
dirPath := filepath.Join("tests", dir)
|
||||
f, err := os.Open(dirPath)
|
||||
|
@ -29,7 +29,7 @@ func runDirTests(dir string, t *testing.T) {
|
|||
var buf bytes.Buffer
|
||||
fHTML := ToHTML(&buf)
|
||||
fGroff := ToGroffMM(&buf)
|
||||
p := NewParser(nil)
|
||||
p := NewParser(opt)
|
||||
for _, name := range names {
|
||||
if filepath.Ext(name) != ".text" {
|
||||
continue
|
||||
|
@ -75,7 +75,11 @@ func compareOutput(w *bytes.Buffer, f Formatter, ext string, textPath string, p
|
|||
}
|
||||
|
||||
func TestMarkdown103(t *testing.T) {
|
||||
runDirTests("md1.0.3", t)
|
||||
runDirTests("md1.0.3", nil, t)
|
||||
}
|
||||
|
||||
func TestMarkdownIssues(t *testing.T) {
|
||||
runDirTests("issues", &Extensions{Notes: true}, t)
|
||||
}
|
||||
|
||||
// This test will make the test run fail with a
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<p>Here is a footnote reference,<a class="noteref" id="fnref1" href="#fn1" title="Jump to note 1">[1]</a> and another.<a class="noteref" id="fnref2" href="#fn2" title="Jump to note 2">[2]</a></p>
|
||||
|
||||
<p>This paragraph won't be part of the note, because it
|
||||
isn't indented.</p>
|
||||
|
||||
<hr/>
|
||||
<ol id="notes">
|
||||
|
||||
<li id="fn1">
|
||||
<p>Here is the footnote.</p> <a href="#fnref1" title="Jump back to reference">[back]</a>
|
||||
</li>
|
||||
|
||||
<li id="fn2">
|
||||
<p>Here's one with multiple blocks.</p>
|
||||
|
||||
<p>Subsequent paragraphs are indented to show that they
|
||||
belong to the previous footnote.</p>
|
||||
|
||||
<pre><code>{ some.code }
|
||||
</code></pre>
|
||||
|
||||
<p>The whole paragraph can be indented, or just the first
|
||||
line. In this way, multi-paragraph footnotes work like
|
||||
multi-paragraph list items.</p> <a href="#fnref2" title="Jump back to reference">[back]</a>
|
||||
</li>
|
||||
|
||||
</ol>
|
|
@ -0,0 +1,25 @@
|
|||
.P
|
||||
Here is a footnote reference,\*F
|
||||
.FS
|
||||
.P
|
||||
Here is the footnote.
|
||||
.FE
|
||||
and another.\*F
|
||||
.FS
|
||||
.P
|
||||
Here's one with multiple blocks.
|
||||
.P
|
||||
Subsequent paragraphs are indented to show that they
|
||||
belong to the previous footnote.
|
||||
.VERBON 2
|
||||
{ some.code }
|
||||
.VERBOFF
|
||||
.P
|
||||
The whole paragraph can be indented, or just the first
|
||||
line. In this way, multi-paragraph footnotes work like
|
||||
multi-paragraph list items.
|
||||
.FE
|
||||
|
||||
.P
|
||||
This paragraph won't be part of the note, because it
|
||||
isn't indented.
|
|
@ -0,0 +1,17 @@
|
|||
Here is a footnote reference,[^1] and another.[^longnote]
|
||||
|
||||
[^1]: Here is the footnote.
|
||||
|
||||
[^longnote]: Here's one with multiple blocks.
|
||||
|
||||
Subsequent paragraphs are indented to show that they
|
||||
belong to the previous footnote.
|
||||
|
||||
{ some.code }
|
||||
|
||||
The whole paragraph can be indented, or just the first
|
||||
line. In this way, multi-paragraph footnotes work like
|
||||
multi-paragraph list items.
|
||||
|
||||
This paragraph won't be part of the note, because it
|
||||
isn't indented.
|
Loading…
Reference in New Issue