From 80533218166fd4022864abdb019d768f3cc77de7 Mon Sep 17 00:00:00 2001 From: Bastien Dumont Date: Sat, 29 Oct 2022 19:47:05 +0200 Subject: [PATCH] Cleaned up the repo and updated the test suite --- Makefile | 23 ++ sample.md | 2 + test.md | 16 -- test/sample-context.native | 386 +++++++++++++++++++++++++++++++ test/sample-latex.native | 386 +++++++++++++++++++++++++++++++ test/sample-opendocument.native | 397 ++++++++++++++++++++++++++++++++ test/test-functions.lua | 36 +++ 7 files changed, 1230 insertions(+), 16 deletions(-) create mode 100644 Makefile delete mode 100644 test.md create mode 100644 test/sample-context.native create mode 100644 test/sample-latex.native create mode 100644 test/sample-opendocument.native create mode 100644 test/test-functions.lua diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d9353c6 --- /dev/null +++ b/Makefile @@ -0,0 +1,23 @@ +.PHONY: test-all test-internal + +SHELL=/bin/bash +return_statement_line_number := $(shell grep -nE '^return' text-crossrefs.lua | cut -d ':' -f 1) +line_before_return := $(shell echo $$(($(return_statement_line_number) - 1))) + +test-all: test-internal test-context test-latex test-opendocument + +test-internal: text-crossrefs.lua + -rm --interactive=never test/tmp.lua + sed -n 1,$(line_before_return)p text-crossrefs.lua > test/tmp.lua + cat test/test-functions.lua >> test/tmp.lua + chmod -w test/tmp.lua + pandoc -L test/tmp.lua <<< '' + @echo -e '==========================\nAll internal tests passed.\n==========================\n' + rm --interactive=never test/tmp.lua + +test-%: text-crossrefs.lua sample.md + TESTED_FORMAT=$* pandoc -t native -L text-crossrefs.lua sample.md > test/tmp-$*.native + diff test/tmp-$*.native test/sample-$*.native + @echo -e '\n===============\ntest passed.\n===============\n' + rm test/tmp-$*.native + diff --git a/sample.md b/sample.md index 781f7fb..044150b 100644 --- a/sample.md +++ b/sample.md @@ -1,6 +1,8 @@ --- tcrf-pagenote-separator: '\ (' tcrf-pagenote-at-end: ')' +header-includes: | + \input{tex-aux/tcrfenum} --- (About the notes, see [toc-notes-begin>toc-notes-end]{.tcrf}.) diff --git a/test.md b/test.md deleted file mode 100644 index 8947f69..0000000 --- a/test.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -tcrf-pagenote-separator: '\ (' -tcrf-pagenote-at-end: ')' ---- - -Émile Gaboriau published [_L'Affaire Lerouge_ in -1866]{#publication}.[^1] - -[^1]: It is a very [fine piece of literature]{#my-evaluation}. - -[It was very popular.]{#reception} - -See [publication]{.ref} for the publication date. I expressed -my thoughts about it [my-evaluation]{.ref type=pagenote}. - -Page range: [publication>reception]{.ref} diff --git a/test/sample-context.native b/test/sample-context.native new file mode 100644 index 0000000..68cb961 --- /dev/null +++ b/test/sample-context.native @@ -0,0 +1,386 @@ +[ Para + [ Str "(About" + , Space + , Str "the" + , Space + , Str "notes," + , Space + , Str "see" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "context") + "\\tcrfenum{{toc-notes-begin to toc-notes-end}}" + ] + , Str ".)" + ] +, Para + [ Str "\201mile" + , Space + , Str "Gaboriau" + , Space + , Str "published" + , Space + , Str "" + , Span + ( "publication" , [] , [] ) + [ Emph [ Str "L\8217Affaire" , Space , Str "Lerouge" ] + , Space + , Str "in" + , SoftBreak + , Str "1866" + ] + , Str "." + , RawInline (Format "context") "" + , Note + [ Para + [ Str "It" + , Space + , Str "is" + , Space + , Str "a" + , Space + , Str "very" + , Space + , Str "" + , Span + ( "my-evaluation" , [] , [] ) + [ Str "fine" + , Space + , Str "piece" + , Space + , Str "of" + , Space + , Str "literature" + ] + , Str "." + ] + ] + , RawInline (Format "context") "[note:my-evaluation]" + ] +, Para + [ Str "" + , Span + ( "reception" , [] , [] ) + [ Str "It" + , Space + , Str "was" + , Space + , Str "very" + , Space + , Str "popular." + ] + ] +, Para + [ Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline (Format "context") "\\tcrfenum{{publication}}" ] + , Space + , Str "for" + , Space + , Str "the" + , Space + , Str "publication" + , Space + , Str "date." + , Space + , Str "I" + , Space + , Str "expressed" + , SoftBreak + , Str "my" + , Space + , Str "thoughts" + , Space + , Str "about" + , Space + , Str "it" + , Space + , Str "in" + , Space + , Span + ( "" , [ "tcrf" ] , [ ( "reftype" , "pagenote" ) ] ) + [ RawInline + (Format "context") "\\tcrfenum[pagenote]{{my-evaluation}}" + ] + , Str "." + ] +, Para + [ Str "If" + , Space + , Str "you" + , Space + , Str "want" + , Space + , Str "to" + , Space + , Str "know" + , Space + , Str "more" + , Space + , Str "about" + , Space + , Emph [ Str "L\8217Affaire" , Space , Str "Lerouge" ] + , Str "," + , Space + , Str "see" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "context") "\\tcrfenum{{publication to reception}}" + ] + , Str "." + ] +, Para + [ Str "Here" + , Space + , Str "are" + , Space + , Str "some" + , Space + , Str "precisions." + , RawInline (Format "context") "" + , Note + [ Para + [ Str "" + , Span + ( "format" , [] , [] ) + [ Str "Whatever" , Space , Str "format" ] + , Space + , Str "you" + , Space + , Str "choose," + , Space + , Str "you" + , Space + , Str "can" + , Space + , Str "" + , Span + ( "refer-to-note" , [] , [] ) + [ Str "refer" + , Space + , Str "to" + , Space + , Str "a" + , Space + , Str "note" + ] + , Space + , Str "by" + , Space + , Str "the" + , Space + , Str "identifier" + , Space + , Str "of" + , Space + , Str "" + , Span + ( "which-identifier" , [] , [] ) + [ Str "any" + , Space + , Str "of" + , Space + , Str "its" + , Space + , Str "spans." + , Space + , Str "You" + , Space + , Str "can" + , Space + , Str "even" + , Space + , Str "" + , Span + ( "nested-spans" , [] , [] ) + [ Str "nest" , Space , Str "spans" ] + , Str "!" + ] + ] + ] + , RawInline (Format "context") "[note:format]" + ] +, Para + [ Str "" + , Span + ( "toc-notes-begin" , [] , [] ) + [ Str "I" + , Space + , Str "want" + , Space + , Str "to" + , Space + , Str "refer" + , Space + , Str "to" + , Space + , Str "a" + , Space + , Str "note" + ] + , Str ":" + ] +, BulletList + [ [ Plain + [ Str "How" + , Space + , Str "can" + , Space + , Str "I" + , Space + , Str "refer" + , Space + , Str "to" + , Space + , Str "a" + , Space + , Str "note" + , Space + , Str "by" + , Space + , Str "its" + , Space + , Str "number?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "context") "\\tcrfenum{{refer-to-note}}" + ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "formats" + , Space + , Str "are" + , Space + , Str "supported?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline (Format "context") "\\tcrfenum{{format}}" ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "if" + , Space + , Str "the" + , Space + , Str "note" + , Space + , Str "contains" + , Space + , Str "multiple" + , Space + , Str "spans" + , Space + , Str "with" + , Space + , Str "identifiers?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "context") "\\tcrfenum{{which-identifier}}" + ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "happens" + , Space + , Str "if" + , Space + , Str "a" + , Space + , Str "span" + , Space + , Str "in" + , Space + , Str "contained" + , Space + , Str "in" + , Space + , Str "a" + , Space + , Str "span?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "context") "\\tcrfenum{{nested-spans}}" + ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "are" + , Space + , Str "the" + , Space + , Str "notes?" + , Space + , Str "\8594" + , Space + , Span + ( "" , [ "tcrf" ] , [ ( "reftype" , "note" ) ] ) + [ RawInline + (Format "context") + "\\tcrfenum[note]{{my-evaluation}{format}{refer-to-note}}" + ] + ] + ] + , [ Plain + [ Str "Where" + , Space + , Str "are" + , Space + , Str "the" + , Space + , Str "notes?" + , Space + , Str "\8594" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "context") + "\\tcrfenum{{my-evaluation}{format}}" + ] + ] + ] + ] +, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ] +] diff --git a/test/sample-latex.native b/test/sample-latex.native new file mode 100644 index 0000000..c061200 --- /dev/null +++ b/test/sample-latex.native @@ -0,0 +1,386 @@ +[ Para + [ Str "(About" + , Space + , Str "the" + , Space + , Str "notes," + , Space + , Str "see" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "latex") + "\\tcrfenum{{toc-notes-begin to toc-notes-end}}" + ] + , Str ".)" + ] +, Para + [ Str "\201mile" + , Space + , Str "Gaboriau" + , Space + , Str "published" + , Space + , RawInline (Format "latex") "\\label{publication}" + , Span + ( "publication" , [] , [] ) + [ Emph [ Str "L\8217Affaire" , Space , Str "Lerouge" ] + , Space + , Str "in" + , SoftBreak + , Str "1866" + ] + , Str "." + , RawInline (Format "latex") "" + , Note + [ Para + [ Str "It" + , Space + , Str "is" + , Space + , Str "a" + , Space + , Str "very" + , Space + , RawInline (Format "latex") "\\label{my-evaluation}" + , Span + ( "my-evaluation" , [] , [] ) + [ Str "fine" + , Space + , Str "piece" + , Space + , Str "of" + , Space + , Str "literature" + ] + , Str "." + ] + ] + , RawInline (Format "latex") "" + ] +, Para + [ RawInline (Format "latex") "\\label{reception}" + , Span + ( "reception" , [] , [] ) + [ Str "It" + , Space + , Str "was" + , Space + , Str "very" + , Space + , Str "popular." + ] + ] +, Para + [ Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline (Format "latex") "\\tcrfenum{{publication}}" ] + , Space + , Str "for" + , Space + , Str "the" + , Space + , Str "publication" + , Space + , Str "date." + , Space + , Str "I" + , Space + , Str "expressed" + , SoftBreak + , Str "my" + , Space + , Str "thoughts" + , Space + , Str "about" + , Space + , Str "it" + , Space + , Str "in" + , Space + , Span + ( "" , [ "tcrf" ] , [ ( "reftype" , "pagenote" ) ] ) + [ RawInline + (Format "latex") "\\tcrfenum[pagenote]{{my-evaluation}}" + ] + , Str "." + ] +, Para + [ Str "If" + , Space + , Str "you" + , Space + , Str "want" + , Space + , Str "to" + , Space + , Str "know" + , Space + , Str "more" + , Space + , Str "about" + , Space + , Emph [ Str "L\8217Affaire" , Space , Str "Lerouge" ] + , Str "," + , Space + , Str "see" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "latex") "\\tcrfenum{{publication to reception}}" + ] + , Str "." + ] +, Para + [ Str "Here" + , Space + , Str "are" + , Space + , Str "some" + , Space + , Str "precisions." + , RawInline (Format "latex") "" + , Note + [ Para + [ RawInline (Format "latex") "\\label{format}" + , Span + ( "format" , [] , [] ) + [ Str "Whatever" , Space , Str "format" ] + , Space + , Str "you" + , Space + , Str "choose," + , Space + , Str "you" + , Space + , Str "can" + , Space + , RawInline (Format "latex") "\\label{refer-to-note}" + , Span + ( "refer-to-note" , [] , [] ) + [ Str "refer" + , Space + , Str "to" + , Space + , Str "a" + , Space + , Str "note" + ] + , Space + , Str "by" + , Space + , Str "the" + , Space + , Str "identifier" + , Space + , Str "of" + , Space + , RawInline (Format "latex") "\\label{which-identifier}" + , Span + ( "which-identifier" , [] , [] ) + [ Str "any" + , Space + , Str "of" + , Space + , Str "its" + , Space + , Str "spans." + , Space + , Str "You" + , Space + , Str "can" + , Space + , Str "even" + , Space + , RawInline (Format "latex") "\\label{nested-spans}" + , Span + ( "nested-spans" , [] , [] ) + [ Str "nest" , Space , Str "spans" ] + , Str "!" + ] + ] + ] + , RawInline (Format "latex") "" + ] +, Para + [ RawInline (Format "latex") "\\label{toc-notes-begin}" + , Span + ( "toc-notes-begin" , [] , [] ) + [ Str "I" + , Space + , Str "want" + , Space + , Str "to" + , Space + , Str "refer" + , Space + , Str "to" + , Space + , Str "a" + , Space + , Str "note" + ] + , Str ":" + ] +, BulletList + [ [ Plain + [ Str "How" + , Space + , Str "can" + , Space + , Str "I" + , Space + , Str "refer" + , Space + , Str "to" + , Space + , Str "a" + , Space + , Str "note" + , Space + , Str "by" + , Space + , Str "its" + , Space + , Str "number?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline (Format "latex") "\\tcrfenum{{refer-to-note}}" + ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "formats" + , Space + , Str "are" + , Space + , Str "supported?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline (Format "latex") "\\tcrfenum{{format}}" ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "if" + , Space + , Str "the" + , Space + , Str "note" + , Space + , Str "contains" + , Space + , Str "multiple" + , Space + , Str "spans" + , Space + , Str "with" + , Space + , Str "identifiers?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "latex") "\\tcrfenum{{which-identifier}}" + ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "happens" + , Space + , Str "if" + , Space + , Str "a" + , Space + , Str "span" + , Space + , Str "in" + , Space + , Str "contained" + , Space + , Str "in" + , Space + , Str "a" + , Space + , Str "span?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline (Format "latex") "\\tcrfenum{{nested-spans}}" + ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "are" + , Space + , Str "the" + , Space + , Str "notes?" + , Space + , Str "\8594" + , Space + , Span + ( "" , [ "tcrf" ] , [ ( "reftype" , "note" ) ] ) + [ RawInline + (Format "latex") + "\\tcrfenum[note]{{my-evaluation}{format}{refer-to-note}}" + ] + ] + ] + , [ Plain + [ Str "Where" + , Space + , Str "are" + , Space + , Str "the" + , Space + , Str "notes?" + , Space + , Str "\8594" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "latex") "\\tcrfenum{{my-evaluation}{format}}" + ] + ] + ] + ] +, Para + [ RawInline (Format "latex") "\\label{toc-notes-end}" + , Span ( "toc-notes-end" , [] , [] ) [] + ] +] diff --git a/test/sample-opendocument.native b/test/sample-opendocument.native new file mode 100644 index 0000000..d07ef34 --- /dev/null +++ b/test/sample-opendocument.native @@ -0,0 +1,397 @@ +[ Para + [ Str "(About" + , Space + , Str "the" + , Space + , Str "notes," + , Space + , Str "see" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "opendocument") + "pp.\160000\8211000" + ] + , Str ".)" + ] +, Para + [ Str "\201mile" + , Space + , Str "Gaboriau" + , Space + , Str "published" + , Space + , Str "" + , Span + ( "publication" , [] , [] ) + [ Emph [ Str "L\8217Affaire" , Space , Str "Lerouge" ] + , Space + , Str "in" + , SoftBreak + , Str "1866" + ] + , Str "." + , RawInline (Format "opendocument") "" + , Note + [ Para + [ Str "It" + , Space + , Str "is" + , Space + , Str "a" + , Space + , Str "very" + , Space + , Str "" + , Span + ( "my-evaluation" , [] , [] ) + [ Str "fine" + , Space + , Str "piece" + , Space + , Str "of" + , Space + , Str "literature" + ] + , Str "." + ] + ] + , RawInline (Format "opendocument") "" + ] +, Para + [ Str "" + , Span + ( "reception" , [] , [] ) + [ Str "It" + , Space + , Str "was" + , Space + , Str "very" + , Space + , Str "popular." + ] + ] +, Para + [ Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "opendocument") + "p.\160000" + ] + , Space + , Str "for" + , Space + , Str "the" + , Space + , Str "publication" + , Space + , Str "date." + , Space + , Str "I" + , Space + , Str "expressed" + , SoftBreak + , Str "my" + , Space + , Str "thoughts" + , Space + , Str "about" + , Space + , Str "it" + , Space + , Str "in" + , Space + , Span + ( "" , [ "tcrf" ] , [ ( "reftype" , "pagenote" ) ] ) + [ RawInline + (Format "opendocument") + "p.\160000\160(n.\160000)" + ] + , Str "." + ] +, Para + [ Str "If" + , Space + , Str "you" + , Space + , Str "want" + , Space + , Str "to" + , Space + , Str "know" + , Space + , Str "more" + , Space + , Str "about" + , Space + , Emph [ Str "L\8217Affaire" , Space , Str "Lerouge" ] + , Str "," + , Space + , Str "see" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "opendocument") + "pp.\160000\8211000" + ] + , Str "." + ] +, Para + [ Str "Here" + , Space + , Str "are" + , Space + , Str "some" + , Space + , Str "precisions." + , RawInline (Format "opendocument") "" + , Note + [ Para + [ Str "" + , Span + ( "format" , [] , [] ) + [ Str "Whatever" , Space , Str "format" ] + , Space + , Str "you" + , Space + , Str "choose," + , Space + , Str "you" + , Space + , Str "can" + , Space + , Str "" + , Span + ( "refer-to-note" , [] , [] ) + [ Str "refer" + , Space + , Str "to" + , Space + , Str "a" + , Space + , Str "note" + ] + , Space + , Str "by" + , Space + , Str "the" + , Space + , Str "identifier" + , Space + , Str "of" + , Space + , Str "" + , Span + ( "which-identifier" , [] , [] ) + [ Str "any" + , Space + , Str "of" + , Space + , Str "its" + , Space + , Str "spans." + , Space + , Str "You" + , Space + , Str "can" + , Space + , Str "even" + , Space + , Str "" + , Span + ( "nested-spans" , [] , [] ) + [ Str "nest" , Space , Str "spans" ] + , Str "!" + ] + ] + ] + , RawInline (Format "opendocument") "" + ] +, Para + [ Str "" + , Span + ( "toc-notes-begin" , [] , [] ) + [ Str "I" + , Space + , Str "want" + , Space + , Str "to" + , Space + , Str "refer" + , Space + , Str "to" + , Space + , Str "a" + , Space + , Str "note" + ] + , Str ":" + ] +, BulletList + [ [ Plain + [ Str "How" + , Space + , Str "can" + , Space + , Str "I" + , Space + , Str "refer" + , Space + , Str "to" + , Space + , Str "a" + , Space + , Str "note" + , Space + , Str "by" + , Space + , Str "its" + , Space + , Str "number?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "opendocument") + "p.\160000" + ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "formats" + , Space + , Str "are" + , Space + , Str "supported?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "opendocument") + "p.\160000" + ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "if" + , Space + , Str "the" + , Space + , Str "note" + , Space + , Str "contains" + , Space + , Str "multiple" + , Space + , Str "spans" + , Space + , Str "with" + , Space + , Str "identifiers?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "opendocument") + "p.\160000" + ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "happens" + , Space + , Str "if" + , Space + , Str "a" + , Space + , Str "span" + , Space + , Str "in" + , Space + , Str "contained" + , Space + , Str "in" + , Space + , Str "a" + , Space + , Str "span?" + , Space + , Str "\8594" + , Space + , Str "See" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "opendocument") + "p.\160000" + ] + , Str "." + ] + ] + , [ Plain + [ Str "What" + , Space + , Str "are" + , Space + , Str "the" + , Space + , Str "notes?" + , Space + , Str "\8594" + , Space + , Span + ( "" , [ "tcrf" ] , [ ( "reftype" , "note" ) ] ) + [ RawInline + (Format "opendocument") + "nn.\160000, 000 and 000" + ] + ] + ] + , [ Plain + [ Str "Where" + , Space + , Str "are" + , Space + , Str "the" + , Space + , Str "notes?" + , Space + , Str "\8594" + , Space + , Span + ( "" , [ "tcrf" ] , [] ) + [ RawInline + (Format "opendocument") + "pp.\160000 and 000" + ] + ] + ] + ] +, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ] +] diff --git a/test/test-functions.lua b/test/test-functions.lua new file mode 100644 index 0000000..d9d5c9e --- /dev/null +++ b/test/test-functions.lua @@ -0,0 +1,36 @@ +local refs + +refs = parse_references_enum('mylabel') +assert(#refs == 1) +assert(refs[1].anchor == 'mylabel') +assert(not refs[1].end_of_range) +assert(make_raw_content_tex(refs, 'page', true) + == '\\tcrfenum{{mylabel}}') +assert(make_raw_content_tex(refs, 'page', false) + == '\\tcrfenum[noprefix]{{mylabel}}') +assert(make_raw_content_tex(refs, 'note', true) + == '\\tcrfenum[note]{{mylabel}}') +assert(make_raw_content_tex(refs, 'note', false) + == '\\tcrfenum[note][noprefix]{{mylabel}}') + +refs = parse_references_enum('rangebeg>rangeend') +assert(#refs == 1) +assert(refs[1].anchor == 'rangebeg') +assert(refs[1].end_of_range == 'rangeend') +assert(make_raw_content_tex(refs, 'page', true) + == '\\tcrfenum{{rangebeg to rangeend}}') + +refs = parse_references_enum('first, second') +assert(#refs == 2) +assert(refs[1].anchor == 'first') +assert(refs[2].anchor == 'second') +assert(make_raw_content_tex(refs, 'page', true) + == '\\tcrfenum{{first}{second}}') + +refs = parse_references_enum('first, rangebeg>rangeend') +assert(#refs == 2) +assert(refs[1].anchor == 'first') +assert(refs[2].anchor == 'rangebeg') +assert(refs[2].end_of_range == 'rangeend') +assert(make_raw_content_tex(refs, 'page', true) + == '\\tcrfenum{{first}{rangebeg to rangeend}}')