diff options
| author | Shulhan <ms@kilabit.info> | 2022-10-20 04:48:20 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-10-20 22:09:31 +0700 |
| commit | 26c0d32b05eefb9b7040be69717d58e62bbdac2f (patch) | |
| tree | 86d02f3bd444b5148733cee1dca2756bff1c1f3a /inline_parser_test.go | |
| parent | dc6f1e2a3e720b706dbf945ae6b608199f630fb4 (diff) | |
| download | asciidoctor-go-26c0d32b05eefb9b7040be69717d58e62bbdac2f.tar.xz | |
all: implement macro "footnote:"
Macro footnote grammar,
----
"footnote:" [ REF_ID ] "[" STRING "]"
----
In asciidoctor, footnote can be placed anywhere, even after WORD without
space in between.
The REF_ID, define the unique ID for footnote and can be used to reference
the previous footnote.
The first footnote with REF_ID, should have the STRING defined.
The next footnote with the same REF_ID, should not have the STRING
defined; if its defined, the STRING is ignored.
Diffstat (limited to 'inline_parser_test.go')
| -rw-r--r-- | inline_parser_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/inline_parser_test.go b/inline_parser_test.go index 62c4f74..0fd62bf 100644 --- a/inline_parser_test.go +++ b/inline_parser_test.go @@ -96,3 +96,39 @@ func TestInlineParser_parseInlineID_isForToC(t *testing.T) { test.Assert(t, c.content, c.exp, got) } } + +func TestInlineParser_macro_footnote(t *testing.T) { + var ( + testFiles = []string{ + `testdata/inline_parser/macro_footnote_test.txt`, + `testdata/inline_parser/macro_footnote_externalized_test.txt`, + } + + testFile string + got bytes.Buffer + tdata *test.Data + doc *Document + exp []byte + err error + ) + + for _, testFile = range testFiles { + tdata, err = test.LoadData(testFile) + if err != nil { + t.Fatalf(`%s: %s`, testFile, err) + } + + doc = Parse(tdata.Input[`input.adoc`]) + + err = doc.ToHTMLEmbedded(&got) + if err != nil { + t.Fatalf(`%s: %s`, testFile, err) + } + + exp = tdata.Output[`output.html`] + + test.Assert(t, testFile, string(exp), got.String()) + + got.Reset() + } +} |
