text-crossrefs: Typst + testing, coding and documentation improvements
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright © 2024 Bastien Dumont
|
||||
Copyright © 2024–2025 Bastien Dumont
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@ -4,7 +4,12 @@ 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
|
||||
README.pdf: README.md
|
||||
sed -E 's/(C?[Lo]?[an]?TeXt?)/\\\1{}/g' $< | \
|
||||
sed '7s/^/\\def\\ConTeXt{C\\kern-.0333em on\\kern-.0667em\\TeX\\kern-.0333em t}\\pagebreak /' | \
|
||||
pandoc -M colorlinks=true --toc -N --syntax-highlighting=none -o $@
|
||||
|
||||
test-all: test-internal test-context test-latex test-opendocument test-typst
|
||||
|
||||
test-internal: text-crossrefs.lua
|
||||
-rm --interactive=never test/tmp.lua
|
||||
@ -15,9 +20,15 @@ test-internal: text-crossrefs.lua
|
||||
@echo -e '==========================\nAll internal tests passed.\n==========================\n'
|
||||
rm --interactive=never test/tmp.lua
|
||||
|
||||
samples := '' -with-options
|
||||
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
|
||||
|
||||
@$(foreach suffix,$(samples), \
|
||||
TESTED_FORMAT=$* pandoc -t native -L text-crossrefs.lua sample$(suffix).md > test/tmp-$*$(suffix).native ;\
|
||||
diff test/tmp-$*$(suffix).native test/sample-$*$(suffix).native ;\
|
||||
if [[ $$? == 0 ]]; then \
|
||||
echo -e '\n=== $*$(suffix): passed\n' ;\
|
||||
else \
|
||||
echo -e '\n=== $*$(suffix): FAILED\n' ;\
|
||||
fi ;\
|
||||
rm test/tmp-$*$(suffix).native ;\
|
||||
)
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
# text-crossrefs: cross-references to arbitrary portions of text in Pandoc
|
||||
---
|
||||
title: "text-crossrefs: cross-references to arbitrary portions of text in Pandoc"
|
||||
author: "Bastien Dumont (`bastien.dumont [at] posteo.net`)"
|
||||
date: 2025/12/21
|
||||
---
|
||||
|
||||
This filter extends Pandoc's cross-referencing abilities
|
||||
with references to any portion of text
|
||||
@ -11,16 +15,17 @@ It currently supports the following output formats:
|
||||
* latex
|
||||
* odt
|
||||
* opendocument
|
||||
* typst
|
||||
|
||||
## Format-specific preliminary notices
|
||||
# Format-specific preliminary notices
|
||||
|
||||
### DOCX and ODT/Opendocument
|
||||
## DOCX and ODT/Opendocument
|
||||
|
||||
When opening for the first time a file produced by Pandoc with _text-crossrefs_,
|
||||
you should have to refresh the fields in order to get the correct values.
|
||||
In LibreOffice, press `F9`; in Word, a dialog box should appear when the file opens.
|
||||
|
||||
### ConTeXt specifically
|
||||
## ConTeXt specifically
|
||||
|
||||
Your template should include the following directive before `\starttext`
|
||||
(as in the default template for ConTeXt):
|
||||
@ -31,7 +36,7 @@ $header-includes$
|
||||
$endfor$
|
||||
```
|
||||
|
||||
### All TeX-based formats
|
||||
## All TeX-based formats
|
||||
|
||||
All references are wrapped in a macro named `\crossrefenum`.
|
||||
It has two optional arguments:
|
||||
@ -41,17 +46,19 @@ the second indicates whether the prefix (e.g. “p. ”) should be printed or
|
||||
The default values for these arguments should match
|
||||
those of `tcrf-default-reftype` and `tcrf-default-prefixref`
|
||||
(resp. `page` and `yes`, i.e. `withprefix`).
|
||||
The mandatory argument of `\crossrefenum` is a group enclosing one or more groups.
|
||||
Each of them contain a reference (either a single reference or a range).
|
||||
The mandatory argument of `\crossrefenum` is a list of references (possibly ranges).
|
||||
|
||||
Here are some valid invocations:
|
||||
|
||||
* `\crossrefenum[note][withprefix]{{lblone}{lbltwo}{lblthree}}`
|
||||
* `\crossrefenum[page][noprefix]{{lblone}{lbltwo}{lblthree}}`
|
||||
* `\crossrefenum[noprefix]{{lblone}{lbltwo}{lblthree}}` (the first argument defaults to `page`)
|
||||
* `\crossrefenum{{lblone}{lbltwo}{lblthree}}` (the second argument defaults to `withprefix`)
|
||||
* `\crossrefenum{{only-one}}` (even if the enumeration is limited to one item, it must be in a group)
|
||||
* `\crossrefenum{{lblone to lbltwo}{lblthree}}` (the first reference points to a range)
|
||||
* `\crossrefenum[note][withprefix]{lblone, lbltwo, lblthree}`
|
||||
* `\crossrefenum[page][noprefix]{lblone, lbltwo, lblthree}`
|
||||
* `\crossrefenum[noprefix]{lblone, lbltwo, lblthree}` (the first argument defaults to `page`)
|
||||
* `\crossrefenum{lblone, lbltwo, lblthree}` (the second argument defaults to `withprefix`)
|
||||
* `\crossrefenum{only-one}`
|
||||
* `\crossrefenum{lblone to lbltwo, lblthree}` (the first reference points to a range)
|
||||
|
||||
> **For users from before December 2025**: the formatting
|
||||
> of the main argument of `\crossrefenum` [changed](#breaking-comma-crfnm).
|
||||
|
||||
It is up to you to define `\crossrefenum` in your preamble.
|
||||
If your target format is LaTeX, it should be possible to define it as a wrapper
|
||||
@ -91,9 +98,53 @@ Here are some hints about the implementation of the `\crossrefenum` macro:
|
||||
|
||||
```
|
||||
|
||||
## Usage
|
||||
## Typst {#typst}
|
||||
|
||||
### Basics
|
||||
You can either get an equivalent of `\crossrefenum` in Typst,
|
||||
the implementation of which is to be provided in your document,
|
||||
or simply output consecutive `#ref` commands.
|
||||
The advantage of the first approach is that a `#crossrefenum` command
|
||||
could handle a list of references intelligently
|
||||
(e.g. printing “pp. 1–3 and 5” instead of “pp. 1, 2, 3, 5 and 5”;
|
||||
see [my implementation in TeX](https://ctan.org/pkg/crossrefenum) for more examples).
|
||||
The main drawback is that is has still to be implemented in Typst to date (14 December 2025),
|
||||
which is why `text-crossrefs` uses the second approach by default.
|
||||
|
||||
The `#crossrefenum` command has the following parameters:
|
||||
|
||||
> ```
|
||||
> crossrefenum(
|
||||
> form: str,
|
||||
> prefixed: bool,
|
||||
> array dictionary label,
|
||||
> ) -> content
|
||||
> ```
|
||||
>
|
||||
> **form**: `"normal"`, `"page"`, `"pagenote"`, or an [accepted type](#tex-options)
|
||||
>
|
||||
> **prefixed**: whether to print the prefix (e.g. “p. ”)
|
||||
>
|
||||
> **main argument**: a label, a range, or an array of labels and ranges;
|
||||
> ranges are dictionaries of the form `(beg: <label1>, end: <label2>)`
|
||||
>
|
||||
> To see examples, please convert `sample.md` to Typst using this filter.
|
||||
|
||||
See the [Typst-specific options](#typst-options) to know how to switch to `#crossrefenum`.
|
||||
If you keep the defaults (outputting `#ref` commands),
|
||||
you may wish to set some [formatting options](#docx-odt-options)
|
||||
and to add a show rule for `#ref` to prevent it from typesetting prefixes (e.g. “p. ”)
|
||||
in addition to those that `text-crossrefs` already inserts.
|
||||
|
||||
In the default mode, you can also (ab)use the `note` reference type to refer to
|
||||
a heading, figure or equation by its number, for the `note` reference type
|
||||
is mapped to the `normal` form in Typst, which is common to all these elements:
|
||||
for instance, `[my-lbl]{.tcrf reftype=note}` will be translated as
|
||||
`#ref(<my-lbl>, form: "normal")`, which may be printed as “Section 2”
|
||||
if `my-lbl` is a label attached to a section heading.
|
||||
|
||||
# Usage
|
||||
|
||||
## Basics
|
||||
|
||||
Mark the span of text you want to refer to later
|
||||
with an identifier composed of alphanumeric characters, periods, colons, underscores or hyphens:
|
||||
@ -114,22 +165,23 @@ according to the value of the `reftype` attribute (defaults to `page`).
|
||||
For instance, this:
|
||||
|
||||
``` markdown
|
||||
See [publication]{.tcrf} for the publication date. I gave my
|
||||
opinion in [my-evaluation]{.tcrf reftype=note}, [my-evaluation]{.tcrf}.
|
||||
See [publication]{.tcrf} for the publication date.
|
||||
I gave my opinion in [my-evaluation]{.tcrf reftype=note},
|
||||
[my-evaluation]{.tcrf}.
|
||||
```
|
||||
|
||||
will render in ConTeXt or LaTeX output:
|
||||
will be rendered in ConTeXt or LaTeX output as:
|
||||
|
||||
``` tex
|
||||
See \crossrefenum{{publication}} for the publication date. I expressed
|
||||
my thoughts about it in \crossrefenum[note]{{my-evaluation}},
|
||||
\crossrefenum{{my-evaluation}}.
|
||||
See \crossrefenum{{publication}} for the publication date.
|
||||
I expressed my thoughts about it in
|
||||
\crossrefenum[note]{my-evaluation}, \crossrefenum{my-evaluation}.
|
||||
```
|
||||
|
||||
If you want to give a reference by note _and_ page number like in the example above,
|
||||
you can also use the following shorthand:
|
||||
|
||||
```md
|
||||
``` markdown
|
||||
[my-evaluation]{.tcrf reftype=pagenote}
|
||||
```
|
||||
|
||||
@ -139,17 +191,19 @@ To suppress the prefixes (e.g. “p. ”), you can set the `prefixref` attribu
|
||||
It can be useful, for instance, for small manually formatted indexes[^comma-syntax]:
|
||||
|
||||
``` markdown
|
||||
Gaboriau: [publication, my-evaluation, reception]{.tcrf prefixref=no}
|
||||
Gaboriau:
|
||||
[publication, my-evaluation, reception]{.tcrf prefixref=no}
|
||||
```
|
||||
|
||||
[^comma-syntax]: About the comma-delimited syntax used in this example, see [the section on enumerations below](#enums).
|
||||
|
||||
### Controlling where the label is placed
|
||||
## Controlling where the label is placed
|
||||
|
||||
By default, labels are placed at the beginning of the spans.
|
||||
You can change this via the attribute `refanchor`, which can be set to:
|
||||
By default, most of Pandoc's writers place the labels
|
||||
at the beginning of the span they identify (the Typst writer is an exception).
|
||||
You can control the placement via the attribute `refanchor`, which can be set to:
|
||||
|
||||
* `beg` (default);
|
||||
* `beg`;
|
||||
* `end`;
|
||||
* `both`.
|
||||
|
||||
@ -163,12 +217,13 @@ A typical use case is:
|
||||
See [mylbl-beg>mylbl-end]{.tcrf}.
|
||||
```
|
||||
|
||||
### Page ranges
|
||||
## Page ranges
|
||||
|
||||
You can refer to a page range like this:
|
||||
|
||||
``` markdown
|
||||
If you want to know more about _L'Affaire Lerouge_, see [publication>reception]{.tcrf}.
|
||||
If you want to know more about _L'Affaire Lerouge_,
|
||||
see [publication>reception]{.tcrf}.
|
||||
```
|
||||
|
||||
The separator (here `>`) can be set to any string of characters
|
||||
@ -185,10 +240,10 @@ The syntax of a range is[^customize-range-tex]:
|
||||
|
||||
[^customize-range-tex]: Note that [it can be customized](#tex-options).
|
||||
|
||||
In DOCX and ODT/Opendocument output,
|
||||
In DOCX and ODT/Opendocument output and in the default Typst output,
|
||||
a range will be printed as a range even if the numbers are identical.
|
||||
|
||||
### Enumerations {#enums}
|
||||
## Enumerations {#enums}
|
||||
|
||||
You can enumerate several references as a comma-delimited list, for instance:
|
||||
|
||||
@ -202,12 +257,18 @@ In TeX-based output formats, they will be wrapped in `\crossrefenum` like this
|
||||
and should be collapsed by the macro when it is desirable:
|
||||
|
||||
``` tex
|
||||
\crossrefenum{{ref-one}{ref-two to ref-three}{ref-four}}
|
||||
\crossrefenum{ref-one, ref-two to ref-three, ref-four}
|
||||
```
|
||||
|
||||
## Customization
|
||||
# Customization
|
||||
|
||||
### Common options {#common-opts}
|
||||
Most of the customization variables expect a string.
|
||||
In this case, they must not contain Markdown markup
|
||||
and all breakable spaces must be replaced with the HTML entity ` `:
|
||||
otherwise, only the first word is taken into account and leading and trailing spaces are ignored.
|
||||
See `sample-with-options.md` for examples.
|
||||
|
||||
## Common options {#common-opts}
|
||||
|
||||
The following metadata fields can be set:
|
||||
|
||||
@ -227,7 +288,7 @@ The following metadata fields can be set:
|
||||
* default value for the `reftype` attribute;
|
||||
* defaults to `page`.
|
||||
|
||||
### Options specific to DOCX, ODT/Opendocument and (by default) Typst {#docx-odt-options}
|
||||
## Options specific to DOCX, ODT/Opendocument and (by default) Typst {#docx-odt-options}
|
||||
|
||||
Here are some metadata fields for the `docx`, `odt` and `opendocument` formats.
|
||||
They are also used for `typst` unless [`tcrf-typst-crossrefenum` is set to `true`](#typst-options)
|
||||
@ -274,7 +335,7 @@ They are also used for `typst` unless [`tcrf-typst-crossrefenum` is set to `true
|
||||
* the string inserted between the two last elements in an enumeration;
|
||||
* defaults to `and` surrounded with spaces.
|
||||
|
||||
### Options specific to the formats based on TeX {#tex-options}
|
||||
## Options specific to the formats based on TeX {#tex-options}
|
||||
|
||||
Since TeX is extensible, you may wish to support types
|
||||
other than `page`, `note` and `pagenote` for ConTeXt and LaTeX output.
|
||||
@ -295,7 +356,18 @@ In addition, the following metadata field can be used to control the rendering o
|
||||
* the delimiter between the labels of a range in the TeX output file;
|
||||
* defaults to `to` surrounded with spaces.
|
||||
|
||||
## Compatibility with other filters
|
||||
## Options specific to Typst {#typst-options}
|
||||
|
||||
If the metadata field `tcrf-typst-crossrefenum` is set to `true` (defaults to `false`),
|
||||
`text-crossrefs` will output `#crossrefenum` commands
|
||||
modeled after the `\crossrefenum` macro for TeX-based formats (see [above](#typst)).
|
||||
The implementation of this command must be provided by the user.
|
||||
In this case, the metadata fields [specific to TeX](#tex-options) will be taken into account.
|
||||
|
||||
Otherwise, `text-crossrefs` will only output native `#ref` commands.
|
||||
In this case, the metadata fields [specific to DOCX and ODT](#docx-odt-options) will be used.
|
||||
|
||||
# Compatibility with other filters
|
||||
|
||||
_text-crossrefs_ must be run after all filters that may create, delete or move footnotes, such as citeproc.
|
||||
|
||||
@ -328,3 +400,16 @@ not that:
|
||||
Until December 2025, `yes`, `no`, `true` and `false` as metadata values
|
||||
had to be put within double quotes. Now, they must not be quoted at all,
|
||||
which is a more standard way to handle boolean values in YAML.
|
||||
|
||||
From December 2025, `text-crossrefs` formats
|
||||
[the main argument of `\crossrefenum`]{#breaking-comma-crfnm}
|
||||
as a comma-delimited list, not as a list of groups.
|
||||
This is in line the new, more readable formatting implemented in the version 1.2
|
||||
of [the _crossrefenum_ TeX package](https://ctan.org/pkg/crossrefenum).
|
||||
|
||||
# License
|
||||
|
||||
Copyright 2024–2025 Bastien Dumont (bastien.dumont [at] posteo.net).
|
||||
|
||||
The program and all related files, including the present documentation,
|
||||
are under the MIT License: see LICENSE for more details.
|
||||
|
||||
59
text-crossrefs/sample-with-options.md
Normal file
59
text-crossrefs/sample-with-options.md
Normal file
@ -0,0 +1,59 @@
|
||||
---
|
||||
tcrf-references-range-separator: '->'
|
||||
tcrf-default-prefixref: no
|
||||
tcrf-default-reftype: note
|
||||
tcrf-page-prefix: 'page '
|
||||
tcrf-pages-prefix: 'pages '
|
||||
tcrf-note-prefix: 'note '
|
||||
tcrf-notes-prefix: 'notes '
|
||||
tcrf-pagenote-separator: ' ('
|
||||
tcrf-pagenote-at-end: ')'
|
||||
tcrf-pagenote-factorize-first-prefix-in-enum: yes
|
||||
tcrf-pagenote-first-type: note
|
||||
tcrf-range-separator: '-'
|
||||
tcrf-references-enum-separator: ';'
|
||||
tcrf-multiple-delimiter: '; '
|
||||
tcrf-multiple-before-last: '; and '
|
||||
tcrf-additional-types:
|
||||
- line
|
||||
tcrf-range-delim-crossrefenum: '\>'
|
||||
header-includes: |
|
||||
\input{crossrefenum}
|
||||
---
|
||||
|
||||
(About the notes, see [toc-notes-begin -> toc-notes-end]{.tcrf reftype="page"}.)
|
||||
|
||||
É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]{.tcrf reftype="page"} for the publication date. I expressed
|
||||
my thoughts about it in [my-evaluation]{.tcrf reftype=pagenote}.
|
||||
|
||||
If you want to know more about _L'Affaire Lerouge_, see [publication->reception]{.tcrf reftype="page"}.
|
||||
|
||||
Here are some precisions.[^2]
|
||||
|
||||
[^2]: [Whatever format]{#format} you choose, you can [refer to a note]{#refer-to-note} by the identifier of [any of its spans. You can even [nest spans]{#nested-spans}!]{#which-identifier}
|
||||
|
||||
[I want to refer to a note]{#toc-notes-begin}:
|
||||
|
||||
* How can I refer to a note by its number? → See [refer-to-note]{.tcrf reftype="page"}.
|
||||
* What formats are supported? → See [format]{.tcrf reftype="page"}.
|
||||
* 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}
|
||||
|
||||
[A portion of text that may cross a page break.]{#doubledlbl refanchor=both}
|
||||
|
||||
[And this one is labelized at the end.]{#lblatend refanchor=end}
|
||||
|
||||
What if you want to refer to the last line, i.e. [lblatend]{.tcrf reftype=line}?
|
||||
|
||||
See [doubledlbl-beg->doubledlbl-end]{.tcrf reftype="page"}.
|
||||
@ -28,9 +28,9 @@ Here are some precisions.[^2]
|
||||
* How can I refer to a note by its number? → See [refer-to-note]{.tcrf}.
|
||||
* What formats are supported? → See [format]{.tcrf}.
|
||||
* What if the note contains multiple spans with identifiers? → See [which-identifier]{.tcrf}.
|
||||
* What happens if a span in contained in a span? → See [nested-spans]{.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}
|
||||
* Where are the notes? → [my-evaluation,format]{.tcrf}
|
||||
|
||||
[]{#toc-notes-end}
|
||||
|
||||
|
||||
592
text-crossrefs/test/sample-context-with-options.native
Normal file
592
text-crossrefs/test/sample-context-with-options.native
Normal file
@ -0,0 +1,592 @@
|
||||
[ Para
|
||||
[ Str "(About"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes,"
|
||||
, Space
|
||||
, Str "see"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum[page]{toc-notes-begin>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") "\\withfirstopt[note:my-evaluation]"
|
||||
, 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") ""
|
||||
]
|
||||
, Para
|
||||
[ Str ""
|
||||
, Span
|
||||
( "reception" , [] , [] )
|
||||
[ Str "It"
|
||||
, Space
|
||||
, Str "was"
|
||||
, Space
|
||||
, Str "very"
|
||||
, Space
|
||||
, Str "popular."
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "context") "\\crossrefenum[page]{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") "\\crossrefenum[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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum[page]{publication>reception}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
, Para
|
||||
[ Str "Here"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "some"
|
||||
, Space
|
||||
, Str "precisions."
|
||||
, RawInline (Format "context") "\\withfirstopt[note:format]"
|
||||
, 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") ""
|
||||
]
|
||||
, 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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum[page]{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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "context") "\\crossrefenum[page]{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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum[page]{which-identifier}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "happens"
|
||||
, Space
|
||||
, Str "if"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "span"
|
||||
, Space
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "contained"
|
||||
, Space
|
||||
, Str "in"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "span?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum[page]{nested-spans}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum{my-evaluation, format, refer-to-note}"
|
||||
]
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "Where"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum[page]{my-evaluation, format}"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ]
|
||||
, Para
|
||||
[ Str ""
|
||||
, Span
|
||||
( "doubledlbl" , [] , [ ( "refanchor" , "both" ) ] )
|
||||
[ Str ""
|
||||
, Span ( "doubledlbl-beg" , [] , [] ) []
|
||||
, Str "A"
|
||||
, Space
|
||||
, Str "portion"
|
||||
, Space
|
||||
, Str "of"
|
||||
, Space
|
||||
, Str "text"
|
||||
, Space
|
||||
, Str "that"
|
||||
, Space
|
||||
, Str "may"
|
||||
, Space
|
||||
, Str "cross"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "page"
|
||||
, Space
|
||||
, Str "break."
|
||||
, Str ""
|
||||
, Span ( "doubledlbl-end" , [] , [] ) []
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Span
|
||||
( "" , [] , [ ( "refanchor" , "end" ) ] )
|
||||
[ Str "And"
|
||||
, Space
|
||||
, Str "this"
|
||||
, Space
|
||||
, Str "one"
|
||||
, Space
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "labelized"
|
||||
, Space
|
||||
, Str "at"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "end."
|
||||
, Str ""
|
||||
, Span ( "lblatend" , [] , [] ) []
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "if"
|
||||
, Space
|
||||
, Str "you"
|
||||
, Space
|
||||
, Str "want"
|
||||
, Space
|
||||
, Str "to"
|
||||
, Space
|
||||
, Str "refer"
|
||||
, Space
|
||||
, Str "to"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "last"
|
||||
, Space
|
||||
, Str "line,"
|
||||
, Space
|
||||
, Str "i.e.\160"
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "line" ) ] )
|
||||
[ RawInline
|
||||
(Format "context") "\\crossrefenum[line]{lblatend}"
|
||||
]
|
||||
, Str "?"
|
||||
]
|
||||
, Para
|
||||
[ Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum[page]{doubledlbl-beg>doubledlbl-end}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
, Para
|
||||
[ Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=typst"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-typst.native"
|
||||
, Space
|
||||
, Str "sample.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=typst"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-typst-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=opendocument"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-opendocument-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=context"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-context-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=latex"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-latex-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -11,7 +11,7 @@
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum{{toc-notes-begin to toc-notes-end}}"
|
||||
"\\crossrefenum{toc-notes-begin to toc-notes-end}"
|
||||
]
|
||||
, Str ".)"
|
||||
]
|
||||
@ -78,8 +78,7 @@
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "context") "\\crossrefenum{{publication}}"
|
||||
[ RawInline (Format "context") "\\crossrefenum{publication}"
|
||||
]
|
||||
, Space
|
||||
, Str "for"
|
||||
@ -107,8 +106,7 @@
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "pagenote" ) ] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum[pagenote]{{my-evaluation}}"
|
||||
(Format "context") "\\crossrefenum[pagenote]{my-evaluation}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
@ -136,7 +134,7 @@
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum{{publication to reception}}"
|
||||
"\\crossrefenum{publication to reception}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
@ -260,7 +258,7 @@
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "context") "\\crossrefenum{{refer-to-note}}"
|
||||
(Format "context") "\\crossrefenum{refer-to-note}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
@ -280,8 +278,7 @@
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline (Format "context") "\\crossrefenum{{format}}"
|
||||
]
|
||||
[ RawInline (Format "context") "\\crossrefenum{format}" ]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
@ -311,8 +308,7 @@
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum{{which-identifier}}"
|
||||
(Format "context") "\\crossrefenum{which-identifier}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
@ -328,7 +324,7 @@
|
||||
, Space
|
||||
, Str "span"
|
||||
, Space
|
||||
, Str "in"
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "contained"
|
||||
, Space
|
||||
@ -345,7 +341,7 @@
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "context") "\\crossrefenum{{nested-spans}}"
|
||||
(Format "context") "\\crossrefenum{nested-spans}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
@ -365,7 +361,7 @@
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "note" ) ] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum[note]{{my-evaluation}{format}{refer-to-note}}"
|
||||
"\\crossrefenum[note]{my-evaluation, format, refer-to-note}"
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -384,7 +380,7 @@
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum{{my-evaluation}{format}}"
|
||||
"\\crossrefenum{my-evaluation, format}"
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -420,9 +416,8 @@
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Str ""
|
||||
, Span
|
||||
( "lblatend" , [] , [ ( "refanchor" , "end" ) ] )
|
||||
[ Span
|
||||
( "" , [] , [ ( "refanchor" , "end" ) ] )
|
||||
[ Str "And"
|
||||
, Space
|
||||
, Str "this"
|
||||
@ -449,7 +444,7 @@
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "context")
|
||||
"\\crossrefenum{{doubledlbl-beg to doubledlbl-end}}"
|
||||
"\\crossrefenum{doubledlbl-beg to doubledlbl-end}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
|
||||
589
text-crossrefs/test/sample-latex-with-options.native
Normal file
589
text-crossrefs/test/sample-latex-with-options.native
Normal file
@ -0,0 +1,589 @@
|
||||
[ Para
|
||||
[ Str "(About"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes,"
|
||||
, Space
|
||||
, Str "see"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex")
|
||||
"\\crossrefenum[page]{toc-notes-begin>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 "latex") ""
|
||||
, 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 "latex") ""
|
||||
]
|
||||
, Para
|
||||
[ Str ""
|
||||
, Span
|
||||
( "reception" , [] , [] )
|
||||
[ Str "It"
|
||||
, Space
|
||||
, Str "was"
|
||||
, Space
|
||||
, Str "very"
|
||||
, Space
|
||||
, Str "popular."
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex") "\\crossrefenum[page]{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") "\\crossrefenum[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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex")
|
||||
"\\crossrefenum[page]{publication>reception}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
, Para
|
||||
[ Str "Here"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "some"
|
||||
, Space
|
||||
, Str "precisions."
|
||||
, RawInline (Format "latex") ""
|
||||
, 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 "latex") ""
|
||||
]
|
||||
, 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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex") "\\crossrefenum[page]{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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex") "\\crossrefenum[page]{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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex")
|
||||
"\\crossrefenum[page]{which-identifier}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "happens"
|
||||
, Space
|
||||
, Str "if"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "span"
|
||||
, Space
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "contained"
|
||||
, Space
|
||||
, Str "in"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "span?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex") "\\crossrefenum[page]{nested-spans}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "latex")
|
||||
"\\crossrefenum{my-evaluation, format, refer-to-note}"
|
||||
]
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "Where"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex")
|
||||
"\\crossrefenum[page]{my-evaluation, format}"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ]
|
||||
, Para
|
||||
[ Str ""
|
||||
, Span
|
||||
( "doubledlbl" , [] , [ ( "refanchor" , "both" ) ] )
|
||||
[ Str ""
|
||||
, Span ( "doubledlbl-beg" , [] , [] ) []
|
||||
, Str "A"
|
||||
, Space
|
||||
, Str "portion"
|
||||
, Space
|
||||
, Str "of"
|
||||
, Space
|
||||
, Str "text"
|
||||
, Space
|
||||
, Str "that"
|
||||
, Space
|
||||
, Str "may"
|
||||
, Space
|
||||
, Str "cross"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "page"
|
||||
, Space
|
||||
, Str "break."
|
||||
, Str ""
|
||||
, Span ( "doubledlbl-end" , [] , [] ) []
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Span
|
||||
( "" , [] , [ ( "refanchor" , "end" ) ] )
|
||||
[ Str "And"
|
||||
, Space
|
||||
, Str "this"
|
||||
, Space
|
||||
, Str "one"
|
||||
, Space
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "labelized"
|
||||
, Space
|
||||
, Str "at"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "end."
|
||||
, Str ""
|
||||
, Span ( "lblatend" , [] , [] ) []
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "if"
|
||||
, Space
|
||||
, Str "you"
|
||||
, Space
|
||||
, Str "want"
|
||||
, Space
|
||||
, Str "to"
|
||||
, Space
|
||||
, Str "refer"
|
||||
, Space
|
||||
, Str "to"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "last"
|
||||
, Space
|
||||
, Str "line,"
|
||||
, Space
|
||||
, Str "i.e.\160"
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "line" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex") "\\crossrefenum[line]{lblatend}"
|
||||
]
|
||||
, Str "?"
|
||||
]
|
||||
, Para
|
||||
[ Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex")
|
||||
"\\crossrefenum[page]{doubledlbl-beg>doubledlbl-end}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
, Para
|
||||
[ Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=typst"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-typst.native"
|
||||
, Space
|
||||
, Str "sample.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=typst"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-typst-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=opendocument"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-opendocument-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=context"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-context-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=latex"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-latex-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -11,7 +11,7 @@
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "latex")
|
||||
"\\crossrefenum{{toc-notes-begin to toc-notes-end}}"
|
||||
"\\crossrefenum{toc-notes-begin to toc-notes-end}"
|
||||
]
|
||||
, Str ".)"
|
||||
]
|
||||
@ -77,8 +77,7 @@
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline (Format "latex") "\\crossrefenum{{publication}}"
|
||||
]
|
||||
[ RawInline (Format "latex") "\\crossrefenum{publication}" ]
|
||||
, Space
|
||||
, Str "for"
|
||||
, Space
|
||||
@ -105,7 +104,7 @@
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "pagenote" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex") "\\crossrefenum[pagenote]{{my-evaluation}}"
|
||||
(Format "latex") "\\crossrefenum[pagenote]{my-evaluation}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
@ -132,8 +131,7 @@
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "latex")
|
||||
"\\crossrefenum{{publication to reception}}"
|
||||
(Format "latex") "\\crossrefenum{publication to reception}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
@ -257,7 +255,7 @@
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "latex") "\\crossrefenum{{refer-to-note}}"
|
||||
(Format "latex") "\\crossrefenum{refer-to-note}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
@ -277,7 +275,7 @@
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline (Format "latex") "\\crossrefenum{{format}}" ]
|
||||
[ RawInline (Format "latex") "\\crossrefenum{format}" ]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
@ -307,7 +305,7 @@
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "latex") "\\crossrefenum{{which-identifier}}"
|
||||
(Format "latex") "\\crossrefenum{which-identifier}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
@ -323,7 +321,7 @@
|
||||
, Space
|
||||
, Str "span"
|
||||
, Space
|
||||
, Str "in"
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "contained"
|
||||
, Space
|
||||
@ -340,7 +338,7 @@
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "latex") "\\crossrefenum{{nested-spans}}"
|
||||
(Format "latex") "\\crossrefenum{nested-spans}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
@ -360,7 +358,7 @@
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "note" ) ] )
|
||||
[ RawInline
|
||||
(Format "latex")
|
||||
"\\crossrefenum[note]{{my-evaluation}{format}{refer-to-note}}"
|
||||
"\\crossrefenum[note]{my-evaluation, format, refer-to-note}"
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -379,7 +377,7 @@
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "latex")
|
||||
"\\crossrefenum{{my-evaluation}{format}}"
|
||||
"\\crossrefenum{my-evaluation, format}"
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -415,9 +413,8 @@
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Str ""
|
||||
, Span
|
||||
( "lblatend" , [] , [ ( "refanchor" , "end" ) ] )
|
||||
[ Span
|
||||
( "" , [] , [ ( "refanchor" , "end" ) ] )
|
||||
[ Str "And"
|
||||
, Space
|
||||
, Str "this"
|
||||
@ -444,7 +441,7 @@
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "latex")
|
||||
"\\crossrefenum{{doubledlbl-beg to doubledlbl-end}}"
|
||||
"\\crossrefenum{doubledlbl-beg to doubledlbl-end}"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
|
||||
595
text-crossrefs/test/sample-opendocument-with-options.native
Normal file
595
text-crossrefs/test/sample-opendocument-with-options.native
Normal file
@ -0,0 +1,595 @@
|
||||
[ Para
|
||||
[ Str "(About"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes,"
|
||||
, Space
|
||||
, Str "see"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "opendocument")
|
||||
"pages\160<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"toc-notes-begin\">000</text:bookmark-ref>-<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"toc-notes-end\">000</text:bookmark-ref>"
|
||||
]
|
||||
, 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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "opendocument")
|
||||
"page\160<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"publication\">000</text:bookmark-ref>"
|
||||
]
|
||||
, 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")
|
||||
"note\160<text:note-ref text:note-class=\"footnote\" text:reference-format=\"text\" text:ref-name=\"ftn0\">000</text:note-ref> (page\160<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"my-evaluation\">000</text:bookmark-ref>)"
|
||||
]
|
||||
, 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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "opendocument")
|
||||
"pages\160<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"publication\">000</text:bookmark-ref>-<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"reception\">000</text:bookmark-ref>"
|
||||
]
|
||||
, 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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "opendocument")
|
||||
"page\160<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"refer-to-note\">000</text:bookmark-ref>"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "formats"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "supported?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "opendocument")
|
||||
"page\160<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"format\">000</text:bookmark-ref>"
|
||||
]
|
||||
, 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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "opendocument")
|
||||
"page\160<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"which-identifier\">000</text:bookmark-ref>"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "happens"
|
||||
, Space
|
||||
, Str "if"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "span"
|
||||
, Space
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "contained"
|
||||
, Space
|
||||
, Str "in"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "span?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "opendocument")
|
||||
"page\160<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"nested-spans\">000</text:bookmark-ref>"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "opendocument")
|
||||
"notes\160<text:note-ref text:note-class=\"footnote\" text:reference-format=\"text\" text:ref-name=\"ftn0\">000</text:note-ref>; <text:note-ref text:note-class=\"footnote\" text:reference-format=\"text\" text:ref-name=\"ftn1\">000</text:note-ref>; and <text:note-ref text:note-class=\"footnote\" text:reference-format=\"text\" text:ref-name=\"ftn1\">000</text:note-ref>"
|
||||
]
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "Where"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "opendocument")
|
||||
"pages\160<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"my-evaluation\">000</text:bookmark-ref>; and <text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"format\">000</text:bookmark-ref>"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ]
|
||||
, Para
|
||||
[ Str ""
|
||||
, Span
|
||||
( "doubledlbl" , [] , [ ( "refanchor" , "both" ) ] )
|
||||
[ Str ""
|
||||
, Span ( "doubledlbl-beg" , [] , [] ) []
|
||||
, Str "A"
|
||||
, Space
|
||||
, Str "portion"
|
||||
, Space
|
||||
, Str "of"
|
||||
, Space
|
||||
, Str "text"
|
||||
, Space
|
||||
, Str "that"
|
||||
, Space
|
||||
, Str "may"
|
||||
, Space
|
||||
, Str "cross"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "page"
|
||||
, Space
|
||||
, Str "break."
|
||||
, Str ""
|
||||
, Span ( "doubledlbl-end" , [] , [] ) []
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Span
|
||||
( "" , [] , [ ( "refanchor" , "end" ) ] )
|
||||
[ Str "And"
|
||||
, Space
|
||||
, Str "this"
|
||||
, Space
|
||||
, Str "one"
|
||||
, Space
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "labelized"
|
||||
, Space
|
||||
, Str "at"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "end."
|
||||
, Str ""
|
||||
, Span ( "lblatend" , [] , [] ) []
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "if"
|
||||
, Space
|
||||
, Str "you"
|
||||
, Space
|
||||
, Str "want"
|
||||
, Space
|
||||
, Str "to"
|
||||
, Space
|
||||
, Str "refer"
|
||||
, Space
|
||||
, Str "to"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "last"
|
||||
, Space
|
||||
, Str "line,"
|
||||
, Space
|
||||
, Str "i.e.\160"
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "line" ) ] )
|
||||
[ RawInline
|
||||
(Format "opendocument")
|
||||
"note\160<text:note-ref text:note-class=\"footnote\" text:reference-format=\"text\" text:ref-name=\"\">000</text:note-ref>"
|
||||
]
|
||||
, Str "?"
|
||||
]
|
||||
, Para
|
||||
[ Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "opendocument")
|
||||
"pages\160<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"doubledlbl-beg\">000</text:bookmark-ref>-<text:bookmark-ref text:reference-format=\"page\" text:ref-name=\"doubledlbl-end\">000</text:bookmark-ref>"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
, Para
|
||||
[ Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=typst"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-typst.native"
|
||||
, Space
|
||||
, Str "sample.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=typst"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-typst-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=opendocument"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-opendocument-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=context"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-context-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=latex"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-latex-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
]
|
||||
]
|
||||
@ -331,7 +331,7 @@
|
||||
, Space
|
||||
, Str "span"
|
||||
, Space
|
||||
, Str "in"
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "contained"
|
||||
, Space
|
||||
@ -424,9 +424,8 @@
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Str ""
|
||||
, Span
|
||||
( "lblatend" , [] , [ ( "refanchor" , "end" ) ] )
|
||||
[ Span
|
||||
( "" , [] , [ ( "refanchor" , "end" ) ] )
|
||||
[ Str "And"
|
||||
, Space
|
||||
, Str "this"
|
||||
|
||||
594
text-crossrefs/test/sample-typst-with-options.native
Normal file
594
text-crossrefs/test/sample-typst-with-options.native
Normal file
@ -0,0 +1,594 @@
|
||||
[ Para
|
||||
[ Str "(About"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes,"
|
||||
, Space
|
||||
, Str "see"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"pages\160#ref(form: \"page\", <toc-notes-begin>)-#ref(form: \"page\", <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 "typst") ""
|
||||
, 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 "typst") "<note:my-evaluation>"
|
||||
]
|
||||
, Para
|
||||
[ Str ""
|
||||
, Span
|
||||
( "reception" , [] , [] )
|
||||
[ Str "It"
|
||||
, Space
|
||||
, Str "was"
|
||||
, Space
|
||||
, Str "very"
|
||||
, Space
|
||||
, Str "popular."
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"page\160#ref(form: \"page\", <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 "typst")
|
||||
"note\160#ref(form: \"normal\", <note:my-evaluation>) (page\160#ref(form: \"page\", <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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"pages\160#ref(form: \"page\", <publication>)-#ref(form: \"page\", <reception>)"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
, Para
|
||||
[ Str "Here"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "some"
|
||||
, Space
|
||||
, Str "precisions."
|
||||
, RawInline (Format "typst") ""
|
||||
, 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 "typst") "<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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"page\160#ref(form: \"page\", <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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"page\160#ref(form: \"page\", <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" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"page\160#ref(form: \"page\", <which-identifier>)"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "happens"
|
||||
, Space
|
||||
, Str "if"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "span"
|
||||
, Space
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "contained"
|
||||
, Space
|
||||
, Str "in"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "span?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"page\160#ref(form: \"page\", <nested-spans>)"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"notes\160#ref(form: \"normal\", <note:my-evaluation>); #ref(form: \"normal\", <note:format>); and #ref(form: \"normal\", <note:format>)"
|
||||
]
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "Where"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"pages\160#ref(form: \"page\", <my-evaluation>); and #ref(form: \"page\", <format>)"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ]
|
||||
, Para
|
||||
[ Str ""
|
||||
, Span
|
||||
( "doubledlbl" , [] , [ ( "refanchor" , "both" ) ] )
|
||||
[ Str ""
|
||||
, Span ( "doubledlbl-beg" , [] , [] ) []
|
||||
, Str "A"
|
||||
, Space
|
||||
, Str "portion"
|
||||
, Space
|
||||
, Str "of"
|
||||
, Space
|
||||
, Str "text"
|
||||
, Space
|
||||
, Str "that"
|
||||
, Space
|
||||
, Str "may"
|
||||
, Space
|
||||
, Str "cross"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "page"
|
||||
, Space
|
||||
, Str "break."
|
||||
, Str ""
|
||||
, Span ( "doubledlbl-end" , [] , [] ) []
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Span
|
||||
( "" , [] , [ ( "refanchor" , "end" ) ] )
|
||||
[ Str "And"
|
||||
, Space
|
||||
, Str "this"
|
||||
, Space
|
||||
, Str "one"
|
||||
, Space
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "labelized"
|
||||
, Space
|
||||
, Str "at"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "end."
|
||||
, Str ""
|
||||
, Span ( "lblatend" , [] , [] ) []
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "if"
|
||||
, Space
|
||||
, Str "you"
|
||||
, Space
|
||||
, Str "want"
|
||||
, Space
|
||||
, Str "to"
|
||||
, Space
|
||||
, Str "refer"
|
||||
, Space
|
||||
, Str "to"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "last"
|
||||
, Space
|
||||
, Str "line,"
|
||||
, Space
|
||||
, Str "i.e.\160"
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "line" ) ] )
|
||||
[ RawInline
|
||||
(Format "typst") "note\160#ref(form: \"normal\", <note:>)"
|
||||
]
|
||||
, Str "?"
|
||||
]
|
||||
, Para
|
||||
[ Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [ ( "reftype" , "page" ) ] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"pages\160#ref(form: \"page\", <doubledlbl-beg>)-#ref(form: \"page\", <doubledlbl-end>)"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
, Para
|
||||
[ Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=typst"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-typst.native"
|
||||
, Space
|
||||
, Str "sample.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=typst"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-typst-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=opendocument"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-opendocument-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=context"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-context-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
, SoftBreak
|
||||
, Quoted
|
||||
DoubleQuote
|
||||
[ Str "TESTED_FORMAT=latex"
|
||||
, Space
|
||||
, Str "pandoc"
|
||||
, Space
|
||||
, Str "-L"
|
||||
, Space
|
||||
, Str "text-crossrefs.lua"
|
||||
, Space
|
||||
, Str "-t"
|
||||
, Space
|
||||
, Str "native"
|
||||
, Space
|
||||
, Str "-o"
|
||||
, Space
|
||||
, Str "test/sample-latex-with-options.native"
|
||||
, Space
|
||||
, Str "sample-with-options.md"
|
||||
]
|
||||
]
|
||||
]
|
||||
458
text-crossrefs/test/sample-typst.native
Normal file
458
text-crossrefs/test/sample-typst.native
Normal file
@ -0,0 +1,458 @@
|
||||
[ Para
|
||||
[ Str "(About"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes,"
|
||||
, Space
|
||||
, Str "see"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"pp.\160#ref(form: \"page\", <toc-notes-begin>)\8211#ref(form: \"page\", <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 "typst") ""
|
||||
, 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 "typst") "<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 "typst") "p.\160#ref(form: \"page\", <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 "typst")
|
||||
"p.\160#ref(form: \"page\", <my-evaluation>)\160(n.\160#ref(form: \"normal\", <note: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 "typst")
|
||||
"pp.\160#ref(form: \"page\", <publication>)\8211#ref(form: \"page\", <reception>)"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
, Para
|
||||
[ Str "Here"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "some"
|
||||
, Space
|
||||
, Str "precisions."
|
||||
, RawInline (Format "typst") ""
|
||||
, 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 "typst") "<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 "typst")
|
||||
"p.\160#ref(form: \"page\", <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 "typst")
|
||||
"p.\160#ref(form: \"page\", <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 "typst")
|
||||
"p.\160#ref(form: \"page\", <which-identifier>)"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "What"
|
||||
, Space
|
||||
, Str "happens"
|
||||
, Space
|
||||
, Str "if"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "span"
|
||||
, Space
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "contained"
|
||||
, Space
|
||||
, Str "in"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "span?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"p.\160#ref(form: \"page\", <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 "typst")
|
||||
"nn.\160#ref(form: \"normal\", <note:my-evaluation>), #ref(form: \"normal\", <note:format>) and #ref(form: \"normal\", <note:format>)"
|
||||
]
|
||||
]
|
||||
]
|
||||
, [ Plain
|
||||
[ Str "Where"
|
||||
, Space
|
||||
, Str "are"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "notes?"
|
||||
, Space
|
||||
, Str "\8594"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"pp.\160#ref(form: \"page\", <my-evaluation>) and #ref(form: \"page\", <format>)"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
, Para [ Str "" , Span ( "toc-notes-end" , [] , [] ) [] ]
|
||||
, Para
|
||||
[ Str ""
|
||||
, Span
|
||||
( "doubledlbl" , [] , [ ( "refanchor" , "both" ) ] )
|
||||
[ Str ""
|
||||
, Span ( "doubledlbl-beg" , [] , [] ) []
|
||||
, Str "A"
|
||||
, Space
|
||||
, Str "portion"
|
||||
, Space
|
||||
, Str "of"
|
||||
, Space
|
||||
, Str "text"
|
||||
, Space
|
||||
, Str "that"
|
||||
, Space
|
||||
, Str "may"
|
||||
, Space
|
||||
, Str "cross"
|
||||
, Space
|
||||
, Str "a"
|
||||
, Space
|
||||
, Str "page"
|
||||
, Space
|
||||
, Str "break."
|
||||
, Str ""
|
||||
, Span ( "doubledlbl-end" , [] , [] ) []
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Span
|
||||
( "" , [] , [ ( "refanchor" , "end" ) ] )
|
||||
[ Str "And"
|
||||
, Space
|
||||
, Str "this"
|
||||
, Space
|
||||
, Str "one"
|
||||
, Space
|
||||
, Str "is"
|
||||
, Space
|
||||
, Str "labelized"
|
||||
, Space
|
||||
, Str "at"
|
||||
, Space
|
||||
, Str "the"
|
||||
, Space
|
||||
, Str "end."
|
||||
, Str ""
|
||||
, Span ( "lblatend" , [] , [] ) []
|
||||
]
|
||||
]
|
||||
, Para
|
||||
[ Str "See"
|
||||
, Space
|
||||
, Span
|
||||
( "" , [ "tcrf" ] , [] )
|
||||
[ RawInline
|
||||
(Format "typst")
|
||||
"pp.\160#ref(form: \"page\", <doubledlbl-beg>)\8211#ref(form: \"page\", <doubledlbl-end>)"
|
||||
]
|
||||
, Str "."
|
||||
]
|
||||
]
|
||||
@ -1,36 +1,41 @@
|
||||
local refs
|
||||
|
||||
local function test(called, expected)
|
||||
assert(called == expected,
|
||||
'Test failed: "' .. tostring(expected) .. '" expected, got "' .. tostring(called) .. '".')
|
||||
end
|
||||
|
||||
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)
|
||||
== '\\crossrefenum{{mylabel}}')
|
||||
assert(make_raw_content_tex(refs, 'page', false)
|
||||
== '\\crossrefenum[noprefix]{{mylabel}}')
|
||||
assert(make_raw_content_tex(refs, 'note', true)
|
||||
== '\\crossrefenum[note]{{mylabel}}')
|
||||
assert(make_raw_content_tex(refs, 'note', false)
|
||||
== '\\crossrefenum[note][noprefix]{{mylabel}}')
|
||||
test(#refs, 1)
|
||||
test(refs[1].anchor, 'mylabel')
|
||||
test(not refs[1].end_of_range, true)
|
||||
test(make_crossrefenum(refs, 'page', true),
|
||||
'\\crossrefenum{mylabel}')
|
||||
test(make_crossrefenum(refs, 'page', false),
|
||||
'\\crossrefenum[noprefix]{mylabel}')
|
||||
test(make_crossrefenum(refs, 'note', true),
|
||||
'\\crossrefenum[note]{mylabel}')
|
||||
test(make_crossrefenum(refs, 'note', false),
|
||||
'\\crossrefenum[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)
|
||||
== '\\crossrefenum{{rangebeg to rangeend}}')
|
||||
test(#refs, 1)
|
||||
test(refs[1].anchor, 'rangebeg')
|
||||
test(refs[1].end_of_range, 'rangeend')
|
||||
test(make_crossrefenum(refs, 'page', true),
|
||||
'\\crossrefenum{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)
|
||||
== '\\crossrefenum{{first}{second}}')
|
||||
test(#refs, 2)
|
||||
test(refs[1].anchor, 'first')
|
||||
test(refs[2].anchor, 'second')
|
||||
test(make_crossrefenum(refs, 'page', true),
|
||||
'\\crossrefenum{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)
|
||||
== '\\crossrefenum{{first}{rangebeg to rangeend}}')
|
||||
test(#refs, 2)
|
||||
test(refs[1].anchor, 'first')
|
||||
test(refs[2].anchor, 'rangebeg')
|
||||
test(refs[2].end_of_range, 'rangeend')
|
||||
test(make_crossrefenum(refs, 'page', true),
|
||||
'\\crossrefenum{first, rangebeg to rangeend}')
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
-- with references to any portion of text
|
||||
-- by its page number, its note number (when applicable)
|
||||
-- or an arbitrary reference type (with ConTeXt or LaTeX output).
|
||||
-- Copyright 2024 Bastien Dumont (bastien.dumont [at] posteo.net)
|
||||
-- Copyright 2024–2025 Bastien Dumont (bastien.dumont [at] posteo.net)
|
||||
-- This file is under the MIT License: see LICENSE for more details
|
||||
|
||||
local stringify = pandoc.utils.stringify
|
||||
@ -53,7 +53,7 @@ local function define_raw_attribute()
|
||||
RAW_ATTRIBUTE = 'openxml'
|
||||
elseif FORMAT == 'odt' or FORMAT == 'opendocument' then
|
||||
RAW_ATTRIBUTE = 'opendocument'
|
||||
elseif FORMAT == 'context' or FORMAT == 'latex' then
|
||||
elseif FORMAT == 'context' or FORMAT == 'latex' or FORMAT == 'typst' then
|
||||
RAW_ATTRIBUTE = FORMAT
|
||||
else
|
||||
error(FORMAT ..
|
||||
@ -62,20 +62,13 @@ local function define_raw_attribute()
|
||||
end
|
||||
|
||||
local function define_label_template()
|
||||
if RAW_ATTRIBUTE == 'opendocument' or RAW_ATTRIBUTE == 'openxml' then
|
||||
local version = pandoc.types.Version
|
||||
if RAW_ATTRIBUTE == 'context' and PANDOC_VERSION < version('2.14') then
|
||||
LABEL_TEMPLATE = '\\pagereference[{{label}}]'
|
||||
elseif RAW_ATTRIBUTE == 'latex' and PANDOC_VERSION < version('3.1.7') then
|
||||
LABEL_TEMPLATE = '\\label{{{label}}}'
|
||||
else
|
||||
IS_LABEL_SET_BY_PANDOC = true
|
||||
elseif RAW_ATTRIBUTE == 'context' then
|
||||
if PANDOC_VERSION < pandoc.types.Version('2.14') then
|
||||
LABEL_TEMPLATE = '\\pagereference[{{label}}]'
|
||||
else
|
||||
IS_LABEL_SET_BY_PANDOC = true
|
||||
end
|
||||
elseif RAW_ATTRIBUTE == 'latex' then
|
||||
if PANDOC_VERSION < pandoc.types.Version('3.1.7') then
|
||||
LABEL_TEMPLATE = '\\label{{{label}}}'
|
||||
else
|
||||
IS_LABEL_SET_BY_PANDOC = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -92,7 +85,7 @@ local config = {
|
||||
multiple_before_last = ' and ',
|
||||
references_range_separator = '>',
|
||||
range_separator = '–',
|
||||
references_enum_separator = ', ',
|
||||
references_enum_separator = ',',
|
||||
only_explicit_labels = false,
|
||||
default_reftype = 'page',
|
||||
default_prefixref = true,
|
||||
@ -108,6 +101,21 @@ local accepted_types = {
|
||||
pagenote = true
|
||||
}
|
||||
|
||||
local TYPST_VARIANT = {
|
||||
get = function(self)
|
||||
error('Attempt to get the Typst variant before it has been set.')
|
||||
end,
|
||||
set = function(self)
|
||||
local variant = 'ref'
|
||||
if RAW_ATTRIBUTE ~= 'typst' then
|
||||
variant = 'none'
|
||||
elseif config.typst_crossrefenum then
|
||||
variant = 'crossrefenum'
|
||||
end
|
||||
self.get = function(self) return variant end
|
||||
end
|
||||
}
|
||||
|
||||
local function format_config_to_openxml()
|
||||
local to_format = { 'page_prefix',
|
||||
'pages_prefix',
|
||||
@ -151,10 +159,13 @@ local function configure(metadata)
|
||||
for item, _ in pairs(config) do
|
||||
set_configuration_item_from_metadata(item, metadata)
|
||||
end
|
||||
TYPST_VARIANT:set()
|
||||
if RAW_ATTRIBUTE == 'openxml' then
|
||||
format_config_to_openxml()
|
||||
end
|
||||
if RAW_ATTRIBUTE == 'context' or RAW_ATTRIBUTE == 'latex' then
|
||||
if RAW_ATTRIBUTE == 'context' or RAW_ATTRIBUTE == 'latex'
|
||||
or TYPST_VARIANT:get() == 'crossrefenum'
|
||||
then
|
||||
for _, additional_type in ipairs(config.additional_types) do
|
||||
accepted_types[additional_type] = true
|
||||
end
|
||||
@ -176,7 +187,9 @@ local text_to_note_labels = {}
|
||||
local function map_span_to_label(span)
|
||||
if RAW_ATTRIBUTE == 'opendocument' then
|
||||
spans_to_note_labels[span.identifier] = 'ftn' .. current_odt_note_index
|
||||
elseif RAW_ATTRIBUTE == 'openxml' or RAW_ATTRIBUTE == 'context' then
|
||||
elseif RAW_ATTRIBUTE == 'openxml' or RAW_ATTRIBUTE == 'context'
|
||||
or RAW_ATTRIBUTE == 'typst'
|
||||
then
|
||||
if is_first_span_in_note then
|
||||
current_note_label = span.identifier
|
||||
is_first_span_in_note = false
|
||||
@ -203,6 +216,7 @@ local function map_spans_to_notelabels(note)
|
||||
if RAW_ATTRIBUTE == 'context'
|
||||
or RAW_ATTRIBUTE == 'opendocument'
|
||||
or RAW_ATTRIBUTE == 'openxml'
|
||||
or RAW_ATTRIBUTE == 'typst'
|
||||
then
|
||||
is_first_span_in_note = true
|
||||
map_spans_to_labels(note)
|
||||
@ -214,16 +228,18 @@ local function control_label_placement(span)
|
||||
local label_placement = span.attributes[PLACE_LABEL_ATTR]
|
||||
if label_placement then
|
||||
local id = span.identifier
|
||||
if label_placement == 'end' then
|
||||
if label_placement == 'beg' then
|
||||
span.content:insert(1, pandoc.Span({}, { id = id }))
|
||||
span.identifier = ''
|
||||
elseif label_placement == 'end' then
|
||||
span.content:insert(pandoc.Span({}, { id = id }))
|
||||
span.identifier = ''
|
||||
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' }))
|
||||
span.identifier = ''
|
||||
elseif label_placement ~= 'beg' then
|
||||
else
|
||||
warning('Invalid value ' .. label_placement .. ' on attribute ' .. PLACE_LABEL_ATTR .. ': ' ..
|
||||
'shoud be “beg” (default), “end” of “both”. Using the defaults.')
|
||||
'shoud be “beg”, “end” or “both”. Falling back to Pandoc’s default.')
|
||||
end
|
||||
end
|
||||
return span
|
||||
@ -308,6 +324,10 @@ end
|
||||
|
||||
-- Gathering of data from the references span
|
||||
|
||||
local function trim_spaces(s)
|
||||
return s:gsub('^ *', ''):gsub(' *$', '')
|
||||
end
|
||||
|
||||
local function new_ref(anchor, end_of_range)
|
||||
-- A ref is a string-indexed table containing an "anchor" field
|
||||
-- and an optionnal "end_of_range" field.
|
||||
@ -335,8 +355,8 @@ local function parse_possible_range(reference)
|
||||
config.references_range_separator,
|
||||
1, true)
|
||||
if delim_beg then
|
||||
range_first = string.sub(reference, 1, delim_beg - 1)
|
||||
range_second = string.sub(reference, delim_end + 1)
|
||||
range_first = trim_spaces(string.sub(reference, 1, delim_beg - 1))
|
||||
range_second = trim_spaces(string.sub(reference, delim_end + 1))
|
||||
end
|
||||
return (range_first or reference), range_second
|
||||
end
|
||||
@ -351,6 +371,7 @@ local function parse_next_reference(raw_references, beg_of_search)
|
||||
local delim_beg, delim_end = string.find(raw_references,
|
||||
config.references_enum_separator,
|
||||
beg_of_search, true)
|
||||
local reference = ''
|
||||
if delim_beg then
|
||||
reference = string.sub(raw_references, beg_of_search, delim_beg - 1)
|
||||
next_ref_beg = delim_end + 1
|
||||
@ -358,6 +379,7 @@ local function parse_next_reference(raw_references, beg_of_search)
|
||||
reference = string.sub(raw_references, beg_of_search)
|
||||
next_ref_beg = #raw_references
|
||||
end
|
||||
reference = trim_spaces(reference)
|
||||
current_ref = new_ref(parse_possible_range(reference))
|
||||
end
|
||||
return current_ref, next_ref_beg
|
||||
@ -380,7 +402,7 @@ local function error_on_attr(attr_key, attr_value, span_content)
|
||||
warning('Invalid value "' .. attr_value .. '" for attribute "' .. attr_key ..
|
||||
'" in the span with class "' .. TEXT_CROSSREF_CLASS ..
|
||||
'" whose content is "' .. stringify(span_content) .. '". ' ..
|
||||
'Using the defaults.')
|
||||
'Falling back to default.')
|
||||
end
|
||||
|
||||
local function get_ref_type(span)
|
||||
@ -415,9 +437,11 @@ end
|
||||
|
||||
local function make_crossrefenum_first_arg(ref_type)
|
||||
local ref_type_is_explicit = ref_type ~= config.default_reftype
|
||||
local arg_template = '[%s]'
|
||||
if RAW_ATTRIBUTE == 'typst' then arg_template = 'form: %s, ' end
|
||||
local crossrefenum_first_arg = ''
|
||||
if ref_type_is_explicit then
|
||||
crossrefenum_first_arg = '[' .. ref_type .. ']'
|
||||
crossrefenum_first_arg = string.format(arg_template, ref_type)
|
||||
end
|
||||
return crossrefenum_first_arg
|
||||
end
|
||||
@ -426,13 +450,23 @@ local function make_crossrefenum_second_arg(is_prefixed)
|
||||
local is_prefixed_is_explicit = is_prefixed ~= config.default_prefixref
|
||||
local crossrefenum_second_arg = ''
|
||||
local is_prefixed_string = ''
|
||||
local arg_template = '[%s]'
|
||||
if RAW_ATTRIBUTE == 'typst' then arg_template = 'prefixed: %s, ' end
|
||||
if is_prefixed_is_explicit then
|
||||
if is_prefixed then
|
||||
is_prefixed_string = 'withprefix'
|
||||
if RAW_ATTRIBUTE == 'typst' then
|
||||
is_prefixed_string = 'true'
|
||||
else
|
||||
is_prefixed_string = 'withprefix'
|
||||
end
|
||||
else
|
||||
is_prefixed_string = 'noprefix'
|
||||
if RAW_ATTRIBUTE == 'typst' then
|
||||
is_prefixed_string = 'false'
|
||||
else
|
||||
is_prefixed_string = 'noprefix'
|
||||
end
|
||||
end
|
||||
crossrefenum_second_arg = '[' .. is_prefixed_string .. ']'
|
||||
crossrefenum_second_arg = string.format(arg_template, is_prefixed_string)
|
||||
end
|
||||
return crossrefenum_second_arg
|
||||
end
|
||||
@ -442,7 +476,7 @@ local function make_crossrefenum_references_list(refs, ref_type)
|
||||
for i = 1, #refs do
|
||||
local ref = refs[i]
|
||||
local anchor = ref.anchor
|
||||
if FORMAT == 'context'
|
||||
if (FORMAT == 'context' or FORMAT == 'typst')
|
||||
and (ref_type == 'note' or ref_type == 'pagenote')
|
||||
then
|
||||
local note_label = text_to_note_labels[anchor]
|
||||
@ -452,26 +486,34 @@ local function make_crossrefenum_references_list(refs, ref_type)
|
||||
warning('Wrong reference to non-existent label "' .. anchor .. '".')
|
||||
end
|
||||
end
|
||||
local texified_ref = '{' .. anchor
|
||||
local formatted = anchor
|
||||
if FORMAT == 'typst' then formatted = '<' .. formatted .. '>' end
|
||||
if ref.end_of_range then
|
||||
texified_ref = texified_ref .. config.range_delim_crossrefenum .. ref.end_of_range
|
||||
if FORMAT == 'typst' then
|
||||
formatted = '(beg: ' .. formatted .. ', end: <' .. ref.end_of_range .. '>)'
|
||||
else
|
||||
formatted = formatted .. config.range_delim_crossrefenum .. ref.end_of_range
|
||||
end
|
||||
end
|
||||
texified_ref = texified_ref .. '}'
|
||||
crossrefenum_references_list = crossrefenum_references_list .. texified_ref
|
||||
if i < #refs then formatted = formatted .. ', ' end
|
||||
crossrefenum_references_list = crossrefenum_references_list .. formatted
|
||||
end
|
||||
if FORMAT == 'typst' and #refs > 1 then
|
||||
crossrefenum_references_list = '(' .. crossrefenum_references_list .. ')'
|
||||
end
|
||||
return crossrefenum_references_list
|
||||
end
|
||||
|
||||
local function make_raw_content_tex(refs, ref_type, is_prefixed)
|
||||
local texified_references = ''
|
||||
texified_references = '\\crossrefenum'
|
||||
.. make_crossrefenum_first_arg(ref_type)
|
||||
.. make_crossrefenum_second_arg(is_prefixed)
|
||||
.. '{' .. make_crossrefenum_references_list(refs, ref_type) .. '}'
|
||||
return texified_references
|
||||
local function make_crossrefenum(refs, ref_type, is_prefixed)
|
||||
local cmd_template = '\\crossrefenum%s%s{%s}'
|
||||
if RAW_ATTRIBUTE == 'typst' then cmd_template = '#crossrefenum(%s%s%s)' end
|
||||
return string.format(cmd_template,
|
||||
make_crossrefenum_first_arg(ref_type),
|
||||
make_crossrefenum_second_arg(is_prefixed),
|
||||
make_crossrefenum_references_list(refs, ref_type))
|
||||
end
|
||||
|
||||
local function make_prefix_xml(ref_type, is_plural)
|
||||
local function make_prefix_per_ref(ref_type, is_plural)
|
||||
local prefix = ''
|
||||
if is_plural then
|
||||
prefix = config[ref_type .. 's_prefix']
|
||||
@ -481,138 +523,146 @@ local function make_prefix_xml(ref_type, is_plural)
|
||||
return prefix
|
||||
end
|
||||
|
||||
local function make_page_reference_xml(target, is_prefixed)
|
||||
local xml_page_ref = ''
|
||||
local function make_page_reference_per_ref(target, is_prefixed)
|
||||
local page_ref = ''
|
||||
if is_prefixed then
|
||||
xml_page_ref = make_prefix_xml('page', false)
|
||||
page_ref = make_prefix_per_ref('page', false)
|
||||
end
|
||||
if RAW_ATTRIBUTE == 'opendocument' then
|
||||
xml_page_ref = xml_page_ref ..
|
||||
page_ref = page_ref ..
|
||||
'<text:bookmark-ref ' ..
|
||||
' text:reference-format="page" text:ref-name="' ..
|
||||
target .. '">000</text:bookmark-ref>'
|
||||
elseif RAW_ATTRIBUTE == 'openxml' then
|
||||
xml_page_ref = xml_page_ref ..
|
||||
page_ref = page_ref ..
|
||||
'<w:r><w:fldChar w:fldCharType="begin" w:dirty="true"/></w:r>' ..
|
||||
'<w:r><w:instrText xml:space="preserve"> PAGEREF ' ..
|
||||
target .. ' \\h </w:instrText></w:r>' ..
|
||||
'<w:r><w:fldChar w:fldCharType="separate"/></w:r>' ..
|
||||
'<w:r><w:t>000</w:t></w:r>' ..
|
||||
'<w:r><w:fldChar w:fldCharType="end"/></w:r>'
|
||||
elseif RAW_ATTRIBUTE == 'typst' then
|
||||
page_ref = page_ref ..
|
||||
'#ref(form: "page", <' .. target .. '>)'
|
||||
end
|
||||
return xml_page_ref
|
||||
return page_ref
|
||||
end
|
||||
|
||||
local function make_pagerange_reference_xml(first, second, is_prefixed)
|
||||
local function make_pagerange_reference_per_ref(first, second, is_prefixed)
|
||||
local prefix = ''
|
||||
if is_prefixed then prefix = make_prefix_xml('page', true) end
|
||||
return prefix .. make_page_reference_xml(first, false) ..
|
||||
config.range_separator .. make_page_reference_xml(second, false)
|
||||
if is_prefixed then prefix = make_prefix_per_ref('page', true) end
|
||||
return prefix .. make_page_reference_per_ref(first, false) ..
|
||||
config.range_separator .. make_page_reference_per_ref(second, false)
|
||||
end
|
||||
|
||||
local function make_note_reference_xml(target, is_prefixed)
|
||||
local note_ref_xml = ''
|
||||
local function make_note_reference_per_ref(target, is_prefixed)
|
||||
local note_ref = ''
|
||||
if is_prefixed then
|
||||
note_ref_xml = make_prefix_xml('note', false)
|
||||
note_ref = make_prefix_per_ref('note', false)
|
||||
end
|
||||
if RAW_ATTRIBUTE == 'opendocument' then
|
||||
note_ref_xml = note_ref_xml ..
|
||||
note_ref = note_ref ..
|
||||
'<text:note-ref text:note-class="footnote"' ..
|
||||
' text:reference-format="text" text:ref-name="' ..
|
||||
(spans_to_note_labels[target] or '') .. '">000</text:note-ref>'
|
||||
elseif RAW_ATTRIBUTE == 'openxml' then
|
||||
note_ref_xml = note_ref_xml ..
|
||||
note_ref = note_ref ..
|
||||
'<w:r><w:fldChar w:fldCharType="begin" w:dirty="true"/></w:r>' ..
|
||||
'<w:r><w:instrText xml:space="preserve"> NOTEREF ' ..
|
||||
(spans_to_note_labels[target] or '') .. '_Note' .. ' \\h </w:instrText></w:r>' ..
|
||||
'<w:r><w:fldChar w:fldCharType="separate"/></w:r>' ..
|
||||
'<w:r><w:t>000</w:t></w:r>' ..
|
||||
'<w:r><w:fldChar w:fldCharType="end"/></w:r>'
|
||||
elseif RAW_ATTRIBUTE == 'typst' then
|
||||
note_ref = note_ref ..
|
||||
'#ref(form: "normal", <note:' .. (spans_to_note_labels[target] or '') .. '>)'
|
||||
end
|
||||
return note_ref_xml
|
||||
return note_ref
|
||||
end
|
||||
|
||||
local function make_pagenote_reference_xml(target, is_prefixed)
|
||||
local pagenote_ref_xml = ''
|
||||
local function make_pagenote_reference_per_ref(target, is_prefixed)
|
||||
local pagenote_ref = ''
|
||||
if is_prefixed then
|
||||
pagenote_ref_xml = make_prefix_xml(config.pagenote_first_type, false)
|
||||
pagenote_ref = make_prefix_per_ref(config.pagenote_first_type, false)
|
||||
end
|
||||
if config.pagenote_first_type == 'page' then
|
||||
pagenote_ref_xml = pagenote_ref_xml ..
|
||||
make_page_reference_xml(target, false) ..
|
||||
config.pagenote_separator .. make_note_reference_xml(target, true) ..
|
||||
pagenote_ref = pagenote_ref ..
|
||||
make_page_reference_per_ref(target, false) ..
|
||||
config.pagenote_separator .. make_note_reference_per_ref(target, true) ..
|
||||
config.pagenote_at_end
|
||||
elseif config.pagenote_first_type == 'note' then
|
||||
pagenote_ref_xml = pagenote_ref_xml ..
|
||||
make_note_reference_xml(target, false) ..
|
||||
config.pagenote_separator .. make_page_reference_xml(target, true) ..
|
||||
pagenote_ref = pagenote_ref ..
|
||||
make_note_reference_per_ref(target, false) ..
|
||||
config.pagenote_separator .. make_page_reference_per_ref(target, true) ..
|
||||
config.pagenote_at_end
|
||||
else
|
||||
error('“tcrf-pagenote-first-type” must be set either to “page” or “note”.')
|
||||
end
|
||||
return pagenote_ref_xml
|
||||
return pagenote_ref
|
||||
end
|
||||
|
||||
local function make_reference_xml(ref, ref_type, is_prefixed)
|
||||
local reference_xml = ''
|
||||
local function make_reference_per_ref(ref, ref_type, is_prefixed)
|
||||
local reference = ''
|
||||
if ref_type == 'page' and ref.end_of_range then
|
||||
reference_xml =
|
||||
make_pagerange_reference_xml(ref.anchor, ref.end_of_range, is_prefixed)
|
||||
reference =
|
||||
make_pagerange_reference_per_ref(ref.anchor, ref.end_of_range, is_prefixed)
|
||||
elseif ref_type == 'page' then
|
||||
reference_xml = make_page_reference_xml(ref.anchor, is_prefixed)
|
||||
reference = make_page_reference_per_ref(ref.anchor, is_prefixed)
|
||||
elseif ref_type == 'note' then
|
||||
reference_xml = make_note_reference_xml(ref.anchor, is_prefixed)
|
||||
reference = make_note_reference_per_ref(ref.anchor, is_prefixed)
|
||||
elseif ref_type == 'pagenote' then
|
||||
reference_xml = make_pagenote_reference_xml(ref.anchor, is_prefixed)
|
||||
reference = make_pagenote_reference_per_ref(ref.anchor, is_prefixed)
|
||||
end
|
||||
return reference_xml
|
||||
return reference
|
||||
end
|
||||
|
||||
local function make_global_prefix_xml(ref_type)
|
||||
local global_prefix_xml = ''
|
||||
local function make_global_prefix_several_refs(ref_type)
|
||||
local global_prefix = ''
|
||||
local prefix_type = ref_type
|
||||
if ref_type == 'pagenote' then
|
||||
prefix_type = config.pagenote_first_type
|
||||
end
|
||||
global_prefix_xml = make_prefix_xml(prefix_type, true)
|
||||
return global_prefix_xml
|
||||
global_prefix = make_prefix_per_ref(prefix_type, true)
|
||||
return global_prefix
|
||||
end
|
||||
|
||||
local function make_references_xml(refs, ref_type, is_prefixed)
|
||||
local references_xml = ''
|
||||
local function make_references_per_ref(refs, ref_type, is_prefixed)
|
||||
local references = ''
|
||||
for i = 1, #refs do
|
||||
references_xml = references_xml ..
|
||||
make_reference_xml(refs[i], ref_type, is_prefixed)
|
||||
references = references ..
|
||||
make_reference_per_ref(refs[i], ref_type, is_prefixed)
|
||||
if i < #refs then
|
||||
if i < #refs - 1 then
|
||||
references_xml = references_xml .. config.multiple_delimiter
|
||||
references = references .. config.multiple_delimiter
|
||||
else
|
||||
references_xml = references_xml .. config.multiple_before_last
|
||||
references = references .. config.multiple_before_last
|
||||
end
|
||||
end
|
||||
end
|
||||
return references_xml
|
||||
return references
|
||||
end
|
||||
|
||||
local function make_raw_content_xml(refs, ref_type, is_prefixed)
|
||||
local function make_raw_content_per_ref(refs, ref_type, is_prefixed)
|
||||
local is_enumeration = #refs > 1
|
||||
local global_prefix = ''
|
||||
if is_enumeration and is_prefixed
|
||||
and ((ref_type ~= 'pagenote') or config.pagenote_factorize_first_prefix_in_enum)
|
||||
then
|
||||
global_prefix = make_global_prefix_xml(ref_type)
|
||||
global_prefix = make_global_prefix_several_refs(ref_type)
|
||||
is_prefixed = false
|
||||
end
|
||||
local references_raw_xml = make_references_xml(refs, ref_type, is_prefixed)
|
||||
return global_prefix .. references_raw_xml
|
||||
local refs_raw_content = make_references_per_ref(refs, ref_type, is_prefixed)
|
||||
return global_prefix .. refs_raw_content
|
||||
end
|
||||
|
||||
local function make_raw_content(refs, ref_type, is_prefixed)
|
||||
local raw_content = ''
|
||||
if RAW_ATTRIBUTE == 'context' or RAW_ATTRIBUTE == 'latex' then
|
||||
raw_content = make_raw_content_tex(refs, ref_type, is_prefixed)
|
||||
if RAW_ATTRIBUTE == 'context' or RAW_ATTRIBUTE == 'latex'
|
||||
or TYPST_VARIANT:get() == 'crossrefenum'
|
||||
then
|
||||
raw_content = make_crossrefenum(refs, ref_type, is_prefixed)
|
||||
else
|
||||
raw_content = make_raw_content_xml(refs, ref_type, is_prefixed)
|
||||
raw_content = make_raw_content_per_ref(refs, ref_type, is_prefixed)
|
||||
end
|
||||
return raw_content
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user