From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32808 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:58:21 -0400 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: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22006"; 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+bncBCEIZSNSZ4IRB56NUOSAMGQEB6M7KPY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jun 14 00:00:27 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-qv1-f64.google.com ([209.85.219.64]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1q9C3u-0005aA-PC for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 14 Jun 2023 00:00:26 +0200 Original-Received: by mail-qv1-f64.google.com with SMTP id 6a1803df08f44-62de6bba496sf17381466d6.2 for ; Tue, 13 Jun 2023 15:00:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686693625; cv=pass; d=google.com; s=arc-20160816; b=R/kL9IsIyXCsuZITkp9vBhaP4bxGPMz+t2YN5XUJCcUSK2yFmiqN8JCRccAYQRZOW8 llCU8QnV/1DhFDEwS4k7vrxq+1zqCpiS/Ve5DIoylGXNc08VMYe9+D7EeWXsTZsXqt/7 lciCp+L3AOonOIn/p2JToTKLFMqwswVZWzfD0E65UTtO08ibQa0wbm/bbLvfXoMjujMm TevQiGCoMLdESuENT9wSWx+0NRiF2Cx8fCvZBopRhQm5cpmhfqMk+txfKBvZTtRRN+8G 01r9clRLhGxnwkVXWQn9gNYivfmiVNodqRJJXPo6p4OJDVjMfIvYfQB9aauzXJVlWPCG eusA== 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=qOUIa/BcM+K+oKOezQGWRyEooLSL8756qwDrtYxaw4E=; b=N5PPkW+fe2ZDygUGzBS2UixsvKkjtFxmA3jUPnSDbseBbTLR9DJkxcQNSc3YJNmO69 PWYexjmHK5Z7WlnDE4ZSrMZQuMndhvjOQA9dsnpi0bntMlHM0RRZj5OyLeyHD6Y68raC mZ1jK771i8LsNnWRNI2siUnUuAqo32nC48o9+SiqMPL1s527ejXhXW91s2gc7rzTbVnR 9fSIuhE+OX5AuBFipY+s5J10CORg+4BAMv2l+HWLj6E01ZSpSfkxrVIh8Ixodfb7c1Ti PFH9K5Qe9NYrVtODn3c/P0kW2O6A+w8hu0Ur+x97loSAqyfCRgw92027FRw5nhZgqHm0 YxLg== 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=1686693625; x=1689285625; 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=qOUIa/BcM+K+oKOezQGWRyEooLSL8756qwDrtYxaw4E=; b=TBpsrSFlxGL0x/KwZ7PpQ39ds/MumJFmXz4kMh1DMPRiHnMYPArcvGtZBRV6jpIB69 OEpMQfP35GeeLC7QgdO9xaASGUejAelXp6WaAXYEFOMys021VrB3slhI/afczIKHc6Uz TgZKiH+G0RSfYu7rtqISWiFsaPuVqtauY9vwszRkcTlHSA7uQ7koyI+fZEv3keHQ7fi5 eHz1nPY4QO+7kBhEiPoWYn4V1exkwgv/xs7Y0ypE5S6SJIH1ThZtd4PuaMXxnN8ZEHvz rLIRQ33X X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686693625; x=1689285625; 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=qOUIa/BcM+K+oKOezQGWRyEooLSL8756qwDrtYxaw4E=; b=GHYrnBUE+D/aEp+ONOvTi7TzXgjxifRog6WQ/5BJ2PeRlgxEeoulgq9xJCEgLSH3Vn +3ViNMSh+uY7sNAGee5A0NamuV/XFZ2Nr6sWS4ROGxPefD59gwpgz8vC7St4wOxdTyNX /MQRjizZLEQTZFPojsqbm2TPCtnjxuitOv7TCA42+3UttlFYD/1onMqBvc8kRBg4Z4eR VzUQ58usNuVWbWCZ81/ Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AC+VfDwaBNiXFEF0WdLl0lWwG2bPppTmzwv/uV8PpFAJihjzL4p1a8/a tIzohs+ToLmSNrrH4PlN3IQ= X-Google-Smtp-Source: ACHHUZ7+t7uN557AI+5VC0J7/SfeBfOjDGNj7/0iTPI9A1tlebJrfUQL5yQMzAHP7ppoY4Bqz2GIhw== X-Received: by 2002:a05:6214:27e4:b0:625:aa1a:9382 with SMTP id jt4-20020a05621427e400b00625aa1a9382mr15348491qvb.62.1686693625617; Tue, 13 Jun 2023 15:00:25 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6214:a50:b0:626:a29:5d32 with SMTP id ee16-20020a0562140a5000b006260a295d32ls1275703qvb.0.-pod-prod-07-us; Tue, 13 Jun 2023 15:00:22 -0700 (PDT) X-Received: by 2002:a67:f446:0:b0:43f:4779:49b9 with SMTP id r6-20020a67f446000000b0043f477949b9mr482713vsn.11.1686693622523; Tue, 13 Jun 2023 15:00:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686693622; cv=none; d=google.com; s=arc-20160816; b=LRItJWCfDoskuV9uHscQLt7AJfoHkuxIc++GxMxa7GvTyMRO96YMi9IuSzyGwLsMAT nj5JO2+MDz/g0wGqP/OImSH4WrDECasBqZkl2H+iIZDpNYw+1iNgfEkpR5210c6bZaz+ HcfaIBLvZM/imcRUqc/4z6gu0CA+3l4fCPYNWaEMara1UJSIJECD3Tf+pUh8jYQi1Zp9 NwA+wAGFw9S/+kGTYA/2ccUaATOcu2sr4tS21gDGqttMVGoLoEYj+wiswOak84ehinb2 VMDY1MxvB9xpEUkAREkElxla/NRvKNOJ9TNArhQJDYTG1IPJLvH+rvuHWG7gIIWxeVG/ ksFA== 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=Dt9rTPbmsWRINou1ujgzfBwitZxQFA7cToG0YoCGl5U=; b=dFkCuHEqCieH1CDPvkGwoSMK9ZEb0O1BYBceU2ME9c3bHTuecbMg07OEv48NDH1NA5 RnxElC2CGS2tq2em7SsUTH8mkDLaYiuXDntUebDPcjPrlD/y1cSAeI13Qcc0lbkxrze9 jnuvqSy5sDpWsjipWk94au3SguyVF9idWkGFrxYEastxCQajWH4kRjYmrvUk0Vqab2G5 Iy2awrTGpjCtvxalnEBZ00ykyLO16ow7csEf0zT2Gq2A04r96666CgYHrydtgRlyB8Tg mKa3Dp3txuetAySgIXSLvPvC6TtdW+hrlmU5cm0suv9rAWxgqiVJKVQFBCQSCBUnwMGS euGw== 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 e18-20020a0561020dd200b00437e504434fsi1399067vst.1.2023.06.13.15.00.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 15:00:22 -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 android-a0fb9fd88e6aa6b0.home ([72.94.51.172]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0M6SuT-1puRA62NR5-00yTYw for ; Wed, 14 Jun 2023 00:00:21 +0200 In-Reply-To: X-Provags-ID: V03:K1:KscPXL6Tuqaco3yIBUCNxj/w8HutuCDnORIfHKXkCnZMEvLmo3l GD+9kPMBJIy7e2JM3IXjOQyE+2DbCQWSeE1cThUsX7tydbPc7ilSmM9Lhu/22fzaCg6Kbsb HzzYdcmjjLavyXY8NpTz5PkmkeMbx6tBQcaN1ceBdazZ/52B7ufMV2Dc+liVVe0JAfrMfQK e1B0bzo2/nn2m2L+yBG7w== UI-OutboundReport: notjunk:1;M01:P0:kMMeNw6hpdQ=;bUU3Je/GLUvLTIVUAYfMn185dbV /hWdGbBhzhf/JkqDa++o9V2PbyK2tDv1r+NYFe0wHGfyds3IlwxJwYc45BLg+D2kvKYaJLp0s KdSwWLeLe9FA65m1OPkmHG3zIr9LcD2WRMvC9JsAcyt30Qb5tg1diuXAM4vwjiKlWuvEQxwEP 1DCqSlIxXzU3mN2DrGO60WZsnK2oxpLfxsufLaLga1ln5nYsXxFKgOneoADbhhBd6h+vXQ+9l 7tJZFgafPUPPffbGAfQlGC4ZJ5cKFqeOupbqPsgQjQOCo08f6ydDACnTkTQ7sjeqY5kKN/nLs qiqGIx+pjJAcAQeT+4A+BJRq+kgaKX7TyYX9NspryWR470LO3tsA0hGbqibIwbQnif3q3+wbA NepxKUzuupJs8nKuPZf7DXLBqTtmL6agJ05ySgBWHP5AN/jECFa5o0axFYYgthKvmhvJ0qiX1 nqkl5deTf26d00evEqBtFvDdhao6HHlfarRuMSfvLim7AJQUkl7+Jk+vk1fpuQiunl7y5Qq2s p8JCWecl0TM0AT5BH1+a0aDPmcW9dr4G4CQhXvsx8gUHWIDR8ow+J30ZqMfJKYKLrsAx7Ee2f 1j5JOTceWmPDFrNy9Z6U5TrHRkPVJESepOQpsUP/nxVSqSvESFrZBakfVJz+yHypWTwih2iYe YqgsyQ495KeToFGRxIulaSxiAdX/i1KPbNLSpGR78Q== 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:32808 Archived-At: On June 13, 2023 5:38:18 PM EDT, 'William Lupton' via pandoc-discuss 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=9Catt= r=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-6= 4808682ec9e%40meddatainc.com >> > [4] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >> > [5] >> >https://groups.google.com/d/msgid/pandoc-discuss/90C7A30F-C0FA-49D8-B0CD-6= 521B58113F1%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%40localh= ost >> . >> 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

. How do I add style attributes as above? --=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/CA9D2999-4E90-450E-A709-0ECCA45E3494%40meddatainc.com.