From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31853 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.text.pandoc Subject: AW: How do I replace a string in all text that pandoc converts, i.e. how do I do this with a filter? Date: Tue, 6 Dec 2022 09:59:59 +0000 Message-ID: <3db81523c80944f3a81a18f25166124f@unibe.ch> References: <83eeff5c-8fc3-4ca3-862c-bb85790daabcn@googlegroups.com> <3ae58adb-8789-4398-8ab0-fe1e6928e292n@googlegroups.com> <24509d5ca5844dbda07b3e77d86ab3f4@unibe.ch> <2faac96e448d4303b3ea0e12ef05dfbe@unibe.ch> <7cabb17e-9a2b-4251-bd95-c5415140c9adn@googlegroups.com> <272ed09b-4245-4128-94a2-50cf5f67e10dn@googlegroups.com> <6d25bb08-224d-4f01-8eba-3f1c55d19e83n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_3db81523c80944f3a81a18f25166124funibech_" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1208"; mail-complaints-to="usenet@ciao.gmane.io" To: Original-X-From: pandoc-discuss+bncBCZ27W53TUFBBI5FXSOAMGQEPVYDOQA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Dec 06 11:00:11 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f184.google.com ([209.85.208.184]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p2UkD-00005H-UE for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 06 Dec 2022 11:00:09 +0100 Original-Received: by mail-lj1-f184.google.com with SMTP id t8-20020a2e9548000000b0027702e8a5b2sf3818531ljh.20 for ; Tue, 06 Dec 2022 02:00:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670320809; cv=pass; d=google.com; s=arc-20160816; b=yijs5wRAzDmBSYU0VSxoIclJnNiGtDkT9NG81wFWf/uYZNT6cCFRHR4e0xKkeCD1gL KDRPNN4Ml6DW/sowHK7wNSFQ69+PsZ3SJLY4ogyeKXzM4W8FmcJtnt5cAy9k5izR+IJA rUYMBogtysNprOj1T6TUif9by3JayX6Q0hvzE4exHhfoNmxYLEdgy9LBXdbZRdUNj0GG n8lVKOKgvNrwSoapJqLRbHtfuAJmiVuw070L1WO8YV1NHMkj61R/JXtp179DG+z/H9mb iNpOO91DAra9sv1pMU62co3oI7HJkqsG+twlgsNKEvS08lXlJVSqsZJZbo7BEUgxSl1u mG3w== 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:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:from:sender :dkim-signature; bh=XyaHe3Ea6xrkY4g7fsq3XthGKRSdHKyPS2KEJdVgPyw=; b=LlNOhvfO+94V7lre56MBNICh5nwjneEKaJwZKeZYz32/tDrqRa27rA1lB4NDVUQE4f j7+OEnmwE/4jW3yMiUZTHTBUx0VJdvv8lG8BQizsnFvm/Pbfa97lSzpmGBBm88d+E5ds K9F8MYS0YJA3n0NJwtHAfluo8RUyX/biGN3gc9wc8MLuAbxmJXMAzkk8Gk9mRBQUHr+G 4wUlRywnBNx1N5fVpkUXxRj0X98/SAhIKYjwmpBVY9xb9Gg0QuYQD08N/rnBKdRaUorE MOzfnZy2m6xV7oRvItrKRNB+JSmyLisP+BJ5UzVsCxFVyWDUwCEJVGtNhXOfAiKfBbWl giYw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@unibe.ch header.s=mgwsel1 header.b=cnj9jzEv; spf=pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.82 as permitted sender) smtp.mailfrom=denis.maier-NSENcxR/0n0@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=unibe.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; 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:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=XyaHe3Ea6xrkY4g7fsq3XthGKRSdHKyPS2KEJdVgPyw=; b=hRsrBu8YF7fJNpOJfxOoe9vaCtTtvNIyMdWTkMbmQaGAyvRURl3cq4WyiJHjwxWHfN pKG6GypD34jTJukthac8S62y/xwy6zHrrCQlDaotMDz5RVUD549nxIf4z6GY18ZLLsrm /y0d9xbIZ/RzMnI2mO5o1NCm09kjaq/uqnAW9IYkuGaitsROiKDN4L1Q7ygaSC7KGUwU /Y+l9pgVLyVE3a4rG+ShChSCq2GWz6XmoaDIm9vkU+qLhn7OnOPxXr4yIQ987oHf6bDF zQO/MyzfM9ipfxu3xp7akIayk0c4sf6u X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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:mime-version :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:from:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=XyaHe3Ea6xrkY4g7fsq3XthGKRSdHKyPS2KEJdVgPyw=; b=Bho8+9jb0ytvY5aQ9HEg6cgq0QmMQqvZZxt2P4BvKeKlp223vCTG/A6nnokJq7lSio W8zixIVffLtsVE9ZKpvFwUYC0DVIpoJJGv90BWMqp3cq1EiA8ShgfcqzqhJ0IYR+v1uU NCMr2JEIqsFxnQuHhaoouE1vGCZeJDz4lyoEf3T5l/vNMgTD49YL5hXbvRb8eZMf4F9J k6WhcQ22NXu2I2IHeG+DOBM/oNlOU6/uxMbM3ljbWehj/+wjFH7dLvpexPCFzoHU+ Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ANoB5plBXBAd1w4CU6/dGT5nViURcTgZrIvtFFOncfXhK3TpkDTrhO8A 2qO1FXkkgR2cLSt0X1V8KBc= X-Google-Smtp-Source: AA0mqf5BDAz/Sfa83UPrhyZB8/oOMum9SVIl83RtmFWv+ZlzF6cVVJrdRlqMHi6J3qIZOW898jZ/fQ== X-Received: by 2002:ac2:5f4c:0:b0:4b5:810f:4be0 with SMTP id 12-20020ac25f4c000000b004b5810f4be0mr1557728lfz.513.1670320809343; Tue, 06 Dec 2022 02:00:09 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a2e:b049:0:b0:26f:b780:6802 with SMTP id d9-20020a2eb049000000b0026fb7806802ls1472851ljl.0.-pod-prod-gmail; Tue, 06 Dec 2022 02:00:02 -0800 (PST) X-Received: by 2002:a05:651c:239e:b0:279:c7b9:c365 with SMTP id bk30-20020a05651c239e00b00279c7b9c365mr8403961ljb.134.1670320802480; Tue, 06 Dec 2022 02:00:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670320802; cv=none; d=google.com; s=arc-20160816; b=NcrlczGD10RaU257zZc7u0YXMQk2xYjfXoE+v8OyQD7JDsa9XUaWlDn2A8CrvNkJPp IUyZPRxl45DlTuQvB1VzP5RMtL8jL5SJvtw4M1D3u/k2m/HytPSo1GuSVof+HSHsDzD4 Grc0sMX06WMw17Ld8AlIK6Gq1JcXZngF4zknkMt1L0ENuLQLRO7Jw1PFbLNKQVlB9LR/ +4quFhOdlcCDdo5W0Ln3/x8eHKg3C9FLIt9nTGKoPa+yr+oQC3lzdKTIG/WrgesK1AI7 9rlvOSnKKV36lZ1YrvGdktJnYQVW17uwJAHsGl0VBz3HvXL+jy++GGHCArbczaKzilDb 8pyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:to :from:dkim-signature; bh=r4TnQTKuOrh/7Nqz47OkSPuoCTPNobudstJp4MZSRPk=; b=Y45SCC7XzMzAlsvwWESsaqUfs6hjDk+qNn8SCJIhkxyy9M8zuqG6QchkUMe+TEV9rq TZLqoO+uX0t5CEQLn9r/A/yndUcVyRKqsYeaKv8zug+rUAog676ouWfCqozZh1/a2Ke9 7CbGKW44F6hou+JX9k9RYIearT1h65aQKPvEiUQznQuYlL4wDMHgCZolqbo3o8mokHqf yVt1FecQ7uxCpLtjlX9UJDPTaqaMwZzqbuTjWx83RPY9c3i/lp69rZqYLFMrbcEX3z8m oBJas8udWz1Uaws2amlKxXhvidxTExQq3B5CEWxo3kzoIobRhYPp/Dx1MFQOSbti828W mszA== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@unibe.ch header.s=mgwsel1 header.b=cnj9jzEv; spf=pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.82 as permitted sender) smtp.mailfrom=denis.maier-NSENcxR/0n0@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=unibe.ch Original-Received: from mailhub-lb1.unibe.ch (mailhub-lb1.unibe.ch. [130.92.0.82]) by gmr-mx.google.com with ESMTPS id s2-20020a056512214200b004b5767257ecsi275489lfr.8.2022.12.06.02.00.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 02:00:02 -0800 (PST) Received-SPF: pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.82 as permitted sender) client-ip=130.92.0.82; X-Virus-Scanned: By University of Bern - MGW Original-Received: from mail.campus.unibe.ch (aai-edge-03.campus.unibe.ch [130.92.13.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailhub-lb1.unibe.ch (Postfix) with ESMTPS id 8B803500127 for ; Tue, 6 Dec 2022 11:00:00 +0100 (CET) Original-Received: from aai-mail-04.campus.unibe.ch (130.92.13.169) by AAI-EDGE-03.campus.unibe.ch (130.92.13.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256) id 15.1.2507.16; Tue, 6 Dec 2022 10:59:53 +0100 Original-Received: from aai-mail-03.campus.unibe.ch (130.92.13.41) by aai-mail-04.campus.unibe.ch (130.92.13.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P256) id 15.1.2507.16; Tue, 6 Dec 2022 11:00:00 +0100 Original-Received: from aai-mail-03.campus.unibe.ch ([172.18.73.17]) by aai-mail-03.campus.unibe.ch ([172.18.73.17]) with mapi id 15.01.2507.016; Tue, 6 Dec 2022 11:00:00 +0100 Thread-Topic: How do I replace a string in all text that pandoc converts, i.e. how do I do this with a filter? Thread-Index: AQHZCNHjf/ZLvnEKSku8rNPhS+hfuK5fg9cAgABjBzD///KPAIAAEQug///2x4CAABQqJv//8RSAAAAIb4AAAF/3gAAW7vkg In-Reply-To: <6d25bb08-224d-4f01-8eba-3f1c55d19e83n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Accept-Language: de-CH, en-US Content-Language: de-DE x-originating-ip: [130.92.13.161] X-Original-Sender: denis.maier-NSENcxR/0n0@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@unibe.ch header.s=mgwsel1 header.b=cnj9jzEv; spf=pass (google.com: domain of denis.maier-NSENcxR/0n0@public.gmane.org designates 130.92.0.82 as permitted sender) smtp.mailfrom=denis.maier-NSENcxR/0n0@public.gmane.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=unibe.ch 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:31853 Archived-At: --_000_3db81523c80944f3a81a18f25166124funibech_ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sorry, I haven=E2=80=99t been following from the beginning. Can you provide= a complete example. What=E2=80=99s your input ? What=E2=80=99s the desired= output ? Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Im A= uftrag von paulschillinger93-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Gesendet: Dienstag, 6. Dezember 2022 01:03 An: pandoc-discuss Betreff: Re: How do I replace a string in all text that pandoc converts, i.= e. how do I do this with a filter? I've narrowed it down! The issue isn't the characters but that they're tech= nically "part" of the word. How do I replace PART of a word? Thanks! On Tuesday, December 6, 2022 at 12:52:05 a.m. UTC+1 - wrote: Barring that, can't I use something like "> =3D string.gsub("Hello banana",= "banana", "Lua user")", if so how would I do that? I got that example from= http://lua-users.org/wiki/StringLibraryTutorial On Tuesday, December 6, 2022 at 12:51:09 a.m. UTC+1 - wrote: I just tried that, thanks! That works :) But this doesn't appear to work fo= r characters, like "=3D=3D" which was the original goal. Am I missing some = sort of escape characters? On Tuesday, December 6, 2022 at 12:49:46 a.m. UTC+1 denis...-NSENcxR/0n0@public.gmane.org wrote: You are matching against the whole paragraph (para). So, when the first ele= ment in your paragraph matches your search string, you'll replace the whole= paragraph with the return value of your function. (Which is a block elemen= t, not an inline element.) Use the example from here instead: https://pandoc.org/lua-filters.html#macro-substitution ________________________________________ Von: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > im Auftrag von = paulschi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > Gesendet: Dienstag, 6. Dezember 2022 00:32:23 An: pandoc-discuss Betreff: Re: How do I replace a string in all text that pandoc converts, i.= e. how do I do this with a filter? YES! that works! But can you tell me why it replaces the whole line? Can't = I do this in running text? Thanks! return { { Para =3D function (elem) if elem.content[1].text =3D=3D "{{helloworld}}" then return pandoc.RawBlock('latex','abc') else return elem end end, } } On Tuesday, December 6, 2022 at 12:09:13 a.m. UTC+1 denis...-NSENcxR/0n0@public.gmane.org wrote: Just your example filter: ```lua return { { Para =3D function (elem) if elem.content[1].text =3D=3D "{{helloworld}}" then return pandoc.RawBlock('html','
abc
') else return elem end end, } } ``` The problematic line is this: return pandoc.RawBlock('html','
abc
= ') This adds a raw block that will only come in to effect when your output for= mat is html. If your target ist latex, you=E2=80=99ll need something like this: return p= andoc.RawBlock('latex','\\whatever{abc}') ```cmd pandoc test.md -L filter.lua -t latex asf \whatever{abc} asf ``` Von: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Im Auftrag von = paulschi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Gesendet: Dienstag, 6. Dezember 2022 00:04 An: pandoc-discuss > Betreff: Re: How do I replace a string in all text that pandoc converts, i.= e. how do I do this with a filter? No, my intended output is a PDF file. Does that change anything? Could you = tell me what exactly you put in filter.lua? Thanks! On Monday, December 5, 2022 at 11:56:39 p.m. UTC+1 denis...-NSENcxR/0n0@public.gmane.org wrote: What exactly are you doing? Your output format is html? I=E2=80=99ve just t= ested this and it seems to work. ```cmd C:\Users\denis\Downloads\filter>cat test.md asf {{helloworld}} asf C:\Users\denis\Downloads\filter>pandoc test.md

asf

{{helloworld}}

asf

C:\Users\denis\Downloads\filter>pandoc test.md -L filter.lua

asf

abc

asf

``` Von: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Im Auftrag von = paulschi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Gesendet: Montag, 5. Dezember 2022 18:58 An: pandoc-discuss > Betreff: Re: How do I replace a string in all text that pandoc converts, i.= e. how do I do this with a filter? I've tried this: return { { Para =3D function (elem) if elem.content[1].text =3D=3D "{{helloworld}}" then return pandoc.RawBlock('html','
abc
') else return elem end end, } } but that only gets rid of {{helloworld}}, it doesn't replace it with anythi= ng. Sadly this doens't work for "=3D=3D", i.e. those don't disappear. On Monday, December 5, 2022 at 6:49:08 p.m. UTC+1 - wrote: I've been trying to replace markdown/Obsidian highlights "=3D=3D" either wi= th something that LaTeX can use e.g. \hl or just delete it/replace it with = nothing, but I can't figure out how to do this. I've tried this: function Str (str) str.text =3D string.upper(str.text) return str end But I can't even figure out where I'm meant to put my own text? How do I rpelace =3D=3D with " "? 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/3ae58adb-8789-4398-8ab0-fe1e6928e292n%40googlegroups.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 e= mail to pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/e9cb34ca-b760-4ef6-9432-91d37f5e45c5n%40googlegroups.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 e= mail to pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>. To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/7cabb17e-9a2b-4251-bd95-c5415140c9adn%40googlegroups.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 e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org. To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/6d25bb08-224d-4f01-8eba-3f1c55d19e83n%40googlegroups.com. --=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/3db81523c80944f3a81a18f25166124f%40unibe.ch. --_000_3db81523c80944f3a81a18f25166124funibech_ Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Sorry, I = haven=E2=80=99t been following from the beginning. Can you pr= ovide a complete example. What=E2=80=99s your input ? What=E2=80=99s t= he desired output ?

 

Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von paulschillinger93-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Gesendet: Dienstag, 6. Dezember 2022 01:03
An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Betreff: Re: How do I replace a string in all text that pandoc conve= rts, i.e. how do I do this with a filter?

 

I've narrowed it down! The issue isn't the character= s but that they're technically "part" of the word. How do I repla= ce PART of a word?

Thanks!

 

On Tuesday, December 6, 2022 at 12:52:05 a.m. UTC= 3;1 - wrote:

Barring that, can't I= use something like "> =3D string.gsub("Hello banana", &q= uot;banana", "Lua user")", if so how would I do that? I= got that example from http://lua-users.org/wiki/StringLibraryTutorial

On Tuesday, December 6, 2022 at 12:51:09 a.m. UTC= 3;1 - wrote:

I just tried that, th= anks! That works :) But this doesn't appear to work for characters, like &q= uot;=3D=3D" which was the original goal. Am I missing some sort of esc= ape characters?

On Tuesday, December 6, 2022 at 12:49:46 a.m. UTC= 3;1 denis...-NSENcxR/0n0@public.gmane.org wrote:

You are matching against the whole paragraph (para).= So, when the first element in your paragraph matches your search string, y= ou'll replace the whole paragraph with the return value of your function. (= Which is a block element, not an inline element.)

Use the example from here instead:
https://pandoc.org/lua-filters.html#macro-substitution
________________________________________
Von: pandoc-...@googlegroups= .com <pandoc-...@goog= legroups.com> im Auftrag von paulschi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <paulschi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Gesendet: Dienstag, 6. Dezember 2022 00:32:23
An: pandoc-discuss
Betreff: Re: How do I replace a string in all text that pandoc converts, i.= e. how do I do this with a filter?

YES! that works! But can you tell me why it replaces the whole line? Can't = I do this in running text?
Thanks!
return {
{
Para =3D function (elem)
if elem.content[1].text =3D=3D "{{helloworld}}" then
return pandoc.RawBlock('latex','abc')
else
return elem
end
end,
}
}




On Tuesday, December 6, 2022 at 12:09:13 a.m. UTC+1 denis...-NSENcxR/0n0@public.gmane.org wrote:
Just your example filter:

```lua
return {
{
Para =3D function (elem)
if elem.content[1].text =3D=3D "{{helloworld}}" then
return pandoc.RawBlock('html','<div>abc</div>')
else
return elem
end
end,
}
}
```

The problematic line is this: return pandoc.RawBlock('html','<div>abc= </div>')
This adds a raw block that will only come in to effect when your output for= mat is html.

If your target ist latex, you=E2=80=99ll need something like this: return p= andoc.RawBlock('latex','\\whatever{abc}')

```cmd
pandoc test.md -L filter.lua -t latex
asf

\whatever{abc}

asf
```


Von: pandoc-...@googlegroups= .com <pandoc-...@goog= legroups.com> Im Auftrag von paulschi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Gesendet: Dienstag, 6. Dezember 2022 00:04
An: pandoc-discuss <pando= c-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Betreff: Re: How do I replace a string in all text that pandoc converts, i.= e. how do I do this with a filter?

No, my intended output is a PDF file. Does that change anything? Could you = tell me what exactly you put in filter.lua?
Thanks!

On Monday, December 5, 2022 at 11:56:39 p.m. UTC+1 denis...-NSENcxR/0n0@public.gmane.org wrote:
What exactly are you doing? Your output format is html? I=E2=80=99ve just t= ested this and it seems to work.

```cmd
C:\Users\denis\Downloads\filter>cat test.md
asf

{{helloworld}}

asf
C:\Users\denis\Downloads\filter>pandoc test.md
<p>asf</p>
<p>{{helloworld}}</p>
<p>asf</p>

C:\Users\denis\Downloads\filter>pandoc test.md -L filter.lua
<p>asf</p>
<div>abc</div>
<p>asf</p>
```
Von: pandoc-...@googlegroups= .com <pandoc-...@goog= legroups.com> Im Auftrag von paulschi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Gesendet: Montag, 5. Dezember 2022 18:58
An: pandoc-discuss <pando= c-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Betreff: Re: How do I replace a string in all text that pandoc converts, i.= e. how do I do this with a filter?

I've tried this:

return {
{
Para =3D function (elem)
if elem.content[1].text =3D=3D "{{helloworld}}" then
return pandoc.RawBlock('html','<div>abc</div>')
else
return elem
end
end,
}
}

but that only gets rid of {{helloworld}}, it doesn't replace it with anythi= ng. Sadly this doens't work for "=3D=3D", i.e. those don't disapp= ear.
On Monday, December 5, 2022 at 6:49:08 p.m. UTC+1 - wrote:
I've been trying to replace markdown/Obsidian highlights "=3D=3D"= either with something that LaTeX can use e.g. \hl or just delete it/replac= e it with nothing, but I can't figure out how to do this.

I've tried this:
function Str (str)
str.text =3D string.upper(str.text)
return str
end

But I can't even figure out where I'm meant to put my own text?

How do I rpelace =3D=3D with " "?

Thanks!
--
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 pandoc-discus...@googl= egroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/3ae58adb-8789-4398-8ab0-fe= 1e6928e292n%40googlegroups.com<https://= groups.google.com/d/msgid/pandoc-discuss/3ae58adb-8789-4398-8ab0-fe1e6928e2= 92n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter>.
--
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 pandoc-discus...@googl= egroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e9cb34ca-b760-4ef6-9432-91= d37f5e45c5n%40googlegroups.com<https://= groups.google.com/d/msgid/pandoc-discuss/e9cb34ca-b760-4ef6-9432-91d37f5e45= c5n%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter>.

--
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 pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<mailto:pandoc-discus...@googlegroups.c= om>.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7cabb17e-9a2b-4251-bd95-c5= 415140c9adn%40googlegroups.com<https://= groups.google.com/d/msgid/pandoc-discuss/7cabb17e-9a2b-4251-bd95-c5415140c9= adn%40googlegroups.com?utm_medium=3Demail&utm_source=3Dfooter>.

--
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 pandoc-d= iscuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6d25bb08-224d-4f01-8eba-3f= 1c55d19e83n%40googlegroups.com.

--
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/3db81523c80944f3a81a18f25166124f%40unibe.ch.
--_000_3db81523c80944f3a81a18f25166124funibech_--