-- External scripts are resolved relative to the HTML file that includes them :) local features = { "inline Lua", "external Lua", "DOM updates", "directory walking", "logging", "mixed content" } local feature_list = assert(html.find_by_class(page, "feature-list")) for _, feature in ipairs(features) do table.insert(feature_list.children, html.element("li", nil, { feature })) end local entries = {} for entry in fs.walk(".") do table.insert(entries, entry) end table.sort(entries, function(left, right) return left.path < right.path end) local summary = assert(html.find_by_class(page, "file-summary")) summary.text = tostring(#entries) .. " entries" local file_list = assert(html.find_by_class(page, "file-list")) for _, entry in ipairs(entries) do table.insert(file_list.children, html.element("li", nil, { html.element("code", nil, { entry.path }), " (", entry.type, ")" })) end local build_summary = assert(html.find_by_class(page, "build-summary")) build_summary.text = "Built with " .. site.name .. " " .. site.version local mixed = assert(html.find_by_class(page, "mixed-content")) mixed.children = { { kind = "comment", text = "generated by Lua" }, "Text with ", html.element("strong", nil, { "an element" }), "." } table.insert(page.head.children, 1, { kind = "processing_instruction", target = "yapssg", text = "generated" }) page.attributes["data-entry-count"] = tostring(#entries) log.info("generated", #features, "feature items") log.debug("walked", #entries, "entries")