From 628c02d37be5a47a071d9a3e4ba90251201da91a Mon Sep 17 00:00:00 2001 From: Daniel Imfeld Date: Sat, 24 May 2014 14:28:37 -0500 Subject: [PATCH] Move footnote prefix to a better place --- html.go | 10 ++++------ inline_test.go | 45 ++++++++++++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/html.go b/html.go index e8d1d2b..6a860a2 100644 --- a/html.go +++ b/html.go @@ -376,20 +376,18 @@ func (options *Html) FootnoteItem(out *bytes.Buffer, name, text []byte, flags in } slug := slugify(name) out.WriteString(`
  • `) out.Write(text) if options.flags&HTML_FOOTNOTE_RETURN_LINKS != 0 { out.WriteString(` `) - out.WriteString(options.parameters.FootnoteReturnLinkContents) - out.WriteString(``) } out.WriteString("
  • \n") @@ -606,12 +604,12 @@ func (options *Html) StrikeThrough(out *bytes.Buffer, text []byte) { func (options *Html) FootnoteRef(out *bytes.Buffer, ref []byte, id int) { slug := slugify(ref) out.WriteString(``) out.WriteString(strconv.Itoa(id)) diff --git a/inline_test.go b/inline_test.go index edda982..d7944d5 100644 --- a/inline_test.go +++ b/inline_test.go @@ -595,10 +595,9 @@ func TestAutoLink(t *testing.T) { doTestsInline(t, tests) } -func TestFootnotes(t *testing.T) { - tests := []string{ - "testing footnotes.[^a]\n\n[^a]: This is the note\n", - `

    testing footnotes.1

    +var footenoteTests = []string{ + "testing footnotes.[^a]\n\n[^a]: This is the note\n", + `

    testing footnotes.1


    @@ -610,7 +609,7 @@ func TestFootnotes(t *testing.T) {
    `, - `testing long[^b] notes. + `testing long[^b] notes. [^b]: Paragraph 1 @@ -622,7 +621,7 @@ func TestFootnotes(t *testing.T) { No longer in the footnote `, - `

    testing long1 notes.

    + `

    testing long1 notes.

    No longer in the footnote

    @@ -644,7 +643,7 @@ some code
    `, - `testing[^c] multiple[^d] notes. + `testing[^c] multiple[^d] notes. [^c]: this is [note] c @@ -658,7 +657,7 @@ what happens here [note]: /link/c `, - `

    testing1 multiple2 notes.

    + `

    testing1 multiple2 notes.

    omg

    @@ -676,8 +675,8 @@ what happens here `, - "testing inline^[this is the note] notes.\n", - `

    testing inline1 notes.

    + "testing inline^[this is the note] notes.\n", + `

    testing inline1 notes.


    @@ -688,8 +687,8 @@ what happens here
    `, - "testing multiple[^1] types^[inline note] of notes[^2]\n\n[^2]: the second deferred note\n[^1]: the first deferred note\n\n\twhich happens to be a block\n", - `

    testing multiple1 types2 of notes3

    + "testing multiple[^1] types^[inline note] of notes[^2]\n\n[^2]: the second deferred note\n[^1]: the first deferred note\n\n\twhich happens to be a block\n", + `

    testing multiple1 types2 of notes3


    @@ -706,13 +705,13 @@ what happens here
    `, - `This is a footnote[^1]^[and this is an inline footnote] + `This is a footnote[^1]^[and this is an inline footnote] [^1]: the footnote text. may be multiple paragraphs. `, - `

    This is a footnote12

    + `

    This is a footnote12


    @@ -727,9 +726,21 @@ what happens here
    `, - "empty footnote[^]\n\n[^]: fn text", - "

    empty footnote1

    \n
    \n\n
    \n\n
      \n
    1. fn text\n
    2. \n
    \n
    \n", + "empty footnote[^]\n\n[^]: fn text", + "

    empty footnote1

    \n
    \n\n
    \n\n
      \n
    1. fn text\n
    2. \n
    \n
    \n", +} + +func TestFootnotes(t *testing.T) { + doTestsInlineParam(t, footenoteTests, EXTENSION_FOOTNOTES, 0) +} + +func TestFootnotesWithParameters(t *testing.T) { + tests := make([]string, len(footnoteTests)) + + prefix := "testPrefix" + for i, test := range footnoteTests { + } - doTestsInlineParam(t, tests, EXTENSION_FOOTNOTES, 0) + doTestsInlineParam(t, tests, EXTENSION_FOOTNOTES, HTML_FOOTNOTE_RETURN_LINKS) }