From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32804 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: H Newsgroups: gmane.text.pandoc Subject: Re: Inserting attributes into elements Date: Tue, 13 Jun 2023 17:16:32 -0400 Message-ID: References: <76a72c07-6699-d243-ae20-64808682ec9e@meddatainc.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----KP0GPQZYMLZ1WP0LSSZ4JA6TQGPG05" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3591"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: K-9 Mail for Android To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCEIZSNSZ4IRBONZUOSAMGQESRF7UBY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Jun 13 23:16:45 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-qt1-f183.google.com ([209.85.160.183]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1q9BNd-0000iI-EL for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 13 Jun 2023 23:16:45 +0200 Original-Received: by mail-qt1-f183.google.com with SMTP id d75a77b69052e-3f9d61c0990sf18470571cf.3 for ; Tue, 13 Jun 2023 14:16:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686691004; cv=pass; d=google.com; s=arc-20160816; b=FfiHbKCjp5A4UoKVUn1jx4/kDRCXwH5vg2uf+1bbGGZTLu8l/eF6vaziqCjrfp2oFO dm0jjtnUDIrGwUeujFfPc3zxoqfe4pVqjgg9zSv0YZJVwqNjFji9utdnJfjp8R4hmapk Efk8Is+pdcSZeWfOyXyW+IeHKG18fUSUCznkvGe/IhWMTTGeCiAexvxE6izKEJhIMwaZ 7FFkNjj7Wqq+Iy/KqlwoY9l6FdZ079dRW6CPHtqPUMVbTokKuKXS32c8mX40pV22Rq/O liytLT8kwk1W0Xv0MR+ltmexZNq9SyBN+wMwYhlaJ2YWiyKyXZ6LgM1PTwK33f7tj4a8 sWFw== 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:ui-outboundreport :message-id:from:to:subject:content-transfer-encoding:mime-version :references:in-reply-to:user-agent:date:sender:dkim-signature; bh=7c/nSt/h31JZtAQp+H9P6U6xVt/MMSOBSYrx/Xp4yE4=; b=IAvouTBGHvrDzrb2iutnWTyoO8sGBRPcpisgi1lrZZdQSYfrHwxixb3UjGVQtGsdBh ADp/qOy2BG8vceZ+Lym5CeMhwG3/QJ5kYdS9IJR7BtankyDs5nAhxPbjQ/0smiKR+stA m9f/AWQzGHMX2Dzz/pz0NTvaL6C4QcJnja85O1bjWs+sGWYlN39IZMSnRXnzrrzYJM+m QqJxb5m3jPlWskN1xOqP+GpkPS2ov0BePS01UxfOgh3K2mXf6rK+rQJWJa/WAbFpvXUk 8fmUm7mP1ayZNoR1zB00zYeg/GVwMbxKIVjy6Vu2/nkAojrorZsvZWEQk9O4nUi+ktcU +MFA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org designates 74.208.4.194 as permitted sender) smtp.mailfrom=agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=meddatainc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1686691004; x=1689283004; 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 :ui-outboundreport:message-id:from:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:sender:from:to:cc:subject:date:message-id:reply-to; bh=7c/nSt/h31JZtAQp+H9P6U6xVt/MMSOBSYrx/Xp4yE4=; b=spejlZXx7q2e5GWwcaaKjgLVc+movrvvQYYHBjNErv1ssjFfoH7zGEz3tjyi+bLhpC IRAK5/x5Wk3bxtXouCu0MxOn3DZYfIsbYzRrh/5no8FYxocPBpbaskel4ljxBa4/dMIO qyWa78CdnH0BlZ5ZmEzP6/7nG8CAdsj1uEh/5CGCxNzVxmk4yX657nBObxfZV1ExPAot +s99JHYHkqqa6zM4pJJ2N32BWL7KFanf9XVNN0665+knQzMNkj75O/5q7VzMVqZ75mg/ vleB/Vki X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686691004; x=1689283004; 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 :ui-outboundreport:message-id:from:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:x-beenthere:x-gm-message-state:sender:from:to:cc :subject:date:message-id:reply-to; bh=7c/nSt/h31JZtAQp+H9P6U6xVt/MMSOBSYrx/Xp4yE4=; b=JgYpZwSYQKccfAQyK4voGdw58LlCMt8kU4zWnf6X53HRPNHKfaxVTuqZsI8kuJ7rtQ 59BFKy9gpUOhMlkaL/i77b8RPf2EKvWp79+GrF7e8nCzhZIgODw+LGnVqz+o4tKx4M45 q6aojEsqvVkSQEbOalshxtilQecS6ntOx82IWhpYy6W6Win3ooLr4cMVdzEsJdR17+G7 6bjeNcBM37nuJKIIQbU Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AC+VfDwBJ1m+ibGuDdNADKm6NV7u1U1Lai7sZnsrg5pJYlxrQM8z+A5s rGeBOHiManzXYSy2krltf2U= X-Google-Smtp-Source: ACHHUZ5WBy+BGjcJNpmtaZrfjPiLC8JLAAz5xG8q7hpjpfCczHMOjuCfsR4iq/vzCOf4TqwyUy4Bgw== X-Received: by 2002:a05:6214:230d:b0:625:af4b:4162 with SMTP id gc13-20020a056214230d00b00625af4b4162mr15066730qvb.14.1686691004194; Tue, 13 Jun 2023 14:16:44 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:ad4:4bad:0:b0:62d:e71b:32fc with SMTP id i13-20020ad44bad000000b0062de71b32fcls3919480qvw.0.-pod-prod-01-us; Tue, 13 Jun 2023 14:16:40 -0700 (PDT) X-Received: by 2002:a05:6214:2628:b0:5ef:4455:fd35 with SMTP id gv8-20020a056214262800b005ef4455fd35mr13885587qvb.4.1686691000669; Tue, 13 Jun 2023 14:16:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686691000; cv=none; d=google.com; s=arc-20160816; b=EBvvzvqaPMkyuE66acx14ineLCdy21G9r7rdEu8CI2Z8WTZ3newbiwboMaKDpU8fom r9+1uVGfb2ieoypTpha4qHEyXYBEMckO6iiZeIKPgAP0kpd5/cC1rbdDv5j+THf9Rpj5 h6hjybQE5wppHcFE+TTSJRNLgytNn8xJB0hDza2EWW+NR67fFO9uG6QdMkJMPLYyFftP 6fAnJTE4ugP7dEotqrJDfePjweTDyNJ5J2FhYvH3dDMs0T9bqOe4LEgvsdss58cHP+hu imdCwHi82EgkB0/q/d1r9tLORyCSV2XLf6DLPnLnAmYUcjrYYAXbSSI2zZ6NXsVvTrIU bS0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:message-id:from:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date; bh=yjV0bwunBmjmM1JPbnSb7lPRKJO/fn8N/enJCsXwxvM=; b=M/n3D9Jx5Heb3/6kiwVxJfB2N6ljKbT6QpFCEoi3pvPdVokGQEMfI+xYIytN0Rlx7K NNQRDhpQ5VpuU97E7BPfQfhArN+aRSQepEqE8fLiIZIvGWTEIRfv3gZy5dlZXdRgcqo3 kupfnpsPiiUkiNhzNjcKnQYrhjdgNhRe23Mm6C95OPt46nqyzo/UgIAfimSZSr3Yc83G SJVwDNAMKigTBaa+tJ+NmeNUBL48BDhYkJPKBhjA0ylnG2tiRrKrVJonpjj+0U2Gj9JZ Ps6BRLxkp3CQ5yO5+iYPVDwi4WUUjpxPfzkwGZZOuc1OTC4kfqPlYtTmr60lFziqQ9Ps aMmQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org designates 74.208.4.194 as permitted sender) smtp.mailfrom=agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=meddatainc.com Original-Received: from mout.perfora.net (mout.perfora.net. [74.208.4.194]) by gmr-mx.google.com with ESMTPS id nc7-20020a0562142dc700b006261d48d4c2si847638qvb.0.2023.06.13.14.16.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 14:16:40 -0700 (PDT) Received-SPF: pass (google.com: domain of agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org designates 74.208.4.194 as permitted sender) client-ip=74.208.4.194; Original-Received: from new-host-8.home ([72.94.51.172]) by mrelay.perfora.net (mreueus003 [74.208.5.2]) with ESMTPSA (Nemesis) id 0MbO9C-1qRoBv35Lo-00IoHJ for ; Tue, 13 Jun 2023 23:16:39 +0200 In-Reply-To: X-Provags-ID: V03:K1:cLGwoJKCC9o44lcYZ1+c4JBDZRRJA6E1V28rPzqGFlBiot+LNhk Cx9VM96eKjWdX3Wwdp2UQzucQXXJOWreEXjvtuaI6m4KeDkJLvMorZkDHkDrE25fEx/1kuN UL0UZjFd46fuM6CBMR5iiIarhsT3p7gPBDvdSlHOrG/vF1c0pVuMwiKeP9jGoKqtP5YpyWI l7yqBXkPIZgnxkyCpRCOw== UI-OutboundReport: notjunk:1;M01:P0:T2ykl52u8Zs=;ep6pdAX8FEEnritRwyxwwtQgnq3 mYCNl6szov0iaBHOmm5RL7P9NQduu8ergaVC9gtnYBDOQpmkPoDTHQOWrAzR6vhJpZg9I0hfV jGMDKFFhY/qofUeq0LSmDRTnREEIl4LgdvgYiUCWhmfbNkp0kywIKwy04DV2Wdh5egReUrraO DYa0gyuFclU6dL2vzhvx+DbFmgsoCW16plmo9oXPIuCq2tNYC/dBkLqw1yz7WT9yTiPmWhWsK AF29YeRyX2txwYtTPD1w22FX0MFM709QP0Zvx0be5PBYhYEz3xOrVPjy16o4qD4wZag8ijWjj 6dFUPsRQDfnuKfldarR+7f3cWPLaYjbUhqHFBLAE0l7mVfkjY8olgR0JXMZUgVQ4rPZzYIOBg ui0CZP37u2GjW5+G8av/DppxT4Se/hfoNUBX39rtMAsRlD2uCcAJ6kUFPgxp3Xjud3gsthwnA 6Z0Y3pj617cDlzlI+zdFrzK0zirsa3T74+5wtS7bBeMJgFx/zGDkWavY42ty7eR7cOI760FmV qQ/wM9i/1zU8Yc1EJcJzqbnhFPOc15yYENUfnJ6GCxTJPpof03oKYsDm/s3p/cRhkcQAp8GZO O9AiRdgQWEhvSsjY5rr389NT4tEgZRZ1CIFCg3kqjSLCN0dXrGpGitSRBNZavyp7aD80zDLZS PD0a166ysENlzkzq+y6Pa682enlM4PHgfIfTApQ6kw== X-Original-Sender: agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org designates 74.208.4.194 as permitted sender) smtp.mailfrom=agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=meddatainc.com 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:32804 Archived-At: ------KP0GPQZYMLZ1WP0LSSZ4JA6TQGPG05 Content-Type: text/plain; charset="UTF-8" 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, 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=color: #112233;" >so it >> becomes

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

