From fc4a406371fdf130d6f0db02d3a2e09112686b9f Mon Sep 17 00:00:00 2001 From: sanine Date: Sun, 22 May 2022 12:43:03 -0500 Subject: fix bug in tests and add marigold.h --- marigold.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'marigold.lua') diff --git a/marigold.lua b/marigold.lua index 939a7ba..c95ecb5 100644 --- a/marigold.lua +++ b/marigold.lua @@ -36,4 +36,34 @@ local marigold = {} +marigold.get_metavars = function() + local vars = { + "AUTH_TYPE", "CONTENT_LENGTH", + "CONTENT_TYPE", "GATEWAY_INTERFACE", + "PATH_INFO", "PATH_TRANSLATED", + "QUERY_STRING", "REMOTE_ADDR", + "REMOTE_HOST", "REMOTE_IDENT", + "REMOTE_USER", "REQUEST_METHOD", + "SCRIPT_NAME", "SERVER_NAME", + "SERVER_PORT", "SERVER_PROTOCOL", + "SERVER_SOFTWARE" + } + local metavars = {} + for _, var in ipairs(vars) do + metavars[string.lower(var)] = os.getenv(var) + end + return metavars +end + + +marigold.h = function(tag_type, content, tbl) + local tag = {} + tag.tag = tag_type + tag.content = content + tag.attributes = {} + tag.children = {} + return tag +end + +return marigold -- cgit v1.2.1