Open dmitryperets opened 7 months ago
Sounds good, but it's not straightforward at all to implement this. @fig:myfigure
is parsed as a native Citation:
ts@liag0002:~$ echo '@fig:myfigure' | pandoc -t native
[ Para
[ Cite
[ Citation
{ citationId = "fig:myfigure"
, citationPrefix = []
, citationSuffix = []
, citationMode = AuthorInText
, citationNoteNum = 1
, citationHash = 0
}
]
[ Str "@fig:myfigure" ]
]
]
$ echo '+@fig:myfigure' | pandoc -t native
[ Para
[ Str "+"
, Cite
[ Citation
{ citationId = "fig:myfigure"
, citationPrefix = []
, citationSuffix = []
, citationMode = AuthorInText
, citationNoteNum = 1
, citationHash = 0
}
]
[ Str "@fig:myfigure" ]
]
]
This is handled by the citation handler.
+@fig:myfigure
is parsed as the string +
followed by the citation, so it's not possible to match on prefixes before the @
sign.
$ echo '+@fig:myfigure' | pandoc -t native
[ Para
[ Str "+"
, Cite
[ Citation
{ citationId = "fig:myfigure"
, citationPrefix = []
, citationSuffix = []
, citationMode = AuthorInText
, citationNoteNum = 1
, citationHash = 0
}
]
[ Str "@fig:myfigure" ]
]
]
Since pandoc-xnos seems to be dead for now and it doesn't really support pandoc 3.x (e.g.
pandoc-fignos
is broken due to the new AST format), migrating to this native LUA implementation sounds like a good idea. But it would be beneficial if we could keep the documents written for pandoc-xnos...So one of the differences is the "clever references" feature available in
pandoc-xnos
. The difference is the following:pandoc-xnos:
@fig:myfigure
is simply replaced with the number of the figure (e.g.1
).+@fig:myfigure
is replaced with the caption + number (e.g.Figure 1
)luarefnos:
@fig:myfigure
is replaced with the caption + number (e.g.Figure 1
)Ideally, my suggestion is to implement exactly the same syntax as pandoc-xnos. But if that is too complex, maybe it is possible to implement deletion of the
+
sign right before the reference.Explanation:
@fig:myfigure
in luarefnos does the same as+@fig:myfigure
in pandoc-xnos. Namely, it emits caption + number (e.g.Figure 1
)+
that should not be there...