> data-insert=" style="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 = '' >> >> -- convert level 1 and 2 to upper case >> if (el.level == 1) or (el.level == 2) then >> return el:walk { >> Str = 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 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/76a72c07-6699-d243-ae20-64808682ec9e%40meddatainc.com >> . >> > >-- >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/CAEe_xxgeoT3UjKy0vK2b_w87d-ovNgpL_gRdyDeyb6%2B4SztxQA%40mail.gmail.com. I need to stay away from css since the software the output is used in does not allow css info to be added. -- 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/F6DC033A-83F1-48E8-9947-A372BB0366E7%40meddatainc.com. ------KP0GPQZYMLZ1WP0LSSZ4JA6TQGPG05 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On June 13, 2023 5:00:1= 9 PM EDT, 'William Lupton' via pandoc-discuss <pandoc-discuss@googlegrou= ps.com> wrote:
As far as I know, you can't add 'style' attributes. But y= ou can embed CSS via header-includes. You'll find an example of this i= f 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 we= eks ago).

On Tue, 13 Jun 2023, 21:37 H, <agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org> wrote:
Continuing my quest to write a custom filter, I now ran into a n= eed to add attributes to different types of tags as exemplified below:

- In header tags such as <h2>, I need to add "style=3Dcolor: #112233;= " so it becomes <h2 style=3D"color: #112233;">.

- I analogously also need to add style information to <image> 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:

<h2
data-insert=3D" style=3D&quot;text-transform: uppercase; color: #cc002b= ;&quot;">

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-b= lock and modifying the document structure as needed? I already adding <d= iv> 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:<= br>
function Header(el)
    --    remove header identifier for all le= vels
    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(e= l)
               = 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 e= mail to pandoc-discuss+unsubscribe@googlegroups.= com.
To view this discussion on the web visit https://groups.google= .com/d/msgid/pandoc-discuss/76a72c07-6699-d243-ae20-64808682ec9e%40meddatai= nc.com.


I need to stay away from css si= nce the software the output is used in does not allow css info to be added.=

--
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/ms= gid/pandoc-discuss/F6DC033A-83F1-48E8-9947-A372BB0366E7%40meddatainc.com.
------KP0GPQZYMLZ1WP0LSSZ4JA6TQGPG05--