From: Julien Dutant <julien.dutant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: help filtering languages
Date: Thu, 16 Mar 2023 02:32:37 -0700 (PDT) [thread overview]
Message-ID: <49e8c09d-513a-47e5-a85e-c4cf9ca01d5en@googlegroups.com> (raw)
In-Reply-To: <f5687eba-f82c-64c2-21b8-94093a1158f5-S0/GAf8tV78@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 2062 bytes --]
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
[-- Attachment #1.2: Type: text/html, Size: 3092 bytes --]
next prev parent reply other threads:[~2023-03-16 9:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 19:25 Pablo Rodríguez
[not found] ` <591336ef-c61e-31a8-3f44-2625551f7e07-S0/GAf8tV78@public.gmane.org>
2023-03-13 19:43 ` Bastien DUMONT
2023-03-13 20:46 ` Pablo Rodríguez
[not found] ` <103a971c-503b-e15e-8e1d-2b9700099138-S0/GAf8tV78@public.gmane.org>
2023-03-15 8:32 ` BPJ
[not found] ` <CADAJKhDcpBdJxQO7qCbnj2Tk+kuxuVrh+HGS7eg8JoUoGSuC0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2023-03-15 19:45 ` Pablo Rodríguez
[not found] ` <f5687eba-f82c-64c2-21b8-94093a1158f5-S0/GAf8tV78@public.gmane.org>
2023-03-16 9:32 ` Julien Dutant [this message]
[not found] ` <49e8c09d-513a-47e5-a85e-c4cf9ca01d5en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-03-16 17:45 ` Pablo Rodríguez
[not found] ` <c54cca0e-6eaf-273b-caaa-882f5d9e1c1e-S0/GAf8tV78@public.gmane.org>
2023-03-16 21:28 ` Julien Dutant
[not found] ` <c238d079-4ba5-4f39-8171-c17e1119d4c5n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-03-20 17:20 ` Pablo Rodríguez
[not found] ` <68de3cab-a729-7728-2652-774a8ff599f4-S0/GAf8tV78@public.gmane.org>
2023-03-20 21:22 ` Julien Dutant
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49e8c09d-513a-47e5-a85e-c4cf9ca01d5en@googlegroups.com \
--to=julien.dutant-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).