jgm / djot

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

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

Open ousia opened 2 years ago

ousia commented 2 years ago

@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.

marrus-sh commented 2 years ago

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)

ousia commented 2 years ago

@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.

bpj commented 2 years ago

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.