From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32802 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: H Newsgroups: gmane.text.pandoc Subject: Inserting attributes into elements Date: Tue, 13 Jun 2023 16:37:26 -0400 Message-ID: <76a72c07-6699-d243-ae20-64808682ec9e@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="1776"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 To: Pandoc Mailing List Original-X-From: pandoc-discuss+bncBCEIZSNSZ4IRBCNHUOSAMGQE5T7JFAI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Jun 13 22:37:34 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pf1-f190.google.com ([209.85.210.190]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1q9Ali-0000GY-Ms for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 13 Jun 2023 22:37:34 +0200 Original-Received: by mail-pf1-f190.google.com with SMTP id d2e1a72fcca58-653a1cfb819sf3603825b3a.0 for ; Tue, 13 Jun 2023 13:37:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686688653; cv=pass; d=google.com; s=arc-20160816; b=qSPF4cAwKNYBjUwhI5CK9ObtFcYfdkbeM7t1hHjyY1i2guVS1mzI6/FTgffvW2aoO0 OJxpKvTXwlpCC9ELaj3v5Xu6GRnila9xwVw2tE6pQNyDilUmdSZxF45MoMpEl+qIPWWZ mldYkB4OM6Lx6rLvjVrHC0kpz8a47LFNEdRPnu0hVTq5xiX6anUYJMLkz7Ha+jf7Wrtv DL/JEl3RCU0zpc0pF99eGbVLUSwxpt2UbUN6ouEYC/jPVQ6YRudxl6rarnXGMmQOJgib 7Trjz+bHsaoF1E2boBxFxHBzuGUlq0LwFk7DNMRbG97QjMUHxWkM6t7sW+nPcJzo6EJZ HIXQ== 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 :content-language:content-transfer-encoding:mime-version:user-agent :date:message-id:subject:from:to:sender:dkim-signature; bh=gZWGqgJpRpyYklUXCYUeLTJyd9FsVNxepQhKVN7lTW8=; b=SJb/Qea6FidclH/OgBPhbyjaFWLtVb4A/uHtHawqViIP739u+0nmpbAOCmOMt7ZXTD AePL7DbRNF8rPqwa1SuXjM7YUbT4vXd4D7EzjZBeWIB1bp0XzRoP84lp6AZSQwC19l0f b1dvrCjp+YPzF6bDKo1RUbvyf0Vhm7H2mK8coNEciSOY6NI7p+hHDmFIO8C3OGk1UsX+ KzNQPnw1ziWhrS2yVJ2aA8yaKBfx82lsh7O5GgJkaHcPbTmzHpFlp5qaNEljQqjD6LG7 kl97pxzAu672Gey46vAp9RDoA5sGrYqwINXIMtdKuZC+XCx37JZFKnJFkozBrUDQuMp1 acWA== 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.197 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=1686688653; x=1689280653; 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:content-language:content-transfer-encoding :mime-version:user-agent:date:message-id:subject:from:to:sender:from :to:cc:subject:date:message-id:reply-to; bh=gZWGqgJpRpyYklUXCYUeLTJyd9FsVNxepQhKVN7lTW8=; b=GICF9P9IiKIv9o3W0pISNBc5oS0+rlN8akDYkuTMdCh2gV6DU7d2kLvYUcTtOOVjwU DOGkQNOBpNkbE396CKo8egGbjKHahsaR5GzFOxWnPrOAk3/QkJojji8+jKqcybMdLWMF L1jZlVt4mtv9Ss59bFECQ1vUUsbM9HdIDWRvZUu+DYoJjoz18QPQkVbSQhT7A6KoYmxQ NTCvjutGa7EVG6BZ/qSR8wKTrXeVUzvFpF9zLAii/q6zgsxJJx4z94pkqdRDZAJeUxK/ VjDYQ7PLQowzLL X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686688653; x=1689280653; 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:content-language:content-transfer-encoding :mime-version:user-agent:date:message-id:subject:from:to:x-beenthere :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=gZWGqgJpRpyYklUXCYUeLTJyd9FsVNxepQhKVN7lTW8=; b=TKp+9PQhUTZunR0aP8awD+bQiWTzIai0dwVgou9HRuAqbKxjGVIyz0R2sR2m64Zhmq DcCGwN1gWRapIrjsTdVMAKO6CKbOmVH63x38S9ldslr81o15RULbxG3wiylXlejaeRgM UfF9ymz3pd9UcuJa7itPi3riVFmyyrAU9S5ah6oUTbcDoD3vWyh60Ty57qlH1eNg+ape 5Yk2A73I0loudYVQltds077Ou Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AC+VfDyb8ctEd916RTiHiYapsqz3CFSO9QF2AtDKEEx2WazYPBsnOQ6w /mQS5Xn7mp99X3bFJMsyURI= X-Google-Smtp-Source: ACHHUZ6M2lsznHwwxybxw9UUMoIcrjiTKgHw0IwVu1KsbTWARubTzGzQlSnvHQu3jdqE53KdK3OMYQ== X-Received: by 2002:a05:6a20:3c87:b0:101:282c:2b with SMTP id b7-20020a056a203c8700b00101282c002bmr14650089pzj.32.1686688653147; Tue, 13 Jun 2023 13:37:33 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a62:cdcd:0:b0:651:e298:bc19 with SMTP id o196-20020a62cdcd000000b00651e298bc19ls145595pfg.0.-pod-prod-05-us; Tue, 13 Jun 2023 13:37:29 -0700 (PDT) X-Received: by 2002:a05:6a00:997:b0:657:2f01:6078 with SMTP id u23-20020a056a00099700b006572f016078mr15840770pfg.28.1686688649245; Tue, 13 Jun 2023 13:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686688649; cv=none; d=google.com; s=arc-20160816; b=1CsZQ/H5RoS7qUGrEV2r1LVcSdxZOnlYA5vfLo1QKKSwp6m17u647vBCprDBytEvCr 2oeRZRhUpGdQTtpb60XjCM48hg9Pt/kMFiO1Leb/wxNVZuBWxl0G9+cqI2GZcBMcLu1m 0Tusg4lgqnpyvviLay+tsIf/aNBm58FiwTHdp/5LNlsOUjgmhHf36OxQOeO+32NHN9Ch fke9O3dLcJ2K0u+KoAjOCHDXgQdAjxx8/DRHFNykCtsd9FCI3rgzzcO9KMwGrCFVMc0U ME53Pa1t7mdMEFi8QDgDkmtly3M0y6lB+sNIhFDkK9rJ9XMLrRLjZ2bpSWdlXLx/sNb8 P46Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-language:content-transfer-encoding :mime-version:user-agent:date:message-id:subject:from:to; bh=BHfUFRF2e0Gop/jL8mu7Qj9sVEiUcxZJxc2pGCORSr4=; b=Z4xi9JtP1euaDWZWy94Sw2HMrIwYI+nCc4XHRZP2GpZvEwgpyz5ntD6ZivnQjyNxHi meIp/hEoxxLxX3U/wlvzqtCuKt8KWys1YzI9Ngk+dxP98dkbZhKngs7idT0a7tUi/C2X 5RaKlj8zLI0p/xYVxzHaqjGrIcfMUTzHpng0sQvD1WtR1h04LSu1pSNbKvEKmNWuZ979 hkqK2fTPYWWvWzRXiPdc3mT1HAjRWIIwf0HFBOoOdfTxYBkPAsuSjjiN23PI+yhwlQf2 MB1H83L0EH1MzOBiMpwwvsOKwWd3DJc2sC00ROtS/3UDc9eOYmuGxAMCyyMuvX9KsW1h qJBg== 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.197 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.197]) by gmr-mx.google.com with ESMTPS id fc1-20020a056a002e0100b0064d71940f98si1256332pfb.5.2023.06.13.13.37.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 13:37:29 -0700 (PDT) Received-SPF: pass (google.com: domain of agents-FcZObrvlYduBUy7/sJONFg@public.gmane.org designates 74.208.4.197 as permitted sender) client-ip=74.208.4.197; Original-Received: from [192.168.1.17] ([72.94.51.172]) by mrelay.perfora.net (mreueus004 [74.208.5.2]) with ESMTPSA (Nemesis) id 1N5mzf-1q3DLg3aAN-017Awb for ; Tue, 13 Jun 2023 22:37:28 +0200 Content-Language: en-US X-Provags-ID: V03:K1:Inye4Ukw7cLsJeDo81NSVNceYGpuPeUSuv9HYHHqLlJ2NKEfaFJ hHG8HNPcHKJqpcrllKCuImXAZwzik4dOuhCSSaCIs3dNaopBG/qyAsrGnrMdDvgrlJ21wa4 HRd2atrw0HdWOHN7k83wQkHoeOOM/E8ojg3s6HdyZpxqMHlQCClvclVd1o8K/FVgNgykzYR 9KSw8F2rfn2Um56A/3s3A== UI-OutboundReport: notjunk:1;M01:P0:BJ57RrumYRg=;ZOLWQUvyYk6V6ElHOptybRqNVR/ FfCJKII+wbDJMPrWN7heT24BYq0OF1si9CiACewQQSZeeZtL7qajCNLNpZa5TZjdRZuzaSQzn 7XTyIjAQ4HM6idmt9c7mH8qobEeIR8swa4/xLYdvtQXjg1JZ+r/2lFBn/u98AXq+Ng7eCMURQ NALX1Ug//slXzo24cxsHA825UTUp7qyBjZJKEXV+SIOg7NNmYCHPT5nMww+UjugUNY119ZQJV Ki/KP1AdZvv/enT68Fu/2YBKOTyjS254EETdWJ2ifEgDIyuodT5jn+jw9dsmvkYhPHnhKoerF lPxAWCq0PsFFDPhZuZbIX6UfGWafxnJEQFNFof0T4e4v3L5WbnuTRjJwsvq3rIadToshzFZKY i2/tTskdQTVjPh0pu8X5JSsI+sSW+H7AL6ZjiBQAKIBKFEAupkxsa7yyjpkyFgH2PfpoyyQok ZX03N4i8BaFpiU/X6B9fOLha+4VufeB8q1HxGPZSi6zPcDWwXDfgDj93hXzDHr/yvAlEf6Act OIV65xrSkiQYDhEl/+lYbEHPTzV68PGObE+aPioVKezJZgP4k33QyyEBqfKKf6KrUE1tfZugB wE3e/YuOGYUWfYiW5ywOqtQEXZn0wCcULHPgcLsdYNP9fys2lTHs+3ZM/oPn5NUV6DKMSBZYu +eFJcppiQUvxPcCNvs4dBmMlAt7ZSGFi9kGSBB2CAA== 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.197 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:32802 Archived-At: 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 i= t 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 =C2=A0=C2=A0=C2=A0 local attr =3D el.attributes =C2=A0=C2=A0=C2=A0 attr.insert =3D style_h2 end but ended up with the below in my html output:

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
= 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) =C2=A0=C2=A0=C2=A0 --=C2=A0=C2=A0=C2=A0 remove header identifier for all le= vels =C2=A0=C2=A0=C2=A0 el.identifier =3D '' =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 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 return el:walk { =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 Str =3D function(e= l) =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0= return pandoc.Str(text.upper(el.text)) =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=A0=C2=A0=C2=A0 else =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 return el =C2=A0=C2=A0=C2=A0 end end How to do it on individual H2 in a filter? Thanks. --=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/76a72c07-6699-d243-ae20-64808682ec9e%40meddatainc.com.