~dmbaturin/soupault

4 3

Atom plugin still working

Details
Message ID
<6a8ad6e05facccdab4513918d40ba757@raphinou.com>
DKIM signature
pass
Download raw message
Hi,

I'm using Soupault 4.10, and am trying to use the atom.lua plugin from 
the blog blueprint.
However, I get an error at 
https://github.com/PataphysicalSociety/soupault-blueprints-blog/blob/main/plugins/atom.lua#L69 
:
    data["feed_last_updated"] = entries[1]["date"]
The error reported is "the indexed value is not a table", however when I 
iterate over the table, it reports a key 1 with the expected value, 
including the "date" key. And the atom entries are generated correctly, 
it's only at that point that the entries can't seem to be accessed. Any 
idea?

Thanks in advance

Re: Atom plugin still working ?

Raphaël Bauduin <rb@raphinou.com>
Details
Message ID
<c15cc3bc-50ad-45a5-81b4-a2a9b02e4e48@raphinou.com>
In-Reply-To
<6a8ad6e05facccdab4513918d40ba757@raphinou.com> (view parent)
DKIM signature
pass
Download raw message
Sorry, I should have included some additional information:

Here's how I print out entries (I have sort_descending set to true):

function show_pair(k, v)
      Log.warning(format("Key: %s, value: %s", k, JSON.to_string(v)))
end

if soupault_config["index"]["sort_descending"] or (not 
Table.has_key(soupault_config["index"], "sort_descending")) then
      --data["feed_last_updated"] = entries[1]["date"]
      Log.warning("descending")
      Log.warning(format("number of entries:%d", size(entries)))
      Table.iter(show_pair, entries)
      --Log.warning(entries[1]["date"])
      data["feed_last_updated"] = ""
else
      data["feed_last_updated"] = ""
      --data["feed_last_updated"] = entries[size(entries)]["date"]
end

and here's the output:

[WARNING] descending
[WARNING] number of entries:1
[WARNING] Key: 1, value: 
{"page_file":"site/blog/blog-launch.md","tags":["news"],"excerpt":"...",...,"date":"2024-08-20T00:00:00+00:00"}

But the line

     Log.warning(entries[1]["page_file"])

gives the error

[ERROR] Could not process page site/blog/blog-launch.md: Lua code 
execution failed:
Runtime error: indexed expression not a table
Stack trace:
`error' fallback (OCaml)
`gettable' fallback (OCaml)
main of dostring('-- Atom feed generator

Plugin.require_version("4.0.0")

dat...') defined in file dostring('-- Atom feed generator

Plugin.require_version("4.0.0")

dat...')

Re: Atom plugin still working ?

Details
Message ID
<568505fb-3155-4c3e-9e65-461eac6e037f@baturin.org>
In-Reply-To
<c15cc3bc-50ad-45a5-81b4-a2a9b02e4e48@raphinou.com> (view parent)
DKIM signature
pass
Download raw message
Hi Raphaël,

This is odd. Would you mind uploading a tarball of the affected site 
source (or a minimal PoC of if, if preferred) so that I can try it myself?
I do have to admit the Atom plugin is not robust against all possible 
situations, which is why I'm not actively advertising it.
Perhaps this case will help improve it.

On 8/22/24 12:34 PM, Raphaël Bauduin wrote:
> Sorry, I should have included some additional information:
>
> Here's how I print out entries (I have sort_descending set to true):
>
> function show_pair(k, v)
>      Log.warning(format("Key: %s, value: %s", k, JSON.to_string(v)))
> end
>
> if soupault_config["index"]["sort_descending"] or (not 
> Table.has_key(soupault_config["index"], "sort_descending")) then
>      --data["feed_last_updated"] = entries[1]["date"]
>      Log.warning("descending")
>      Log.warning(format("number of entries:%d", size(entries)))
>      Table.iter(show_pair, entries)
>      --Log.warning(entries[1]["date"])
>      data["feed_last_updated"] = ""
> else
>      data["feed_last_updated"] = ""
>      --data["feed_last_updated"] = entries[size(entries)]["date"]
> end
>
> and here's the output:
>
> [WARNING] descending
> [WARNING] number of entries:1
> [WARNING] Key: 1, value: 
> {"page_file":"site/blog/blog-launch.md","tags":["news"],"excerpt":"...",...,"date":"2024-08-20T00:00:00+00:00"}
>
> But the line
>
>     Log.warning(entries[1]["page_file"])
>
> gives the error
>
> [ERROR] Could not process page site/blog/blog-launch.md: Lua code 
> execution failed:
> Runtime error: indexed expression not a table
> Stack trace:
> `error' fallback (OCaml)
> `gettable' fallback (OCaml)
> main of dostring('-- Atom feed generator
>
> Plugin.require_version("4.0.0")
>
> dat...') defined in file dostring('-- Atom feed generator
>
> Plugin.require_version("4.0.0")
>
> dat...')
>
>

Re: Atom plugin still working ?

Details
Message ID
<577E9698-D5B2-42C2-8B34-824F4B9264D0@posteo.net>
In-Reply-To
<568505fb-3155-4c3e-9e65-461eac6e037f@baturin.org> (view parent)
DKIM signature
pass
Download raw message
Not sure if it helps, but here is my atom fork <https://codeberg.org/toastal/toastal-website/src/branch/trunk/plugins/atom.lua>
-- 
toastal ไข่ดาว | https://toast.al
PGP: 7944 74b7 d236 dab9 c9ef  e7f9 5cce 6f14 66d4 7c9e

Re: Atom plugin still working ?

Raphaël Bauduin <rb@raphinou.com>
Details
Message ID
<c869abca-2d19-46ad-ab84-07ada930be90@raphinou.com>
In-Reply-To
<c15cc3bc-50ad-45a5-81b4-a2a9b02e4e48@raphinou.com> (view parent)
DKIM signature
pass
Download raw message
Hi,


thanks for the answers and sorry for my long reaction time.

When I tried to reproduce the problem with a minimal version of the 
website, I couldn't! I investigated a bit and I think the problem came 
from a bogus
page limitation in the plugin config. So it seems the plugins is still 
working. I'll continue using it and will report problems
if I encounter them.

Cheers
Reply to thread Export thread (mbox)