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 = function (elem)
if elem.content[1].text == "{{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 = function (elem)
> if elem.content[1].text == "{{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
> format is html.
>
>
>
> If your target ist latex, you’ll need something like this: return
> pandoc.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’ve 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
>
> 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 = function (elem)
> if elem.content[1].text == "{{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
> anything. Sadly this doens't work for "==", 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 "==" 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 = 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 == 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
> email 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
> email 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/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 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/7cabb17e-9a2b-4251-bd95-c5415140c9adn%40googlegroups.com.