diff --git a/text-crossrefs/README.md b/text-crossrefs/README.md index 38ba13a..e54fc20 100644 --- a/text-crossrefs/README.md +++ b/text-crossrefs/README.md @@ -209,6 +209,7 @@ You can control the placement via the attribute `refanchor`, which can be set to When the value is `both`, _text-crossrefs_ creates two labels by suffixing `-beg` and `-end` to the identifier. +The unsuffixed label remains usable except in Typst. A typical use case is: ``` diff --git a/text-crossrefs/sample-with-options.md b/text-crossrefs/sample-with-options.md index 27930db..91b41fe 100644 --- a/text-crossrefs/sample-with-options.md +++ b/text-crossrefs/sample-with-options.md @@ -46,9 +46,7 @@ Here are some precisions.[^2] * What if the note contains multiple spans with identifiers? → See [which-identifier]{.tcrf reftype="page"}. * What happens if a span is contained in a span? → See [nested-spans]{.tcrf reftype="page"}. * What are the notes? → [my-evaluation ; format ; refer-to-note]{.tcrf} - * Where are the notes? → [my-evaluation;format]{.tcrf reftype="page"} - -[]{#toc-notes-end} + * Where are the notes? → [my-evaluation;format]{.tcrf reftype="page"}[]{#toc-notes-end} [A portion of text that may cross a page break.]{#doubledlbl refanchor=both} diff --git a/text-crossrefs/sample.md b/text-crossrefs/sample.md index 05962c8..8342f7b 100644 --- a/text-crossrefs/sample.md +++ b/text-crossrefs/sample.md @@ -30,9 +30,7 @@ Here are some precisions.[^2] * What if the note contains multiple spans with identifiers? → See [which-identifier]{.tcrf}. * What happens if a span is contained in a span? → See [nested-spans]{.tcrf}. * What are the notes? → [my-evaluation, format, refer-to-note]{.tcrf reftype=note} - * Where are the notes? → [my-evaluation,format]{.tcrf} - -[]{#toc-notes-end} + * Where are the notes? → [my-evaluation,format]{.tcrf}[]{#toc-notes-end} [A portion of text that may cross a page break.]{#doubledlbl refanchor=both} diff --git a/text-crossrefs/test/sample-context-with-options.native b/text-crossrefs/test/sample-context-with-options.native index a9d0753..0c4e209 100644 --- a/text-crossrefs/test/sample-context-with-options.native +++ b/text-crossrefs/test/sample-context-with-options.native @@ -388,10 +388,11 @@ (Format "context") "\\crossrefenum[page]{my-evaluation, format}" ] + , Str "" + , Span ( "toc-notes-end" , [] , [] ) [] ] ] ] -, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ] , Para [ Str "" , Span diff --git a/text-crossrefs/test/sample-context.native b/text-crossrefs/test/sample-context.native index b3e9e04..05611b7 100644 --- a/text-crossrefs/test/sample-context.native +++ b/text-crossrefs/test/sample-context.native @@ -382,10 +382,11 @@ (Format "context") "\\crossrefenum{my-evaluation, format}" ] + , Str "" + , Span ( "toc-notes-end" , [] , [] ) [] ] ] ] -, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ] , Para [ Str "" , Span diff --git a/text-crossrefs/test/sample-latex-with-options.native b/text-crossrefs/test/sample-latex-with-options.native index 8c0cdbc..609abd7 100644 --- a/text-crossrefs/test/sample-latex-with-options.native +++ b/text-crossrefs/test/sample-latex-with-options.native @@ -385,10 +385,11 @@ (Format "latex") "\\crossrefenum[page]{my-evaluation, format}" ] + , Str "" + , Span ( "toc-notes-end" , [] , [] ) [] ] ] ] -, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ] , Para [ Str "" , Span diff --git a/text-crossrefs/test/sample-latex.native b/text-crossrefs/test/sample-latex.native index 1829d06..bbeb1fd 100644 --- a/text-crossrefs/test/sample-latex.native +++ b/text-crossrefs/test/sample-latex.native @@ -379,10 +379,11 @@ (Format "latex") "\\crossrefenum{my-evaluation, format}" ] + , Str "" + , Span ( "toc-notes-end" , [] , [] ) [] ] ] ] -, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ] , Para [ Str "" , Span diff --git a/text-crossrefs/test/sample-opendocument-with-options.native b/text-crossrefs/test/sample-opendocument-with-options.native index cb02538..ea43d4c 100644 --- a/text-crossrefs/test/sample-opendocument-with-options.native +++ b/text-crossrefs/test/sample-opendocument-with-options.native @@ -390,10 +390,11 @@ (Format "opendocument") "pages\160000; and 000" ] + , Str "" + , Span ( "toc-notes-end" , [] , [] ) [] ] ] ] -, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ] , Para [ Str "" , Span diff --git a/text-crossrefs/test/sample-opendocument.native b/text-crossrefs/test/sample-opendocument.native index a5dd919..a5c221b 100644 --- a/text-crossrefs/test/sample-opendocument.native +++ b/text-crossrefs/test/sample-opendocument.native @@ -390,10 +390,11 @@ (Format "opendocument") "pp.\160000 and 000" ] + , Str "" + , Span ( "toc-notes-end" , [] , [] ) [] ] ] ] -, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ] , Para [ Str "" , Span diff --git a/text-crossrefs/test/sample-typst-with-options.native b/text-crossrefs/test/sample-typst-with-options.native index 4fa2cde..89668a8 100644 --- a/text-crossrefs/test/sample-typst-with-options.native +++ b/text-crossrefs/test/sample-typst-with-options.native @@ -390,10 +390,11 @@ (Format "typst") "pages\160#ref(form: \"page\", ); and #ref(form: \"page\", )" ] + , Str "" + , Span ( "toc-notes-end" , [] , [] ) [] ] ] ] -, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ] , Para [ Str "" , Span diff --git a/text-crossrefs/test/sample-typst.native b/text-crossrefs/test/sample-typst.native index 9f341af..b5d94e4 100644 --- a/text-crossrefs/test/sample-typst.native +++ b/text-crossrefs/test/sample-typst.native @@ -389,10 +389,11 @@ (Format "typst") "pp.\160#ref(form: \"page\", ) and #ref(form: \"page\", )" ] + , Str "" + , Span ( "toc-notes-end" , [] , [] ) [] ] ] ] -, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ] , Para [ Str "" , Span diff --git a/text-crossrefs/text-crossrefs.lua b/text-crossrefs/text-crossrefs.lua index 0507c22..f083c5c 100644 --- a/text-crossrefs/text-crossrefs.lua +++ b/text-crossrefs/text-crossrefs.lua @@ -236,6 +236,8 @@ local function control_label_placement(span) elseif label_placement == 'both' then span.content:insert(1, pandoc.Span({}, { id = id .. '-beg' })) -- for DOCX/ODT span.content:insert(pandoc.Span({}, { id = id .. '-end' })) + -- Typst does not allow multiple labels on the same content. + if FORMAT== 'typst' then span.identifier = '' end else warning('Invalid value ' .. label_placement .. ' on attribute ' .. PLACE_LABEL_ATTR .. ': ' .. 'shoud be “beg”, “end” or “both”. Falling back to Pandoc’s default.')