From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31846 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: Mon, 5 Dec 2022 23:09:07 +0000 Message-ID: <2faac96e448d4303b3ea0e12ef05dfbe@unibe.ch> References: <83eeff5c-8fc3-4ca3-862c-bb85790daabcn@googlegroups.com> <3ae58adb-8789-4398-8ab0-fe1e6928e292n@googlegroups.com> <24509d5ca5844dbda07b3e77d86ab3f4@unibe.ch> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_2faac96e448d4303b3ea0e12ef05dfbeunibech_" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7569"; mail-complaints-to="usenet@ciao.gmane.io" To: Original-X-From: pandoc-discuss+bncBCZ27W53TUFBBFXUXGOAMGQEY5KG4PA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Dec 06 00:09:14 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ej1-f64.google.com ([209.85.218.64]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p2KaI-0001kb-7a for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 06 Dec 2022 00:09:14 +0100 Original-Received: by mail-ej1-f64.google.com with SMTP id qf25-20020a1709077f1900b0078c02a23da3sf472810ejc.0 for ; Mon, 05 Dec 2022 15:09:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670281753; cv=pass; d=google.com; s=arc-20160816; b=PeZju4KjrbjOWlVqiUiX6knL+yTE75GHZdjaoRoKwHSDg6hzvSJShOGq9JpIlxn4ZJ iOSqVuKqITKj+VzZBOB3Nqf17cMz1j42V/bBUizNV/vmnvUQBsf3rsXdupcGF0lBhQ3H La+DrpBPF7Ril/k7jzZqJZHQ2PqPK5C9tA9Z7My8GzQCIqbpPlsnAF7YsAp1aLs0xMu7 BmfokYVGdj5OOqo4WqvlYPtxZCraJ/0QCmkOpRoeraQgn3NBTqqmI/zeuKyWx2sC/2/U WyIbBQNTdnUnGPKw70HtQKAM+1jdOJ4U4Mjjj/vRWA6zWGLWB1PM4anh5HlTXGZCnEyQ WxkA== 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=kEesS23kjKKtwy84iokIheIYv4n5omE0KJOgg2FrAQQ=; b=PeysrsmHp83hM771M5zy1f2pEJ5h2k1Nkx1Qc34IMZAXdKuB8oUJgW+y3mkWMQBWkL jjRcQMe3V7IbAtsN/KC8Q0khVQZ/H7LuT5ny5E/5riQllvVQa2TBTGnTAbQC3Oyw7Zx2 2heoIXliOtTK6G1ewuFImcEEz73lXUg8ep5PyqUSmuMvsJkuJXEySWpnFf+eGB5xI+EN 1aubTVzc2lMwYC1ErT9b7yayaQ1N+ialAIbA65V4O4dmmIcfxF4HWMjy67oVofEPs2OR /CQ0zTNOLGVtgL5y8GIfepGo7LQtqlFjoh6gWFqIlHqzfB/7Oly4IRGGxFmvhLWn8l9g lKfg== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@unibe.ch header.s=mgwsel1 header.b=cm9xU1Af; 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=kEesS23kjKKtwy84iokIheIYv4n5omE0KJOgg2FrAQQ=; b=oKjenhadGwGku0Gup4VM82bT3yZhzZ7RmdBAo2o8ALD0vmjOgqgcGiWmwkIiW9thw6 0nYqbke3vwhX6M2nOVQASbrvTZE6UJAoJB+AG3kLnpvTzaybPn87mWAhKHJBKPk7hKqy bgVZA0yG+a7SjHUI+QlUgJ6my2xemioc+VaZPQDcpi89TQUy6cqH15kH2+yCv9PQVrZ3 QHfEMgl7xHMf+HUo7+A8cLEjZFgfA6xtPJd23f6ZGqyc+OyQv84peFhJblrpZi43iS0r 9/iJl52KTTl47TStjI5Uha+zONpTOuE8 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=kEesS23kjKKtwy84iokIheIYv4n5omE0KJOgg2FrAQQ=; b=r5OVNo352U9jKXNupk9E4DBVEWKqog7qLEJZbeS3raPxwpY3TO9SzvGKuTWU17dr8t gQ/jYDRKRyXFPGwI2nUQOM0WtmJe3Mr7R6/k3UW19PF8p0mCbId7Wb9dldNhWDX2hQ/H sZ9OrmQuPFwH2rQnHegBA9zf/ylgDPtpxqYOK1wa10MnNOQ8Q5OKF2ruW/3NB5aj/CU5 HOTRgx06F+EUJXzF/1PChdpLG9u21SWPuTpgXA+PJsqxr+hvEEYqPsbaa2ThuMi3C Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ANoB5pm6mPxAc73PwSxQBu88JusoyiOZOU9tyHXqz1kNj+Dmdg4Uhc5b zjc3ig353UJVN/zgmU6SHF0= X-Google-Smtp-Source: AA0mqf47o6wMW41A+Yt7cV+3GRCGoAbbgwGkQCKKlVnYvEPaGKTY23axcOpjY/4mGDLVifRtsolehQ== X-Received: by 2002:a17:906:8547:b0:7b4:ae8f:c61 with SMTP id h7-20020a170906854700b007b4ae8f0c61mr62469099ejy.403.1670281753725; Mon, 05 Dec 2022 15:09:13 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a17:906:710e:b0:78d:e7b8:d105 with SMTP id x14-20020a170906710e00b0078de7b8d105ls3212262ejj.8.-pod-prod-gmail; Mon, 05 Dec 2022 15:09:09 -0800 (PST) X-Received: by 2002:a17:906:f0cc:b0:7c0:f4f5:3268 with SMTP id dk12-20020a170906f0cc00b007c0f4f53268mr5603640ejb.483.1670281749240; Mon, 05 Dec 2022 15:09:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670281749; cv=none; d=google.com; s=arc-20160816; b=aRv3+f5Mfz41CuGjq0xLTuFbk2l7nURXZT6JYXABneFKwmcC8md+YxXl/0qaod4jJR sJAtZpFamR537+MoRC6uSnOMVp7QzfuPqbmKmKt7xnRD6c6l+PTXmIgsZCuxh2Rc80bS 9/DQn37U7nlKUP11Q5TBLWL4TP+st0zXEfSr5IsoDiILRBQpzZSPGlpZs/VQDV7LhHSm 004z4CtK/NPdc85qGGaxRzQasCULubtfQ1mdA4ZYqoTBV9zxF4BIZDzgyTuvmJ0mudj2 4yZo5JyxKSk7e3PDFsfsVx38q18WEr+1fUyaynqkKt4xNxpMneOrTRsvrqeFwqpA3k/C gpdw== 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=lSaqTIl/M5x645UmBbQ3eHefj+o1ke+YO+XCC+fEDhc=; b=bYh6sKgNd5y0hPQnSLR2p9AmYa1bMzZBOpYITlqdo/M3h/QQA0FX+iDf7/4cxIu7yM olF7R7udaAp68JrbZIcmNW+vPZxQQ7vAxYCslnvHVwdNup65Ekk6YJkHy5PG7AKOgtO5 CT/rEX22s7Bt0tMZkted8C83idQd9/mt1dlG4SqoSB+PeYD/O4vf5SnL3kaJfYxc4YnY k6D1oajKwcQFz36u/dlDir02qNJvSNaazqcAlFIgNzkhRhevKqqnXJOzWym2cKfhCf1A NiWseKc/FY269Em4jiMGwvpQ2iczeHB0FXQ30ymqRORNJJhEmxsWpjGN4EDp4eYp2kZd rSEw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@unibe.ch header.s=mgwsel1 header.b=cm9xU1Af; 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 y5-20020a50e605000000b0045a1a4ee8d3si39340edm.0.2022.12.05.15.09.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 15:09:09 -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 CBC80500085 for ; Tue, 6 Dec 2022 00:09:07 +0100 (CET) Original-Received: from aai-mail-03.campus.unibe.ch (130.92.13.41) 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 00:09:05 +0100 Original-Received: from aai-mail-03.campus.unibe.ch (130.92.13.41) by aai-mail-03.campus.unibe.ch (130.92.13.41) 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 00:09:07 +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 00:09:07 +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 In-Reply-To: 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=cm9xU1Af; 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:31846 Archived-At: --_000_2faac96e448d4303b3ea0e12ef05dfbeunibech_ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Im A= uftrag von paulschillinger93-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 v= on 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...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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-discuss+unsubscribe-/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. --=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/2faac96e448d4303b3ea0e12ef05dfbe%40unibe.ch. --_000_2faac96e448d4303b3ea0e12ef05dfbeunibech_ Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Just your= example filter:

&nbs= p;

```lua

return {
  {
    Para =3D function (elem)
      if elem.content[1].text =3D=3D "{{helloworld}}&qu= ot; then
        return pandoc.RawBlock('html','<div>abc&l= t;/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 effe= ct when your output format is html.

 

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

 

```cmd

pandoc test.md -L filter.lua -t= latex

asf

 

\whatever{abc}

 

asf

```

&nbs= p;

&nbs= p;

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 00:04
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?

 

No, my intended output is a PDF file. Does that chan= ge 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 forma= t is html? I=E2=80=99ve just tested 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von paulschi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Gesendet: Montag, 5. Dezember 2022 18:58
An: pandoc-discuss <pandoc-...@googl= egroups.com>
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 tried this:

 

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

 

but that only gets rid of {{helloworld}}, it doesn't replace it wi= th anything. 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 with 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 &= 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/3ae58adb-8789-4398-8ab0-fe= 1e6928e292n%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 pandoc-d= iscuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e9cb34ca-b760-4ef6-9432-91= d37f5e45c5n%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/2faac96e448d4303b3ea0e12ef05dfbe%40unibe.ch.
--_000_2faac96e448d4303b3ea0e12ef05dfbeunibech_--