From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29937 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Tom=C3=A1=C5=A1_Kruli=C5=A1?= Newsgroups: gmane.text.pandoc Subject: How to manipulate with Block elements with Lua filters Date: Mon, 10 Jan 2022 06:32:20 -0800 (PST) Message-ID: <590abdf0-6bc5-4f37-a978-a46ad5cff5a8n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2020_540224044.1641825140447" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28503"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBC32RZ7W74FRB5UG6GHAMGQESSCJZFQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Jan 10 15:32:25 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f56.google.com ([209.85.161.56]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1n6vii-0007D5-TA for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 10 Jan 2022 15:32:24 +0100 Original-Received: by mail-oo1-f56.google.com with SMTP id q6-20020a4a3306000000b002daad7a3be2sf8558331ooq.11 for ; Mon, 10 Jan 2022 06:32:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:message-id:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=0IwgZiNAwzXNwzSIo1ek4Gv0mWvEP7onOb4FYXAOQA0=; b=mFN7SKaMWTXTl2SEFZM5VQ19oVAk/IIaheqKsegD6r0mwhjnc6EwQUKIw1QyI+bh1M vTjB31hA0Yn05qU68w0hcIHgyMzmg+9eZBiERCPKBqixI6Xs1pxaBAP6R5cqXv2j7EL0 Dx23XGfaD1RFBTbpFHqKtyWfcaOajqGf87BR7qmOhfzorpJNloL5khAEgbn1Sy8BfL3V mI7Ii6sCasx/D9WamlSY48r339NvC74ayWJImeXJBygAZEHyYaCYESGduzuIyt/sJWmL Ga18apawFrjX6HfFzKLFruhUCv+4+hmWUEC9VkiUrfJEB+zHX3is6xih14AeZpnINLOm BUkw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=integromat-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:message-id:subject:mime-version:x-original-sender :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=0IwgZiNAwzXNwzSIo1ek4Gv0mWvEP7onOb4FYXAOQA0=; b=JeflMPJLYgtfii14J0RVSWQ8tiF1oTFXQMW/Xdyt/76HRlDQSDC5dlr3nNXHUTxqXV f0KPGrWAbSpKi6xJVxt3udzLP5W8Nj9rCC+2wJL/hSKVLaliYMywf4gzIhDvHL/PfA1S bgswQpPUoYYeepFcdbJSbkax+E/wBydw6GzGcs1oUvNaOlfMLiLq/3vZPX8vvPUke0BS akoQoJ4C3crAS8KFazEv5zXQJbA1gYjx0eCEDbarnAk9RHKuUXzjpvXxiQLtY2vHskIa E6nGd6xK8YpE/RfKP4JlS5llaP7l98im3Ee/7GIJf9QJObKe1NPPOnY61Iea9xmhG3Ii k7ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:message-id:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=0IwgZiNAwzXNwzSIo1ek4Gv0mWvEP7onOb4FYXAOQA0=; b=IvW5GJpTKnoCpTqxHi9GOzZtZx9dnrzQ4dabBZVF9Golx/YuRkN+ztqguFYqcgCNnE 6B14EQNO+hWdZvb7eDBOjs3TROzJ/q6nHOwKfX2JWDNuSolSV5VU2/6GHiI1YVa5DAE2 3xoqUlY/3zitMopcpiZ+XQC8cxTIeDnSgAvRjAad0+1v+VBwDW2Po4U/SAeUmNXkK+wr /wryjN0Gs8PqsH3YWSLD7j0sfR3JWykR+B0k/ijze5PzMQSCjmIrvGyrSEVAtSoowiws JDb/dblgMggZUCM59V6m2rdK0sIgDPXli6o/Z9aWRjwzrnrr1M4Q0BpdONFvByanxWJi 1sBQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM533yoZaQ6bfdTPqs9UDDwNmC1AvGLOcZg5zVeFL2eyGUQ0Qkb5BG UumTL912+4Rag//OV0wPFw0= X-Google-Smtp-Source: ABdhPJyNCGJEi1Oj1Y20X4iPg1kYePsUXC0JogsAkNJi9+v5h/UbWJSnvXnw6eJLkGa6KA4InUZK8A== X-Received: by 2002:a9d:6e2:: with SMTP id 89mr26278otx.324.1641825143860; Mon, 10 Jan 2022 06:32:23 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6830:25cd:: with SMTP id d13ls2846024otu.11.gmail; Mon, 10 Jan 2022 06:32:21 -0800 (PST) X-Received: by 2002:a9d:6e19:: with SMTP id e25mr34338otr.228.1641825140997; Mon, 10 Jan 2022 06:32:20 -0800 (PST) X-Original-Sender: tomas.krulis-hR4I4Euo7CWBik42HM7KXg@public.gmane.org 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:29937 Archived-At: ------=_Part_2020_540224044.1641825140447 Content-Type: multipart/alternative; boundary="----=_Part_2021_1096818440.1641825140447" ------=_Part_2021_1096818440.1641825140447 Content-Type: text/plain; charset="UTF-8" Hello, I would like to ask how you should, in general, detect and manipulate with Pandoc `block` elements. Currently, I am trying to replace `
` tag with `` tag in similar (highly simplified) HTML file: ```.{html}

First line.

This should carry on to converted document.

End.

``` I have tried to detect the `
` tag, use `walk_block` to get the `
` content and put it in `` tag, I also found a code using `:walk` method. Lastly, I tried to convert `
` content to simple string and concatenate that in `RawInline` type: ```.{lua} if elem.t == 'Div' and elem.classes[1] == "replace-me" then content = pandoc.utils.stringify(elem.content) return pandoc.RawInline('html', '' .. content.. '') else return elem end ``` But none of that is working. I would like to ask you, how to work in general with `pandoc_walk` or `:walk` (are they the same?) and how to deal with my specific situation? Thank you very much for any help, I ope that afterwards I will be able to help myself a little bit more :) Regards Tomas -- 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/590abdf0-6bc5-4f37-a978-a46ad5cff5a8n%40googlegroups.com. ------=_Part_2021_1096818440.1641825140447 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello,

I would like to ask how you should, in general, d= etect and manipulate with Pandoc `block` elements. Currently, I am trying t= o replace `<div class=3D'replace-me'>` tag with `<note>` tag in= similar (highly simplified) HTML file:

```.{html}=
<html>
<body>
<p> First li= ne. </p>
<div class=3D"replace-me another-class"> Thi= s should carry on to converted document. </div>
<p>En= d.</p>
</body>
</html>
```<= /div>

I have tried to detect the `<div>` tag, use = `walk_block` to get the `<div>` content and put it in `<note>` = tag, I also found a code using `:walk` method. Lastly, I tried to convert `= <div>` content to simple string and concatenate that in `RawInline` t= ype:

```.{lua}
  if elem.t =3D=3D '= Div' and elem.classes[1] =3D=3D "replace-me" then
    content = =3D pandoc.utils.stringify(elem.content)
    return pandoc.Raw= Inline('html', '<note>' .. content.. '</note>')
  else<= br>    return elem
  end
```

=
But none of that is working. I would like to ask you, how to wor= k in general with `pandoc_walk` or `:walk` (are they the same?) and how to = deal with my specific situation?
Thank you very much for any help= , I ope that afterwards I will be able to help myself a little bit more :)<= /div>
Regards Tomas

--
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= /msgid/pandoc-discuss/590abdf0-6bc5-4f37-a978-a46ad5cff5a8n%40googlegroups.= com.
------=_Part_2021_1096818440.1641825140447-- ------=_Part_2020_540224044.1641825140447--