From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32813 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "'William Lupton' via pandoc-discuss" Newsgroups: gmane.text.pandoc Subject: Re: Inserting attributes into elements Date: Wed, 14 Jun 2023 07:38:41 +0100 Message-ID: References: <76a72c07-6699-d243-ae20-64808682ec9e@meddatainc.com> <90C7A30F-C0FA-49D8-B0CD-6521B58113F1@meddatainc.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000008ce21005fe1134a9" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25252"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCS4HJ6WSAHBB76AUWSAMGQEZFDFBYQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jun 14 08:39:02 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f184.google.com ([209.85.208.184]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1q9K9l-0006PC-Ez for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 14 Jun 2023 08:39:01 +0200 Original-Received: by mail-lj1-f184.google.com with SMTP id 38308e7fff4ca-2b1ec111688sf2205861fa.2 for ; Tue, 13 Jun 2023 23:39:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686724741; cv=pass; d=google.com; s=arc-20160816; b=FnrywWIL3ZF4kgqFPReRloDjvzj+FmWdUVRm9m32Rrp7UdEO117SqYdhyYB7k0eQUM shVi8I1RjwskyFv6yg5G/mSX49vyLoq4C9dzHgiSIC9USzHT2W3cpnAf8dlhRYwPh6ts xPBNcteeZNqMlx6VEZ7pDaUMEh0x6BP4t410nT/i4KWJMUrwCK9lcR2qNEpJat7FRa4r VsafnFVZj1rbh/yFoEpPWnkcscTTUKpwnQo6lZRZ478+9OcTwm6NoBbqCkUtUe/HDCrx AmJ3sc/4chK/34DwwSz0kUDDPh60gWylmFvrqhqxMajjaYwuQpDwA+TK3WHMCjrl3YPF T5Kg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date :from:in-reply-to:references:mime-version:dkim-signature; bh=fVjB9i6+G7yn5JPLWul4WAfMTvFp7z3GsUvgYHvwt2s=; b=A/WTP2Mvk6DiLpGRIVFfxa9FvVAFfUU4G29vvrdFLQniQBnw6Hi8kaMDOf08ynEgkq lIWcLmQ9VHYyv8KaQBqArDcAtJOuZmIOYcrkcXc0skMqZ39tmC0Oca4Z5jas71OMBE8c jAYy5UnsuMB6TFWvJRmneobGqqpAE+3GWKtJrU8CvakmovuMwTSfItm+vAwIOxfaVHbu 5b/CxDfXsDQPtorHohK70+dOLettokpwTP/nxxlUTYt5uURUyEO/SX42K5Ac4CV4i125 oUYhJvccJoeGfy4cgD7li9YQiMdH96tk3ybL71d+OOqyamtMdp9UXhaXnJbDqAnHUoQw mUhQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b=BaBZNmWQ; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::535 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1686724741; x=1689316741; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version:from:to:cc :subject:date:message-id:reply-to; bh=fVjB9i6+G7yn5JPLWul4WAfMTvFp7z3GsUvgYHvwt2s=; b=aY11Tkyv9qShKHTm6l0iABgzE8n3UE7psRiAYfB683yG7M32xtmwn2aHGEF9R2T3DV DpPy60feZKXYfV1SHP6mKKRSPeCeOyZXNJE8cK8hwGDDmvGmqtdaqujjhXLWYWEM/zki FPH18JSqQp8q1bSzh8alnzP+r53bYcwOipsZZKk2nJiXqfH4WHQX9gMW21QAk/mTuc7m mBA5VIQQsn9mSIVeH1Kq4X/hz4//uyI4k5AWr775Cik2XNNWBUbi1oqr8K/8PhkXPM/f Nu7t+50tKSCcVTk5on/bBEQrAgfu5ZhMSMS5BpuCT6yTLEyAP74Erkvt7SNhIpvr+Oye kB X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686724741; x=1689316741; 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-authentication-results:x-original-sender:to:subject :message-id:date:from:in-reply-to:references:mime-version :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fVjB9i6+G7yn5JPLWul4WAfMTvFp7z3GsUvgYHvwt2s=; b=YV2qwmh510CC2did2wvP3g3THkwSJKtHUSQ0Bi9bt4Fc1WjnCWmGOyukjQdFJQdClN f1BQtfsDAJuG19+LXIzCeRw7yYeZugdG15OpiZqZymIk8K8avsUynq02kQ2j8oXAlXcP WOLVyl6OY6Pf4Fj6jaQRBMz23TEE9YevGNFXE7xIAarPAsFwsxvc2jHVSpGxHVBN/NH9 pdFYx3d+NR2acfuaKBlQjD5MebUPMj0opGab/4yPwfTBoQJ7b+hmJ7hBmteOjWfo7Mmq z2wCPlOmIDW2D X-Gm-Message-State: AC+VfDxEbyf2OqIiCwP1c4ZGht+bDSbMfsZkNsG7jvgML6/H6N1wiiJD fUtPfi7Y5I6ngplAte6XFgM= X-Google-Smtp-Source: ACHHUZ5Hsx9ygwZTauIG7QVN0W5CkaBU/apQd4NrV+P3DyaZTNEQT+Zv1QSmEVB5/NvwY76fXlZciQ== X-Received: by 2002:a2e:3010:0:b0:2b3:45f6:cfaa with SMTP id w16-20020a2e3010000000b002b345f6cfaamr899165ljw.47.1686724739931; Tue, 13 Jun 2023 23:38:59 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a2e:a545:0:b0:2af:7062:5772 with SMTP id e5-20020a2ea545000000b002af70625772ls875166ljn.1.-pod-prod-05-eu; Tue, 13 Jun 2023 23:38:54 -0700 (PDT) X-Received: by 2002:a05:651c:1047:b0:2b1:c61f:9d2b with SMTP id x7-20020a05651c104700b002b1c61f9d2bmr5549037ljm.26.1686724734160; Tue, 13 Jun 2023 23:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686724734; cv=none; d=google.com; s=arc-20160816; b=e5AeZ7gOAjUjQ5FPrwjITtLoK85b+ienWFIITy8c0Zi70yzjrsNHRDoKtnPq2l9VrB 7kQxFiK6raf2khhU6734kmxeFWblMrvFEVnZqbTdyJzJWN7nUhNe6dLjnEU4+5rO5E93 BzEOd+HqH0tko58ExlQgXts3w0dPr3s0aT/QxTP7ePTN/tPH2d1NXn092NG8PZngsjUM 42o0xqZMEBNX6StJ5gf02Mb+zyVV3Th+KfoWVOyKTpOiBuOJnYjmIVrXbTBKg2ugXJGM r86CV9ATEKoaDPmmU9znWvO5YX1OX8Gl/itE4AAIno28ed7ALdjToXbiJXquLMdOpFjm lCtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=wodlaUkXoJaDNr3ulbtVecvHHbFgD+VPoeTZKRohfGU=; b=mpRLpaZQiD5YBoXVxk4lOjmDbrbuR1TSU2dh8dTjQUHj0qAny1Qhr3LL0Dxy6o/Odj SmH2RCb6rekoc4ow2EYPQkfb28r4MoZHQEmswvWN0Nlj0wee0hVj0W1nfIe976sZrthG VGCtg6PouEZivtAbG2z3LuUdw3cpSov4NdxUqRLqxnXKAX9/WWf4S8cAWY0wJiQGbTcE Oquj+J8ikEggOBn25UY9a0bmv0hM5heLJBEy0DipEVg5Hv92qnsmeQffUg1H1Ye0++B6 UGkzAUjtS//MzTJDwGw5pUhyPqd5xx/RvOFAlchhMVtOW5Fd7VBpoGpyHuMJuKYuUSYj YN2w== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b=BaBZNmWQ; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::535 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org Original-Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com. [2a00:1450:4864:20::535]) by gmr-mx.google.com with ESMTPS id e15-20020a05651c150f00b002b1fffb6355si818997ljf.3.2023.06.13.23.38.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jun 2023 23:38:54 -0700 (PDT) Received-SPF: pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::535 as permitted sender) client-ip=2a00:1450:4864:20::535; Original-Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5149bdb59daso8890416a12.2 for ; Tue, 13 Jun 2023 23:38:54 -0700 (PDT) X-Received: by 2002:a17:907:1ca0:b0:982:6bba:79c9 with SMTP id nb32-20020a1709071ca000b009826bba79c9mr660847ejc.20.1686724733094; Tue, 13 Jun 2023 23:38:53 -0700 (PDT) In-Reply-To: X-Original-Sender: wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@broadband-forum.org header.s=google header.b=BaBZNmWQ; spf=pass (google.com: domain of wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org designates 2a00:1450:4864:20::535 as permitted sender) smtp.mailfrom=wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadband-forum.org X-Original-From: William Lupton 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:32813 Archived-At: --0000000000008ce21005fe1134a9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This filter inserts a header before each paragraph. -- https://pandoc.org/lua-filters.html#lua-filter-structure function Para(para) return { -- https://pandoc.org/lua-filters.html#pandoc.header -- https://pandoc.org/lua-filters.html#type-attr pandoc.Header(2, 'Inserted header', {style=3D'blablabla'}), para } end On Tue, 13 Jun 2023 at 23:00, H wrote: > On June 13, 2023 5:38:18 PM EDT, 'William Lupton' via pandoc-discuss < > pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> wrote: > >sorry; i was wrong when i said that i thought that you can't add style > >attributes (i should have checked) > > > >of course the style attributes _are_ CSS, but i guess that this is ok > >for > >you > > > >what do you mean by 'rewriting' a tag? > > > >On Tue, 13 Jun 2023 at 22:27, Bastien DUMONT > > > >wrote: > > > >> You call =E2=80=9Cinsert=E2=80=9D as if it were a method of =E2=80=9Ca= ttr=E2=80=9D, but attr is a > >> key-value table. The correct way to add an attribute is: > >> > >> if (el.level =3D=3D 2) then > >> local attr =3D el.attributes > >> attr.style =3D 'color: #112233;' > >> end > >> > >> > >> Le Tuesday 13 June 2023 =C3=A0 05:19:14PM, H a =C3=A9crit : > >> > On June 13, 2023 5:16:32 PM EDT, H wrote: > >> > > >> > On June 13, 2023 5:00:19 PM EDT, 'William Lupton' via > >pandoc-discuss > >> > wrote: > >> > > >> > As far as I know, you can't add 'style' attributes. But you > >can > >> embed > >> > CSS via header-includes. You'll find an example of this if > >you > >> search > >> > the manual for 'header-includes' (and you can use a filter > >to > >> set the > >> > variable; I think Albert gave an example of how to do this > >a few > >> weeks > >> > ago). > >> > > >> > On Tue, 13 Jun 2023, 21:37 H, <[1]agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org> > >wrote: > >> > > >> > Continuing my quest to write a custom filter, I now ran > >into > >> a need > >> > to add attributes to different types of tags as > >exemplified > >> below: > >> > > >> > - In header tags such as

, I need to add > >"style=3Dcolor: > >> #112233; > >> > " so it becomes

. > >> > > >> > - I analogously also need to add style information to > >> tags. > >> > > >> > In my filter I tried: > >> > > >> > style_h2 =3D > >> > > >> > if (el.level =3D=3D 2) then > >> > local attr =3D el.attributes > >> > attr.insert =3D style_h2 > >> > end > >> > > >> > but ended up with the below in my html output: > >> > > >> >

>> > data-insert=3D" style=3D"text-transform: uppercase; > >color: # > >> > cc002b;""> > >> > > >> > Clearly not the correct way. Can I add the style > >information > >> as > >> > above in a filter, in the pandoc function as I am going > >> through my > >> > document block-by-block and modifying the document > >structure > >> as > >> > needed? I already adding
with various style > >> information as I > >> > iterate over the blocks and that works fine but now I > >need to > >> > modify existing tags. > >> > > >> > I guess I could do it similarly to below but then it > >applies > >> to all > >> > eg H2: > >> > > >> > function Header(el) > >> > -- remove header identifier for all levels > >> > el.identifier =3D '' > >> > > >> > -- convert level 1 and 2 to upper case > >> > if (el.level =3D=3D 1) or (el.level =3D=3D 2) then > >> > return el:walk { > >> > Str =3D function(el) > >> > return pandoc.Str(text.upper(el.text)) > >> > end > >> > } > >> > else > >> > return el > >> > end > >> > end > >> > > >> > How to do it on individual H2 in a filter? > >> > > >> > Thanks. > >> > > >> > -- > >> > 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 [2] > >> pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> > To view this discussion on the web visit [3]https:// > >> > groups.google.com/d/msgid/pandoc-discuss/ > >> > 76a72c07-6699-d243-ae20-64808682ec9e%40meddatainc.com. > >> > > >> > > >> > I need to stay away from css since the software the output is > >used > >> in does > >> > not allow css info to be added. > >> > > >> > > >> > Can I "rewrite" a tag in the filter? > >> > > >> > -- > >> > 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 [4]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> > To view this discussion on the web visit [5] > >> https://groups.google.com/d/msgid/ > >> > > >pandoc-discuss/90C7A30F-C0FA-49D8-B0CD-6521B58113F1%40meddatainc.com. > >> > > >> > References: > >> > > >> > [1] mailto:agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org > >> > [2] mailto:pandoc-discuss%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > >> > [3] > >> > > > https://groups.google.com/d/msgid/pandoc-discuss/76a72c07-6699-d243-ae20-= 64808682ec9e%40meddatainc.com > >> > [4] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > >> > [5] > >> > > > https://groups.google.com/d/msgid/pandoc-discuss/90C7A30F-C0FA-49D8-B0CD-= 6521B58113F1%40meddatainc.com?utm_medium=3Demail&utm_source=3Dfooter > >> > >> -- > >> 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/ZIjfUqabWGUWcZz2%40local= host > >> . > >> > > I used the phrase =E2=80=9Drewriting a tag=E2=80=9D to mean creating a ne= w tag from > scratch. I then tried pandoc.Header() which does take up to three argumen= ts > but I could not create something similar to

. > > How do I add style attributes as above? > > -- > 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/CA9D2999-4E90-450E-A709-= 0ECCA45E3494%40meddatainc.com > . > --=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/CAEe_xxg8edH5Jqj6CHUseoj2R1nE_W63DDtoF_m%2B8WfBcJomww%40mail= .gmail.com. --0000000000008ce21005fe1134a9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This filter inserts a header before = each paragraph.

-- https://pand= oc.org/lua-filters.html#lua-filter-structure
function Para(para)
= =C2=A0 =C2=A0 return {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 -- https://pandoc.org/lua-filters.= html#pandoc.header
=C2=A0 =C2=A0 =C2=A0 =C2=A0 -- https://pandoc.org/lua-filters.html= #type-attr
=C2=A0 =C2=A0 =C2=A0 =C2=A0 pandoc.Header(2, 'Inserte= d header', {style=3D'blablabla'}),
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 para
=C2=A0 =C2=A0 }
end


O= n June 13, 2023 5:38:18 PM EDT, 'William Lupton' via pandoc-discuss= <p= andoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> wrote:
>sorry; i was wrong when i said that i thought that you can't add st= yle
>attributes (i should have checked)
>
>of course the style attributes _are_ CSS, but i guess that this is ok >for
>you
>
>what do you mean by 'rewriting' a tag?
>
>On Tue, 13 Jun 2023 at 22:27, Bastien DUMONT
><bast= ien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org>
>wrote:
>
>> You call =E2=80=9Cinsert=E2=80=9D as if it were a method of =E2=80= =9Cattr=E2=80=9D, but attr is a
>> key-value table. The correct way to add an attribute is:
>>
>> if (el.level =3D=3D 2) then
>>=C2=A0 =C2=A0local attr =3D el.attributes
>>=C2=A0 =C2=A0attr.style =3D 'color: #112233;'
>> end
>>
>>
>> Le Tuesday 13 June 2023 =C3=A0 05:19:14PM, H a =C3=A9crit :
>> > On June 13, 2023 5:16:32 PM EDT, H <agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org> wrote: >> >
>> >=C2=A0 =C2=A0 =C2=A0On June 13, 2023 5:00:19 PM EDT, 'Will= iam Lupton' via
>pandoc-discuss
>> >=C2=A0 =C2=A0 =C2=A0<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> wrot= e:
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0As far as I know, you can= 9;t add 'style' attributes. But you
>can
>> embed
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0CSS via header-includes. You= 'll find an example of this if
>you
>> search
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0the manual for 'header-i= ncludes' (and you can use a filter
>to
>> set the
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0variable; I think Albert gav= e an example of how to do this
>a few
>> weeks
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ago).
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0On Tue, 13 Jun 2023, 21:37 H= , <[1]agents@= meddatainc.com>
>wrote:
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Continuing my = quest to write a custom filter, I now ran
>into
>> a need
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0to add attribu= tes to different types of tags as
>exemplified
>> below:
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- In header ta= gs such as <h2>, I need to add
>"style=3Dcolor:
>> #112233;
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0" so it b= ecomes <h2 style=3D"color: #112233;">.
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0- I analogousl= y also need to add style information to
>> <image> tags.
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0In my filter I= tried:
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0style_h2 =3D >> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (el.level = =3D=3D 2) then
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= local attr =3D el.attributes
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= attr.insert =3D style_h2
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0but ended up w= ith the below in my html output:
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<h2
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0data-insert=3D= " style=3D&quot;text-transform: uppercase;
>color: #
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cc002b;&qu= ot;">
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Clearly not th= e correct way. Can I add the style
>information
>> as
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0above in a fil= ter, in the pandoc function as I am going
>> through my
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0document block= -by-block and modifying the document
>structure
>> as
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0needed? I alre= ady adding <div> with various style
>> information as I
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0iterate over t= he blocks and that works fine but now I
>need to
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0modify existin= g tags.
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0I guess I coul= d do it similarly to below but then it
>applies
>> to all
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0eg H2:
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0function Heade= r(el)
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= --=C2=A0 =C2=A0 remove header identifier for all levels
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= el.identifier =3D ''
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= --=C2=A0 =C2=A0 convert level 1 and 2 to upper case
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= if (el.level =3D=3D 1) or (el.level =3D=3D 2) then
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0return el:walk {
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0Str =3D function(el)
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return pandoc.Str(text.upper(el.t= ext))
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0end
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0}
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= else
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0return el
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= end
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0end
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0How to do it o= n individual H2 in a filter?
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Thanks.
>> >
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0--
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0You received t= his message because you are subscribed to
>the
>> Google
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Groups "p= andoc-discuss" group.
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0To unsubscribe= from this group and stop receiving
>emails
>> from it,
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0send an email = to [2]
>> pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0To view this d= iscussion on the web visit [3]https://
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0groups.google.com/d/msgid/pandoc-discuss/
>> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A076a72c07-6699-= d243-ae20-64808682ec9e%40meddatainc.com.
>> >
>> >
>> >=C2=A0 =C2=A0 =C2=A0I need to stay away from css since the sof= tware the output is
>used
>> in does
>> >=C2=A0 =C2=A0 =C2=A0not allow css info to be added.
>> >
>> >
>> > Can I "rewrite" a tag in the filter?
>> >
>> > --
>> > You received this message because you are subscribed to the G= oogle
>Groups
>> > "pandoc-discuss" group.
>> > To unsubscribe from this group and stop receiving emails from= it,
>send
>> an email
>> > to [4]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org= .
>> > To view this discussion on the web visit [5]
>> https://groups.google.com/d/msgid/
>> >
>pandoc-discuss/90C7A30F-C0FA-49D8-B0CD-6521B58113F1%40meddatainc.com.=
>> >
>> > References:
>> >
>> > [1] mailto:agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org
>> > [2] mailto:pandoc-discuss%2Bunsubscribe@googlegroup= s.com
>> > [3]
>>
>https://groups.google.com/d/msgid/pandoc-discuss/76a72c07-6699-d243-a= e20-64808682ec9e%40meddatainc.com
>> > [4] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.org= m
>> > [5]
>>
>https://groups.google.com/= d/msgid/pandoc-discuss/90C7A30F-C0FA-49D8-B0CD-6521B58113F1%40meddatainc.co= m?utm_medium=3Demail&utm_source=3Dfooter
>>
>> --
>> 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,<= br> >send an
>> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.<= br> >> To view this discussion on the web visit
>>
>https://groups.goog= le.com/d/msgid/pandoc-discuss/ZIjfUqabWGUWcZz2%40localhost
>> .
>>

I used the phrase =E2=80=9Drewriting a tag=E2=80=9D to mean creating a new = tag from scratch. I then tried pandoc.Header() which does take up to three = arguments but I could not create something similar to <H2 style=3D=E2=80= =9Dblablabla=E2=80=9D;>.

How do I add style attributes as above?

--
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 pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgi= d/pandoc-discuss/CA9D2999-4E90-450E-A709-0ECCA45E3494%40meddatainc.com.=

--
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://group= s.google.com/d/msgid/pandoc-discuss/CAEe_xxg8edH5Jqj6CHUseoj2R1nE_W63DDtoF_= m%2B8WfBcJomww%40mail.gmail.com.
--0000000000008ce21005fe1134a9--