public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Why this lua filter function does not work?
@ 2020-10-28  9:36 jiewuza
       [not found] ` <m21rhizo8c.fsf-9Onoh4P/yGk@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: jiewuza @ 2020-10-28  9:36 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Suppose I have a table as the first child in a div.

And here is the function which returns the table, to replace the
original div.

```
function handleDiv(el)
   local table = el.content[1]
   print(table.t, TableToStr(table))
   return table
end
```

Unfortunately, there is no table in the output. No error either.


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

* Re: Why this lua filter function does not work?
       [not found] ` <m21rhizo8c.fsf-9Onoh4P/yGk@public.gmane.org>
@ 2020-10-28 17:19   ` John MacFarlane
  2020-10-29  5:54     ` jiewuza
  2020-10-29  7:46     ` jiewuza
  0 siblings, 2 replies; 7+ messages in thread
From: John MacFarlane @ 2020-10-28 17:19 UTC (permalink / raw)
  To: jiewuza, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Try with

function Div(el)

jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:

> Suppose I have a table as the first child in a div.
>
> And here is the function which returns the table, to replace the
> original div.
>
> ```
> function handleDiv(el)
>    local table = el.content[1]
>    print(table.t, TableToStr(table))
>    return table
> end
> ```
>
> Unfortunately, there is no table in the output. No error either.
>
> -- 
> 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/m21rhizo8c.fsf%40163.com.


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

* Re: Why this lua filter function does not work?
  2020-10-28 17:19   ` John MacFarlane
@ 2020-10-29  5:54     ` jiewuza
  2020-10-29  7:46     ` jiewuza
  1 sibling, 0 replies; 7+ messages in thread
From: jiewuza @ 2020-10-29  5:54 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Yes, I have `return {{Div = handleDiv}}` at the end of the filter.

I have `print` in the function. So I am sure it was called.


John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:

> Try with
>
> function Div(el)
>
> jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>
>> Suppose I have a table as the first child in a div.
>>
>> And here is the function which returns the table, to replace the
>> original div.
>>
>> ```
>> function handleDiv(el)
>>    local table = el.content[1]
>>    print(table.t, TableToStr(table))
>>    return table
>> end
>> ```
>>
>> Unfortunately, there is no table in the output. No error either.
>>
>> -- 
>> 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/m21rhizo8c.fsf%40163.com.


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

* Re: Why this lua filter function does not work?
  2020-10-28 17:19   ` John MacFarlane
  2020-10-29  5:54     ` jiewuza
@ 2020-10-29  7:46     ` jiewuza
       [not found]       ` <m2k0v9xyn2.fsf-9Onoh4P/yGk@public.gmane.org>
  1 sibling, 1 reply; 7+ messages in thread
From: jiewuza @ 2020-10-29  7:46 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Yes, I have `return {{Div = handleDiv}}` at the end of the filter.

I have `print` in the function. So I am sure it was called.


John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:

> Try with
>
> function Div(el)
>
> jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>
>> Suppose I have a table as the first child in a div.
>>
>> And here is the function which returns the table, to replace the
>> original div.
>>
>> ```
>> function handleDiv(el)
>>    local table = el.content[1]
>>    print(table.t, TableToStr(table))
>>    return table
>> end
>> ```
>>
>> Unfortunately, there is no table in the output. No error either.
>>
>> -- 
>> 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/m21rhizo8c.fsf%40163.com.


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

* Re: Why this lua filter function does not work?
       [not found]       ` <m2k0v9xyn2.fsf-9Onoh4P/yGk@public.gmane.org>
@ 2020-10-30 16:54         ` John MacFarlane
       [not found]           ` <m2tuubpscz.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: John MacFarlane @ 2020-10-30 16:54 UTC (permalink / raw)
  To: jiewuza, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Hm.  It ought to work, as far as I can see.  Maybe Albert
Krewinkel can shed some light on this?

jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:

> Yes, I have `return {{Div = handleDiv}}` at the end of the filter.
>
> I have `print` in the function. So I am sure it was called.
>
>
> John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> writes:
>
>> Try with
>>
>> function Div(el)
>>
>> jiewuza <jiewuza-9Onoh4P/yGk@public.gmane.org> writes:
>>
>>> Suppose I have a table as the first child in a div.
>>>
>>> And here is the function which returns the table, to replace the
>>> original div.
>>>
>>> ```
>>> function handleDiv(el)
>>>    local table = el.content[1]
>>>    print(table.t, TableToStr(table))
>>>    return table
>>> end
>>> ```
>>>
>>> Unfortunately, there is no table in the output. No error either.
>>>
>>> -- 
>>> 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/m21rhizo8c.fsf%40163.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/m2k0v9xyn2.fsf%40163.com.


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

* Re: Why this lua filter function does not work?
       [not found]           ` <m2tuubpscz.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
@ 2020-10-30 17:19             ` Albert Krewinkel
  2020-10-31  1:27               ` jiewuza
  0 siblings, 1 reply; 7+ messages in thread
From: Albert Krewinkel @ 2020-10-30 17:19 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


John MacFarlane writes:

> Hm.  It ought to work, as far as I can see.  Maybe Albert
> Krewinkel can shed some light on this?

Sorry, I cannot spot any obvious problems either.

Could you upload the filter together with a short sample input for
us to reproduce the issue?

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


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

* Re: Why this lua filter function does not work?
  2020-10-30 17:19             ` Albert Krewinkel
@ 2020-10-31  1:27               ` jiewuza
  0 siblings, 0 replies; 7+ messages in thread
From: jiewuza @ 2020-10-31  1:27 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Ooops, I find the problem. It is my fault.

In my real case, there are many function calls. One of them returns empty
list.


p.s. Sorry for the repeated replies for my last two posts.
I don't know why gmane took so long to get them posted. I thought I
might fail to post them, so I tried to post again and again...

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

> John MacFarlane writes:
>
>> Hm.  It ought to work, as far as I can see.  Maybe Albert
>> Krewinkel can shed some light on this?
>
> Sorry, I cannot spot any obvious problems either.
>
> Could you upload the filter together with a short sample input for
> us to reproduce the issue?
>
> --
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


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

end of thread, other threads:[~2020-10-31  1:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28  9:36 Why this lua filter function does not work? jiewuza
     [not found] ` <m21rhizo8c.fsf-9Onoh4P/yGk@public.gmane.org>
2020-10-28 17:19   ` John MacFarlane
2020-10-29  5:54     ` jiewuza
2020-10-29  7:46     ` jiewuza
     [not found]       ` <m2k0v9xyn2.fsf-9Onoh4P/yGk@public.gmane.org>
2020-10-30 16:54         ` John MacFarlane
     [not found]           ` <m2tuubpscz.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-10-30 17:19             ` Albert Krewinkel
2020-10-31  1:27               ` jiewuza

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