From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32805 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:19:14 -0400 Message-ID: <90C7A30F-C0FA-49D8-B0CD-6521B58113F1@meddatainc.com> 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="----QOFSM4PPT3RXV2DPTLH2VVZT6M66T7" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16933"; 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+bncBCEIZSNSZ4IRBWV2UOSAMGQE63MPZIQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Jun 13 23:19:25 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oa1-f63.google.com ([209.85.160.63]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1q9BQD-0004Cx-Cd for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 13 Jun 2023 23:19:25 +0200 Original-Received: by mail-oa1-f63.google.com with SMTP id 586e51a60fabf-1a69fa650c8sf1999481fac.3 for ; Tue, 13 Jun 2023 14:19:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686691164; cv=pass; d=google.com; s=arc-20160816; b=ASMmvmkRkmvxG6wm7wkKBPqN623RpId1w5hg74BHly7QasJCoJBUMN9JBHEBJGATSF qL3wCJj3BAsiz96qs6ioelRSEAT4d7/c23lpyWuaj/5jxjKeF4B7RQEsDR97AiigfD9l DT+bRmS27Lqnr9ldV5CEDBf8Zw2FOJUwKuUmB25rQLmD5QgXVob3LwJJ1uZ66UObeNN8 TWcn3af2o948JBD6h3RwDusD/rjjoXCSWb5zg6EWklFcpGlbjNxHwV5L6+2X8sJksFqX nJbp4kIwctxk5WYX1Y40/AZBi0Ap4gNHdj1vm/CImy1QuHRDzdCeol5KEoGJB8QE6MLl tAnA== 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=EBrqGVI0ouF9KXP5/Q9o5/ydjnLPiLnuPgHzM0sJFpQ=; b=iYW00kOb7YjNGos0Plfeg5pJirQmjxZxXgPd2EG2VIVb2NtMMhyiEdMM3oWiYYyqK0 WYLH2Vueqzl9nhJzdkcy/TaLDGTjkj4niUCgliLZuw0Gds7cGo32oEws5E7fMHA6X0YD oPODOwHoDuBEzQImMW17UDRP28lm49XQm7ZjHR3WDAE29EkwkmLR+arpdyM7fx3zc2m9 jMA0/bNMEZrBD+cYDxGFmzpvFzk2O8ytZWtD40oe44NG6uKs9gDe7wLRvShe7EHG8dtX AI9NSY1XoGdceFr+8qubfAHsp1+FW4MHbMAGb26XoZBzT6A859AmvbMcPABHJP5K8iGf xDkA== 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.196 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=1686691164; x=1689283164; 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=EBrqGVI0ouF9KXP5/Q9o5/ydjnLPiLnuPgHzM0sJFpQ=; b=Bdde7QSHw+qRyDc69050mqUmyKp8GCtcglttizdJzcnSD78iyNFwKgYFOcnnm8BgSH ZvNrOZVM/IXRn11bZGZdsHtviP78WVVb7HOYU2uGP+xoJ9FhvcjbaYLS6cFXD5kvhcQL c2pmSeO2KEiGodsMBgVFGfwKGE0VvkeenrTwdAQ0PmwhBppEwDO8kpAmSEcV9id1mBfL dJ/GDgV2bLQZjjKwaPYiYiXKGfb2zRn626K45mGstzR2FOlt6Kz8EJO8X+5fZFnedRqv IcR7plke X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686691164; x=1689283164; 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=EBrqGVI0ouF9KXP5/Q9o5/ydjnLPiLnuPgHzM0sJFpQ=; b=NHjY8vNnzYvgRSrsfNWEqPsb9/XNtWpGZPtZpicc99VTDcjZklWiHKaqUIKCFPfLyg 6DmSX9khQGA5nhcinUv+YXY3lWJQmt3Jdktc3PNOvGVSZ+SUbs8rxQFPcZZpko3wiX1U DMMT43RyUU7kmNyIy6fZUXOCzTQYg9c02BBtLVhutMViWY5B5wkpJnVAnVM8xZYdzK5n ak+8+7DsQyvyfQ88LKo Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AC+VfDyk9ZGLINgZzRncUXZWbq73PyW9yH/SY81qY+iNMhudDciTBKdW t3DMYCuM8qiYvmxzA+MZXSk= X-Google-Smtp-Source: ACHHUZ5RT0JSX8UjlQDgCn2R6eUFswYamqgMiC90IbBYn3ivV0YLClhSgEJIDeZ/Nr+meO4mJZw2sw== X-Received: by 2002:a05:6870:5142:b0:177:ad57:cb36 with SMTP id z2-20020a056870514200b00177ad57cb36mr11091588oak.27.1686691164308; Tue, 13 Jun 2023 14:19:24 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:cb91:b0:19a:355a:bf90 with SMTP id ov17-20020a056870cb9100b0019a355abf90ls771744oab.1.-pod-prod-03-us; Tue, 13 Jun 2023 14:19:22 -0700 (PDT) X-Received: by 2002:a05:6870:5142:b0:177:ad57:cb36 with SMTP id z2-20020a056870514200b00177ad57cb36mr11091499oak.27.1686691162082; Tue, 13 Jun 2023 14:19:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686691162; cv=none; d=google.com; s=arc-20160816; b=dFoEPxEmnUBrgMu27SSIuRLGUCVwOcL+xddsUPo6WJxTvWVgY3pYPIA4b0NMDZJeLF NjlbLD15UI4CoRXc7Up0/rrCxYIPqCq9XxgXRIeIgBQP8oFdKCt7uubpI/e25ERBSR2M 3wkPfDCRYoxY7nDxvLyBrqwbp12CTkhTKJ9auKyqMmgTvadhAIT8pdjvjmOdOMS/S4W4 0zDVF7LxnJfOB5t/qNmTJeVbPwySb3hcHw8rFr6fVKoSQlji+j3xRB68kB6JXwF6YnsZ zNj6DUXTkotCqbAftWoJUr3pB7rLUJ4RELlhY9lcSBiRikVbIpC7JiYuJWbcYDI2GS3u dg6A== 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=CHIMnr6UFw9fzGVJxPmQAOzFEjheFuU7UB/fmuT/iZM=; b=afM2Q50f9MgjjVT4vkm6DlgaSyO75iAeQdBrmdeby9Id4NuiV7jFcUDYi9cWviQ6ZK z0F4kUyh4bP4J4M9R/qNQNQXjgFq13+42UJ4G2sLRc2wTLS8U8G+OwI06ZVGOuNtSuhh pnNyz16BuvhcxS9Zvwx5TQRzvu2FZJP3I0yV/DxFTx7Sc1NsCW+uoeYIRfGb6zlaVLOt h+XPcFj+dhTcDuHQj9GSEymYyKrASU8Lh+aqEFH3L4pvR3H7ohFxTiPGfyt+xaWxiHh7 Q8kEcXpHGEnHNV1aiZ0E8WkVleL4eWrwgxSAdHl9knBEpXatuDv/0eRTF3sAlgRldgON D4kw== 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.196 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.196]) by gmr-mx.google.com with ESMTPS id z9-20020a05687042c900b00192c6345ea7si1091003oah.2.2023.06.13.14.19.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 14:19:22 -0700 (PDT) Received-SPF: pass (google.com: domain of agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org designates 74.208.4.196 as permitted sender) client-ip=74.208.4.196; Original-Received: from new-host-8.home ([72.94.51.172]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0MNJJ1-1qBdBo0RRZ-006vBW for ; Tue, 13 Jun 2023 23:19:21 +0200 In-Reply-To: X-Provags-ID: V03:K1:SmfNasZR3WJu84ZBQxvWwLMR5BDQIsnNuafOCe8UGCRn0dqJeCm amrXLfmsavYUzFFC5zbbggEPmKi4DviiuueHlClCJ+PYU4CFKeva2xlL72UMsiaLv2uIjWe pH+LiGGvb4CIqn1UcA7oI9/YtLRP1bbyW94RTh8WCFq3ILFLtYMmGLctEt6251cGtNmELNd X9QaTnKicoQXBz4WMCDeA== UI-OutboundReport: notjunk:1;M01:P0:jytYDGf8Gao=;P9GOX7Drul/jI3X3d7AmUwM2bHT 6blE6rlHt1fsW5ggew78BXUJXowPXkVPGdqfze1QQtSNvrv3s3pdXsXc7wHjHl1E4TPo7YAxy /R0m2KzNE7a38h/cRBxQn5P9dRXTgsdoUJNAjLG9TJXwqnT/ghx4OQ3Dyyzg/tKDbYUBB46kO imfnkbWknes6K9HYpac2udRit/Vh+D/IUrEZRHqxP0pNtAyqMvN47A20vBZhgc4CVIyrwUgR+ EcMZzIdqOwqGCDpe4T+Ql6bxJmtOEeMLST342Xe6zyao/PDDWf8vm13eUmrtCzxC+KmR4Xnow IiC59uB1l6I9jCGc59C9pmPAbzL7UkakRxtlWaDI9iUg58eUE7UlC3vjBfdqsQStYkZ1zeFso 7oQ/JwxQLZEOYk0fwLGlMgAn8fH/ed8sM/H+OBTVC5tmKtE5YjgJHhxsLXaraHx/RQcV29Y+S yWjjz+/KL/kuKrX7W45KbZXe64eZ66MYdF1ZNGP48roe+tcO0jMZvIaEcq6dE7qSvngB+aH/W 8BElE9HDB1lumFTaFH4HGW6WcJFhLaurGF1ETdyux/EMinkFyRZVPjdnklhlFmByjADCEPOb3 V1sYfM5NAyJqmIXFfrrkarLEP9p6IUvUBfNQ1VNONCB4bOUjnGAWwJQa5+IeuSVS3aCXGJuyu WcOpVBqkGcMaeJwH9RV2LbNR9dzSgoNAChqW7oyNrA== 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.196 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:32805 Archived-At: ------QOFSM4PPT3RXV2DPTLH2VVZT6M66T7 Content-Type: text/plain; charset="UTF-8" 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, 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. 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 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/90C7A30F-C0FA-49D8-B0CD-6521B58113F1%40meddatainc.com. ------QOFSM4PPT3RXV2DPTLH2VVZT6M66T7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On June 13, 2023 5:16:3= 2 PM EDT, H <agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org> wrote:
On June 13, 2023 5:00:19 PM EDT, 'William Lupton= ' via pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 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.=

Can I "rewrite" a tag in the filter?

--
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/90C7A30F-C0FA-49D8-B0CD-6521B58113F1%40meddatainc.com.
------QOFSM4PPT3RXV2DPTLH2VVZT6M66T7--