jgm / djot

A light markup language
https://djot.net
MIT License
1.71k stars 43 forks source link

Parsing ambiguity: bracketed content followed by footnote? #228

Open Omikhleia opened 1 year ago

Omikhleia commented 1 year ago

It's common in critical annotations to have bracketed words for emendation. "This [is] it", so far so good...

But how should the following parse?

These word[sic][^aaa]

[^aaa]: The plural is clearly missing from the manuscript

Current:

doc
  para
    str text="These word"
    link reference="^aaa" <--- Oops, link, not footnote?
      str text="sic"
footnotes
  ["aaa"] =
    footnote label="aaa"
      para
        str text="The plural is clearly missing from the manuscript"

For comparison:

These word[^aaa]

[^aaa]: The plural is clearly missing from the manuscript

=

doc
  para
    str text="These word"
    footnote_reference text="aaa" <--- Footnote here
footnotes
  ["aaa"] =
    footnote label="aaa"
      para
        str text="The plural is clearly missing from the manuscript"`

Is this an intended ambiguity in Djot?

bpj commented 1 year ago

The backslash is your friend \[sic\][^aaa] although one or the other backslash may be enough.

Omikhleia commented 1 year ago

The backslash is your friend [sic][^aaa] although one or the other backslash may be enough.

Yep, backslashing works, but was the ambiguity intended, or can't it be solved?

Omikhleia commented 1 year ago

Let me be more precise, in the definitions, [^aaa]: ... and [aaa]: ... belong to different spaces:

[^aaa]: ...
[aaa]: ...

=

doc
references
  ["aaa"] =
    reference label="aaa" destination="..."
footnotes
  ["aaa"] =
    footnote label="aaa"
      para
        smart_punctuation type="ellipses" text="..."

So the above looks as a discrepancy/ambiguity that was not intended. (edited)

(Unrelated and out of topic: @bpj would your name ring a bell for either a conlanger, a tolkien-fan, or both? If so, the world is small^^)

bpj commented 1 year ago

Aha, yes I think [^note]: and [ref]: are separate namespaces or at least they should be.