public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Lua filter broken after upgrade to 2.15 (macOS)
@ 2021-10-31 13:18 Philipp
       [not found] ` <7c1cf170-c5cb-4203-a4ba-36407f0ebfecn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Philipp @ 2021-10-31 13:18 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1525 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 2689 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lua filter broken after upgrade to 2.15 (macOS)
       [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-11-01 11:25   ` Albert Krewinkel
  1 sibling, 1 reply; 10+ messages in thread
From: Albert Krewinkel @ 2021-10-31 15:11 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

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.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lua filter broken after upgrade to 2.15 (macOS)
       [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>
  0 siblings, 1 reply; 10+ messages in thread
From: John MacFarlane @ 2021-10-31 17:42 UTC (permalink / raw)
  To: Albert Krewinkel, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


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.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lua filter broken after upgrade to 2.15 (macOS)
       [not found]         ` <m2h7cxks4v.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
@ 2021-10-31 17:43           ` John MacFarlane
       [not found]             ` <m2ee81ks3h.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: John MacFarlane @ 2021-10-31 17:43 UTC (permalink / raw)
  To: Albert Krewinkel, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


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.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lua filter broken after upgrade to 2.15 (macOS)
       [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>
  0 siblings, 1 reply; 10+ messages in thread
From: Albert Krewinkel @ 2021-10-31 18:22 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

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.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lua filter broken after upgrade to 2.15 (macOS)
       [not found]                 ` <7BA44317-17A2-450D-90FD-97F61FCC6129-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2021-10-31 19:04                   ` Albert Krewinkel
       [not found]                     ` <020C1DFA-141A-4AF6-83FD-87D400A65090-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Albert Krewinkel @ 2021-10-31 19:04 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

[-- 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 --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lua filter broken after upgrade to 2.15 (macOS)
       [not found]                     ` <020C1DFA-141A-4AF6-83FD-87D400A65090-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2021-10-31 20:12                       ` John MacFarlane
  0 siblings, 0 replies; 10+ messages in thread
From: John MacFarlane @ 2021-10-31 20:12 UTC (permalink / raw)
  To: Albert Krewinkel, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Fair enough!

Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> writes:

> 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.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lua filter broken after upgrade to 2.15 (macOS)
       [not found] ` <7c1cf170-c5cb-4203-a4ba-36407f0ebfecn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2021-10-31 15:11   ` Albert Krewinkel
@ 2021-11-01 11:25   ` Albert Krewinkel
       [not found]     ` <87fssg6rsp.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Albert Krewinkel @ 2021-11-01 11:25 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Sorry, I forgot to answer the original question: You can fix the filter
by changing `return pandoc.Str()` to `return {}`.

HTH


Philipp <philipp.kupferschmied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> 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


--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lua filter broken after upgrade to 2.15 (macOS)
       [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>
  0 siblings, 1 reply; 10+ messages in thread
From: Philipp @ 2021-11-01 15:26 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2157 bytes --]

Thanks a lot for your help, my filter is working again :-)
As both `return pandoc.Str('")` and `return {}`solve the problem, I wonder 
if one of the two solutions is preferable over the other.


Albert Krewinkel schrieb am Montag, 1. November 2021 um 12:26:08 UTC+1:

> Sorry, I forgot to answer the original question: You can fix the filter
> by changing `return pandoc.Str()` to `return {}`.
>
> HTH
>
>
> Philipp <philipp.ku...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > 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
>
>
> --
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
>

-- 
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/0e68ba01-4ebe-47c1-a7fd-3049b41b2785n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 3118 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Lua filter broken after upgrade to 2.15 (macOS)
       [not found]         ` <0e68ba01-4ebe-47c1-a7fd-3049b41b2785n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-11-02  7:41           ` Albert Krewinkel
  0 siblings, 0 replies; 10+ messages in thread
From: Albert Krewinkel @ 2021-11-02  7:41 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Philipp <philipp.kupferschmied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Thanks a lot for your help, my filter is working again :-)

Glad to hear :)

> As both `return pandoc.Str('")` and `return {}`solve the problem, I wonder
> if one of the two solutions is preferable over the other.

The first replaces the Str with an empty element, while the second
version removes the element completely. I'd personally prefer the second
version (`return {}`), but it doesn't really matter much.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-11-02  7:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-31 13:18 Lua filter broken after upgrade to 2.15 (macOS) 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
     [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

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).