From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32347 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Julien Dutant Newsgroups: gmane.text.pandoc Subject: Re: help filtering languages Date: Thu, 16 Mar 2023 02:32:37 -0700 (PDT) Message-ID: <49e8c09d-513a-47e5-a85e-c4cf9ca01d5en@googlegroups.com> References: <591336ef-c61e-31a8-3f44-2625551f7e07@web.de> <103a971c-503b-e15e-8e1d-2b9700099138@web.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_360_33678129.1678959157941" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9196"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBC5Y3356IYILPRGLUADBUBE6HW5IG-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Mar 16 10:32:43 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-qt1-f189.google.com ([209.85.160.189]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pcjyU-00027b-Jf for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 16 Mar 2023 10:32:42 +0100 Original-Received: by mail-qt1-f189.google.com with SMTP id o10-20020a05622a138a00b003bfdabf3b89sf561366qtk.13 for ; Thu, 16 Mar 2023 02:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; t=1678959161; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=/N+Jd6JelDnsCyk/CMuqJXfpnuB28GJsbuhmW5CQ1nU=; b=O56Zfzj8nTxffsyf+ECCo1EUkJJBU/0bQSSEpQTyTo3N2y+u2qO5ZBtvCExwpPzocF SlD5oNEa+V6yoQ+xFjYf4LbOAZ0hWoxgHZiJb8RTdlSlmjUPxyyw32CoYAbT2gSqepyv yC+ODdR8e6MlNh+rlzbTRJZuuBaMjbmdj4y/QtlfZcdV4njBQmXoFB1Iq/u9X+K98PP+ NWLPyk8pakd+r6TELMFjwB4u+sq4HUbPXWkjBcgCIb8I+xEiCDvQ/YDkrT0wZlgYMDl7 xetXze1Y4EZAGAkQ5tm/oOiJHqxRO7ScTYFzMnCpKc8oopjxy87g9LWvIMLiSqv3YDIp pVXg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678959161; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=/N+Jd6JelDnsCyk/CMuqJXfpnuB28GJsbuhmW5CQ1nU=; b=D7jhNgmqSjz+USD6yHFUbFM4SnO41l861yMDogt3hJVYQdNdUGHHgUeKPHK+WrZlYN W5oa838Excg+q7312DAHG6W/e/22EvxndnqPMfxJ7tQPv1byeHAGIX5b1LE+Ndg9qBx/ 2WwhlStSg1iFaNs5MhewTtco5ppPiR8P4PHElUgyHi5vZTfV8caaF2TtOaHc5yvGQEWl vGyidtEVnq8nuXH834wDL/cCJg6MJFyNdxI6+Wkmsou2d2JJrO0J2G99H5kV1tFcoK55 3hWuxn9hrM+qOMBF7VF18dhJHQQ64goFSL5SWPwwKmJ9Lf1Z3URQzwyysRzFHQ9vDr1M NGTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678959161; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:mime-version:subject:references:in-reply-to :message-id:to:from:date:x-gm-message-state:sender:from:to:cc :subject:date:message-id:reply-to; bh=/N+Jd6JelDnsCyk/CMuqJXfpnuB28GJsbuhmW5CQ1nU=; b=WiL/5xIXdc7mzUgcoxSEBEmnpybIYlmi2KVHP7MYOnbi5PobqXE3a8o8+FU6+iEMn3 3zz6cbnHbp3IJm8DUQrXy7hNU8L5HvNoo2NQ6ecumuIGyu7asZeNXLrZ9O8V2BJhS8bI Rhjy9LysfPng7J/RSu0i6y46fkIus5eDqrwCc5cywngntnPSvJfExjVUn2QPWscNyzds GLtCCvftbUREglNjDX0kCO7cVOKpKCrd5/4ZUJS7J0JNH/nVSEbnavHAfeIReuh7LXxF hXKBqaH6Xy2x1SLvmknjaDMX34HnLB2K0y0s+JT5SviQL1J0Yx3VJ+jMrqTiuKBivhA8 Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKXp3Ng3JKSFoQWi1NGyrZDQeOwmtqE7Aqr77f2+sqWYuHSFtoOY cbIRlBHsSsu3b1m3hKczo9Q= X-Google-Smtp-Source: AK7set9zTQETxzWeH6Fa0FFaSNCDClSKl7mPE0fR2yD++a3qAWkUVTbiwrTfhKv7C5CFHnnKr1dp/A== X-Received: by 2002:a05:620a:1a07:b0:72b:25b4:565f with SMTP id bk7-20020a05620a1a0700b0072b25b4565fmr2976165qkb.5.1678959161621; Thu, 16 Mar 2023 02:32:41 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:622a:1a21:b0:3d3:ead1:4e62 with SMTP id f33-20020a05622a1a2100b003d3ead14e62ls1398453qtb.5.-pod-prod-gmail; Thu, 16 Mar 2023 02:32:39 -0700 (PDT) X-Received: by 2002:aed:2785:0:b0:3d6:5ce3:b093 with SMTP id a5-20020aed2785000000b003d65ce3b093mr722406qtd.11.1678959158793; Thu, 16 Mar 2023 02:32:38 -0700 (PDT) In-Reply-To: X-Original-Sender: julien.dutant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:32347 Archived-At: ------=_Part_360_33678129.1678959157941 Content-Type: multipart/alternative; boundary="----=_Part_361_1804481990.1678959157941" ------=_Part_361_1804481990.1678959157941 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Pablo, If simple markdown is key here, why not hack the link syntax? Nobody ever= =20 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=20 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 =3D l.target}) end end Example $> echo '[savoir-faire](fr)' | pandoc -L lanTags.lua=20

savoir-faire

$> 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=E2=80=AFPM UTC Pablo Rodr=C3=ADguez= wrote: > On 3/15/23 09:32, BPJ wrote: > > At least you can abbreviate `[rien]{lang=3Dfr}` to `[rien]{l=3Dfr}` ---= a > > reduction from five to two chars instead of from five to one is at leas= t > > better than none! > > Many thanks for your reply, BPJ. > > I=E2=80=99m afraid these kinds of abbreviations make the source almost un= readable. > > If there is no lightweight syntax for an attribute, I guess complete key > names are better (I mean, `class=3D"first"` is more readable than > `c=3D"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=E2=80=98t the best habit when you have to write complet= e XML=20 > code. > > Many thanks for your help, > > Pablo > --=20 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 e= mail 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. ------=_Part_361_1804481990.1678959157941 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Pablo,

If simple markdown is key here, w= hy not hack the link syntax? Nobody ever links to 'fr' or 'en-gb' so we cou= ld write:

[savoir-faire](fr)

and use a filter that picks up links with 'xx' or 'xx-xx' targets a= nd 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 =3D l.target})
end
end

Example

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

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

=
Best,
J

On Wednesday, March 15, 202= 3 at 7:45:33=E2=80=AFPM UTC Pablo Rodr=C3=ADguez wrote:
On 3/15/23 09:32, BPJ wrote:
> At least you can abbreviate `[rien]{lang=3Dfr}` to `[rien]{l=3Dfr}= ` --- 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=E2=80=99m afraid these kinds of abbreviations make the source almost = unreadable.

If there is no lightweight syntax for an attribute, I guess complete ke= y
names are better (I mean, `class=3D"first"` is more readable = than
`c=3D"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=E2=80=98t the best habit when you have to write compl= ete XML code.

Many thanks for your help,

Pablo

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-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.
------=_Part_361_1804481990.1678959157941-- ------=_Part_360_33678129.1678959157941--