public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Lua filter broken after upgrade to 2.15 (macOS)
Date: Sun, 31 Oct 2021 20:04:19 +0100	[thread overview]
Message-ID: <020C1DFA-141A-4AF6-83FD-87D400A65090@zeitkraut.de> (raw)
In-Reply-To: <7BA44317-17A2-450D-90FD-97F61FCC6129-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 4705 bytes --]

I see now how this worked: if there is no string passed into pandoc.Str, then the resulting Lua object looks like an empty list to the unmarshalling function. The processed element is therefore sliced out of the document.

This was never intended to work and could be considered a pandoc bug, so I'm hesitant to recreate the old behavior.


Am 31. Oktober 2021 19:22:37 MEZ schrieb Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>:
>That seems reasonable. Although, tbh, I'm surprised that this ever worked at all. Looking at the old code it seems like it shouldn't.
>
>I'll take a look.
>
>Am 31. Oktober 2021 18:43:30 MEZ schrieb John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>:
>>
>>Perhaps for backwards compatibility we should fix things
>>so that Str with no argument is treated as an empty string?
>>
>>John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>>
>>> I can confirm that using pandoc.Str('') instead of pandoc.Str()
>>> works.
>>>
>>>
>>> Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> writes:
>>>
>>>> Can't test right now, but can you try to pass an empty string to pandoc.Str('')?
>>>>
>>>> Am 31. Oktober 2021 14:18:16 MEZ schrieb Philipp <philipp.kupferschmied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>>>>>Hello everyone,
>>>>>
>>>>>I'm experiencing a problem with a self-written Lua-filter after upgrading 
>>>>>to 2.15.
>>>>>
>>>>>The filter ran (and still runs) fine with older versions of pandoc, but 
>>>>>with 2.15 I get the following error:
>>>>>
>>>>>PandocLuaError "Error during function call:\n\tstring expected, got 
>>>>>string\n\twhile retrieving function argument string\n\twhile retrieving 
>>>>>arguments for function Str\nstack traceback:\n\t[C]: in field 
>>>>>'Str'\n\tscripts/klausur.lua:11: in function 
>>>>><scripts/klausur.lua:9>\n\t[C]: in ?\n\t[C]: in field 
>>>>>'walk_block'\n\tscripts/klausur.lua:8: in function 'processheader'"
>>>>>
>>>>>stack traceback:
>>>>>
>>>>>[C]: in field 'walk_block'
>>>>>
>>>>>scripts/klausur.lua:8: in function 'processheader'
>>>>>The corresponding Lua code looks like this (I hope the formatting is 
>>>>>preserved):
>>>>>
>>>>> 7 function processheader(elem)
>>>>> 8     return pandoc.walk_block(elem, {
>>>>> 9         Str = function(elem)
>>>>>10             if string.match(elem.text, "%%%d+p%%") ~= nil then
>>>>>11                 return pandoc.Str()
>>>>>12             end
>>>>>13         end
>>>>>14     })
>>>>>15 end
>>>>>
>>>>>I'd be thankful for any suggestion what is going wrong here.
>>>>>
>>>>>Kind regards,
>>>>>Philipp
>>>>>
>>>>>
>>>>>-- 
>>>>>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/7c1cf170-c5cb-4203-a4ba-36407f0ebfecn%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/DDB22D9A-22FC-48BB-B1D0-18B059FD92D7%40zeitkraut.de.
>>
>>-- 
>>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/m2ee81ks3h.fsf%40Johns-Air.hsd1.ca.comcast.net.
>
>-- 
>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/7BA44317-17A2-450D-90FD-97F61FCC6129%40zeitkraut.de.

-- 
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/020C1DFA-141A-4AF6-83FD-87D400A65090%40zeitkraut.de.

[-- Attachment #2: Type: text/html, Size: 5759 bytes --]

  parent reply	other threads:[~2021-10-31 19:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-31 13:18 Philipp
     [not found] ` <7c1cf170-c5cb-4203-a4ba-36407f0ebfecn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-10-31 15:11   ` Albert Krewinkel
     [not found]     ` <DDB22D9A-22FC-48BB-B1D0-18B059FD92D7-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2021-10-31 17:42       ` John MacFarlane
     [not found]         ` <m2h7cxks4v.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
2021-10-31 17:43           ` John MacFarlane
     [not found]             ` <m2ee81ks3h.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
2021-10-31 18:22               ` Albert Krewinkel
     [not found]                 ` <7BA44317-17A2-450D-90FD-97F61FCC6129-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2021-10-31 19:04                   ` Albert Krewinkel [this message]
     [not found]                     ` <020C1DFA-141A-4AF6-83FD-87D400A65090-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2021-10-31 20:12                       ` John MacFarlane
2021-11-01 11:25   ` Albert Krewinkel
     [not found]     ` <87fssg6rsp.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2021-11-01 15:26       ` Philipp
     [not found]         ` <0e68ba01-4ebe-47c1-a7fd-3049b41b2785n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-11-02  7:41           ` Albert Krewinkel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=020C1DFA-141A-4AF6-83FD-87D400A65090@zeitkraut.de \
    --to=albert+pandoc-9eawchwdxg8hfhg+jk9f0w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).