Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a21d79eadd7df8bb

Jump to content

Module:FillDate

From Wikipedia, the free encyclopedia

-- Requested by [[User:Sdkb]]

-- Handles these 3 cases:
--     "2023" → "1 January 2023"
--     "March 2023" → "1 March 2023"
--     "14 March 2023" → "14 March 2023"

local p = {}

-- {{#invoke:FillDate|main|{{{1|}}}}}
function p.main(frame)
    local str = frame.args[1]
	-- "2023" → "1 January 2023"
	if string.match(str, '^%d%d%d%d$') then
		return '1 January ' .. str;
	-- "March 2023" → "1 March 2023"
	elseif string.match(str, '^[a-zA-Z]+ %d%d%d%d$') then
		return '1 ' .. str;
	-- "14 March 2023" → "14 March 2023"
	else
    	return str
	end
end

return p