At least you can abbreviate `[rien]{lang=fr}` to `[rien]{l=fr}` --- a reduction from five to two chars instead of from five to one is at least better than none! (And Pandoc allows you to omit the quotes around the attribute value if the value is a valid name.)

``````lua
local function handler(elem)
  if elem.attributes.l then
    elem.attributes.lang = elem.attributes.l
    elem.attributes.l = nil
    return elem
  end
  return nil
end

return {
  {
    Div = handler,
    Span = handler,
    Link = handler,
    Header = handler,
  }
}
``````

Den mån 13 mars 2023 21:47Pablo Rodríguez <oinos-S0/GAf8tV78@public.gmane.org> skrev:
On 3/13/23 20:43, Bastien DUMONT wrote:
> {:de} will be parsed as a string, not as an attribute list.
> Attributes are of the form key=value. In this case, you can write
> (-f commonmark+attributes):
>
> _Deutsch_{lang=de}
>
> What you propose is a syntax extension

Many thanks for your reply, Bastien.

I know there is a way to full attribute specification, since the
original proposal is almost a decade old
(https://github.com/jgm/pandoc/issues/895 [which was superseded by
https://github.com/jgm/pandoc/issues/3451]).

> and it would be quite difficult to write a filter taking into
> account multiple attributes and cases where the {...} string is
> immediately followed by other characters.

Well, I see what I was missing here.

> Maybe a custom reader would be better suited.

I wouldn’t mind to add this to (a custom version of) djot. But I clearly
lack the knowledge to do that.

> But it would be easier to stick to existing conventions!

I’m used to the convention (although I‘d rather avoid it, since it tend
to mix languages a lot), but when explaining CommonMark/Markdown to
newcomers, this is one important exception to lightweight markup.

And believe me, it is not easy to explain the key="value" attribute
syntax (it doesn’t make it easier to ignore the quotes) to people with
practically no computer background at all. Because this goes on top of a
bunch of new things for them (which would make anyone explode).

Many thanks for your help,

Pablo

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/103a971c-503b-e15e-8e1d-2b9700099138%40web.de.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDcpBdJxQO7qCbnj2Tk%2BkuxuVrh%2BHGS7eg8JoUoGSuC0w%40mail.gmail.com.