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