From ed084b8527f999e1f60bf05cc8da23b3ed62bf6f Mon Sep 17 00:00:00 2001 From: Agah Date: Wed, 11 Dec 2024 01:19:40 -0500 Subject: [PATCH] cracked it --- data/filters/conditional-archives.lua | 38 +++++++++------------------ 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/data/filters/conditional-archives.lua b/data/filters/conditional-archives.lua index 67e56d4..3856474 100644 --- a/data/filters/conditional-archives.lua +++ b/data/filters/conditional-archives.lua @@ -1,52 +1,38 @@ function Meta(meta) - local function dump(o) - if type(o) == 'table' then - local s = '{ ' - for k,v in pairs(o) do - if type(k) ~= 'number' then k = '"'..k..'"' end - s = s .. '['..k..'] = ' .. dump(v) .. ',' - end - return s .. '} ' - else - return tostring(o) - end - end - -- Check if each DOI is present and not set to 'N/A' - print("Repository DOI structure:", dump(meta.repository_doi)) - if meta.repository_doi and meta.repository_doi.text ~= 'N/A' then - print("Repository DOI type:", type(meta.repository_doi)) + print("Repository DOI value:", meta.repository_doi and meta.repository_doi[1].text or "nil") + if meta.repository_doi and meta.repository_doi[1] and meta.repository_doi[1].text ~= 'N/A' then meta.include_repository_doi = true print("Including repository DOI") end - print("Data DOI value:", tostring(meta.data_doi and meta.data_doi.text or "nil")) - if meta.data_doi and meta.data_doi.text ~= 'N/A' then + print("Data DOI value:", meta.data_doi and meta.data_doi[1].text or "nil") + if meta.data_doi and meta.data_doi[1] and meta.data_doi[1].text ~= 'N/A' then meta.include_data_doi = true print("Including data DOI") end - print("Book DOI value:", tostring(meta.book_doi and meta.book_doi.text or "nil")) - if meta.book_doi and meta.book_doi.text ~= 'N/A' then + print("Book DOI value:", meta.book_doi and meta.book_doi[1].text or "nil") + if meta.book_doi and meta.book_doi[1] and meta.book_doi[1].text ~= 'N/A' then meta.include_book_doi = true print("Including book DOI") end - print("Docker DOI value:", tostring(meta.docker_doi and meta.docker_doi.text or "nil")) - if meta.docker_doi and meta.docker_doi.text ~= 'N/A' then + print("Docker DOI value:", meta.docker_doi and meta.docker_doi[1].text or "nil") + if meta.docker_doi and meta.docker_doi[1] and meta.docker_doi[1].text ~= 'N/A' then meta.include_docker_doi = true print("Including docker DOI") end - print("Software review URL value:", tostring(meta.software_review_url and meta.software_review_url.text or "nil")) - if meta.software_review_url and meta.software_review_url.text ~= 'N/A' then + print("Software review URL value:", meta.software_review_url and meta.software_review_url[1].text or "nil") + if meta.software_review_url and meta.software_review_url[1] and meta.software_review_url[1].text ~= 'N/A' then meta.include_software_review = true print("Including software review") end - print("Book exec URL value:", tostring(meta.book_exec_url and meta.book_exec_url.text or "nil")) - if meta.book_exec_url and meta.book_exec_url.text ~= 'N/A' then + print("Book exec URL value:", meta.book_exec_url and meta.book_exec_url[1].text or "nil") + if meta.book_exec_url and meta.book_exec_url[1] and meta.book_exec_url[1].text ~= 'N/A' then meta.include_book_exec = true print("Including book exec") end