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: a23ba1691edfc20a

Jump to content

Module:Cite EHLL

From Wikipedia, the free encyclopedia

-- This module helps linking to the correct archived volume of the
-- Encyclopedia of Hebrew Language and Linguistics.

local getArgs = require('Module:Arguments').getArgs

local p = {}

local ia_volume_url = {
	[1] = 'https://archive.org/details/encyclopediaofhe0001unse_f9g4',
	[2] = 'https://archive.org/details/encyclopediaofhe0002unse_u9w7',
	[3] = 'https://archive.org/details/encyclopediaofhe0003unse',
	[4] = 'https://archive.org/details/encyclopediaofhe0004unse',
}

function p._getArchiveUrl(title, page)
	return ia_volume_url[p._getVolumeNumber(title)] .. '/page/' .. page .. '/mode/2up'
end

function p.getArchiveUrl(frame)
	local args = getArgs(frame)
	return p._getArchiveUrl(args[1], args[2])
end

function p._getVolumeNumber(title)
	local volume_patterns = {
		["[A-F]"] = 1,
		["[G-O]"] = 2,
		["[P-Z]"] = 3,
	}
	local first_letter = mw.ustring.sub(title, 1, 1)

	for pattern, volume in pairs(volume_patterns) do
		if (string.match(first_letter, pattern))
		then
			return volume
		end
	end

	return 'Error getting EHLL volume number from title ' .. title
end

function p.getVolumeNumber(frame)
	local args = getArgs(frame)
	return p._getVolumeNumber(args[1])
end

return p