djot icon indicating copy to clipboard operation
djot copied to clipboard

`{:lang}` as substitute for `{lang="lang"}`

Open ousia opened this issue 2 years ago • 3 comments

@jgm,

after having to tag languages in many documents, I think this would be handy:

This is [French]{:fr}.
And this is [ancient Greek]{:grc}.

It is consistent with the syntax for {#id} and {.class}.

Would it be possible to have this handle in djot?

Many thanks for your help and your excellent work.

ousia avatar Jul 12 '22 14:07 ousia

as : is already being used for emoji, i might prefer @ as a sigil ([My English text]{@en})

@ has some precedent as a language indicator on the web (it is the symbol used by RDF Turtle for language‐tagged strings, e.g. "My English Text"@en, so you see it often in Linked Data‐adjacent spaces)

marrus-sh avatar Aug 14 '22 21:08 marrus-sh

@marrus-sh,

many thanks for your comment.

as : is already being used for emoji, i might prefer @ as a sigil ([My English text]{@en})

I don’t think this is exactly the same.

According to https://htmlpreview.github.io/?https://github.com/jgm/djot/blob/master/doc/syntax.html#emoji:

  1. Emojis are surrounded by normal text.
  2. Emojis have colons both right before and after them.
  3. Language tags would be inside braces (not in normal text).
  4. Language tags would have colons only before them.

@ has some precedent as a language indicator on the web (it is the symbol used by RDF Turtle for language‐tagged strings, e.g. "My English Text"@en, so you see it often in Linked Data‐adjacent spaces)

Colons are used for language pseudo-class in CSS selection:

 p:lang(grc) {
  background: yellow;
}

This is consistent with having the CSS selectors for #id and .class.

That being said, having proper syntax for languages (as in {lang="lang"}) would be great. Either your proposal, mine or another one.

Many thanks for your reply again.

ousia avatar Aug 15 '22 11:08 ousia

Having thought more about #44 I now think that {:text:} and {:number:} should be syntaxes for emoji/charnames and character references, and since per #10 @jgm thinks that {.dots.} would be too close for comfort to {.class} there is a potential clash. I can't say that I really see a problem here; the absence of a :} or .} in attributes should be enough to disambiguate.

bpj avatar Aug 15 '22 14:08 bpj