Hi Pablo,

If simple markdown is key here, why not hack the link syntax? Nobody ever links to 'fr' or 'en-gb' so we could write:

[savoir-faire](fr)

and use a filter that picks up links with 'xx' or 'xx-xx' targets and returns whatever you want (probably a Span with lang attribute):

-- langTags.lua
function Link (l)
if l.target:match('^%a%a$') or l.target:match('$^%a%a%-%a%a$') then
return pandoc.Span(l.content, { lang = l.target})
end
end

Example

$> echo '[savoir-faire](fr)' | pandoc -L lanTags.lua
<p><span lang="fr">savoir-faire</span></p>

$> echo '[savoir-faire](fr)' | pandoc -L langTags.lua -t native
[ Para
    [ Span
        ( "" , [] , [ ( "lang" , "fr" ) ] ) [ Str "savoir-faire" ]
    ]
]

Best,
J

On Wednesday, March 15, 2023 at 7:45:33 PM UTC Pablo Rodríguez wrote:
On 3/15/23 09:32, BPJ wrote:
> 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!

Many thanks for your reply, BPJ.

I’m afraid these kinds of abbreviations make the source almost unreadable.

If there is no lightweight syntax for an attribute, I guess complete key
names are better (I mean, `class="first"` is more readable than
`c="first"`).

> (And Pandoc allows you to omit the quotes around the
> attribute value if the value is a valid name.)

I know, this would be great if it would be standard XML practice.

Otherwise, it isn‘t the best habit when you have to write complete XML code.

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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/49e8c09d-513a-47e5-a85e-c4cf9ca01d5en%40googlegroups.com.