Edge Rewrite
// 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: a29d3a4b5cffa3ae

Jump to content

Module:Deprecated archive/testcases

From Wikipedia, the free encyclopedia
local p = require('Module:UnitTests')
local module = require('Module:Deprecated archive')

local marker = '<sup>&#91;[[WP:ATODAY|link removed]]&#93;</sup>'

local function expected_label(label)
	return '<span style="text-decoration: underline dashed #ccc;">' ..
		label ..
		'</span>' .. marker
end

local function without_tracking_category(text)
	return (text:gsub('%[%[Category:[^%]]+%]%]$', ''))
end

local function render_title(title)
	return without_tracking_category(module._main({
		url = 'https://blacklisted.example.com/example',
		title = title,
	}))
end

function p:test_html_entities_pass_through_for_rendering()
	self:equals(
		'&nbsp; remains available for normal page parsing',
		without_tracking_category(module._main({
			url = 'https://blacklisted.example.com/20120721063948/http://usps.whitepages.com/service/post_office/67234?p=1&s=NY&service_name=post_office&z=10001',
			title = 'Post Office Location&nbsp;– James A. Farley',
		})),
		expected_label('Post Office Location&nbsp;– James A. Farley'),
		{nowiki = true}
	)

	self:equals(
		'&nbsp; inside a title remains available for normal page parsing',
		without_tracking_category(module._main({
			url = 'https://blacklisted.example.com/20110310083111/http://www3.interscience.wiley.com/journal/122575093/abstract',
			title = 'Inkjet Printing&nbsp;– Process and Its Applications',
		})),
		expected_label('Inkjet Printing&nbsp;– Process and Its Applications'),
		{nowiki = true}
	)

	self:equals(
		'&ndash; remains available for normal page parsing',
		without_tracking_category(module._main({
			url = 'https://blacklisted.example.com/20150420042022/http://factfinder.census.gov/bkmk/table/1.0/en/DEC/10_SF1/GCTPH1.CY10/0500000US34037',
			title = 'GCT-PH1: Population, Housing Units, Area, and Density: 2010 - County &ndash; County Subdivision and Place from the 2010 Census Summary File 1 for Burlington County, New Jersey',
		})),
		expected_label('GCT-PH1: Population, Housing Units, Area, and Density: 2010 - County &ndash; County Subdivision and Place from the 2010 Census Summary File 1 for Burlington County, New Jersey'),
		{nowiki = true}
	)
end

function p:test_wikitext_formatting_marks_pass_through()
	self:equals(
		'italic apostrophe markup remains in direct output',
		render_title("''Price Predictions: With present inflation at nearly triple expectation, economists challenge 2009 forecast''"),
		expected_label("''Price Predictions: With present inflation at nearly triple expectation, economists challenge 2009 forecast''"),
		{nowiki = true}
	)

	self:equals(
		'italic apostrophe markup remains visible around non-Latin text',
		render_title("''Вхутемас''"),
		expected_label("''Вхутемас''"),
		{nowiki = true}
	)

	self:equals(
		'bold apostrophe markup remains in direct output',
		render_title("'''Bold-looking source title'''"),
		expected_label("'''Bold-looking source title'''"),
		{nowiki = true}
	)

	self:equals(
		'mixed italic and bold apostrophe markup remains in direct output',
		render_title("'''''Bold italic-looking source title'''''"),
		expected_label("'''''Bold italic-looking source title'''''"),
		{nowiki = true}
	)

	self:equals(
		'single apostrophes remain in direct output',
		render_title("Gods, Ghosts, and Shelley's 'Atheos'"),
		expected_label("Gods, Ghosts, and Shelley's 'Atheos'"),
		{nowiki = true}
	)

	self:equals(
		'double quotes and apostrophes remain in direct output',
		render_title('Jason Leopold "DOJ Report Says Yoo\'s Torture Memo Failed To Cite Supreme Court Case"'),
		expected_label('Jason Leopold "DOJ Report Says Yoo\'s Torture Memo Failed To Cite Supreme Court Case"'),
		{nowiki = true}
	)
end

function p:test_link_like_and_html_like_text_pass_through()
	self:equals(
		'http URL remains in direct output',
		render_title('Papercore Summary http://papercore.org/Sherrington1975'),
		expected_label('Papercore Summary http://papercore.org/Sherrington1975'),
		{nowiki = true}
	)

	self:equals(
		'www text remains in direct output',
		render_title('Hungary–Malaysia relations on www.kln.gov.my'),
		expected_label('Hungary–Malaysia relations on www.kln.gov.my'),
		{nowiki = true}
	)

	self:equals(
		'wikilink-looking text remains in direct output',
		render_title('literal [[Example]] title'),
		expected_label('literal [[Example]] title'),
		{nowiki = true}
	)

	self:equals(
		'html tag-looking text remains in direct output',
		render_title('Title <i>not italic</i>'),
		expected_label('Title <i>not italic</i>'),
		{nowiki = true}
	)
end

local function assert_done_title_is_pass_through(test, description, title)
	test:equals(
		description,
		render_title(title),
		expected_label(title),
		{nowiki = true}
	)
end

function p:test_titles_from_done_pages_pass_through()
	-- page=Brian_Johnson_(special_effects_artist) el_id=446526082
	assert_done_title_is_pass_through(self, 'named entity remains in direct output',
		'The Catacombs&mdash;Brian Johnson')

	-- page=Leopard_2 el_id=446557907
	assert_done_title_is_pass_through(self, 'quoted entity remains in direct output',
		'"120&nbsp;mm DM 33A1 and DM 43A1 APFSDS-T rounds (Germany)"')

	-- page=Sergei_Kruglov_(politician) el_id=461942412
	assert_done_title_is_pass_through(self, 'italic markup and entity remain in direct output',
		[=[Timothy K. Blauvelt. ''Patronage and betrayal in the post-Stalin succession: the case of Kruglov and Serov.'' Communist and Post-Communist Studies, Volume 41, Issue 1, March 2008, Pages 105&ndash;120. Quote from p. 117: "He died in obscurity."]=])

	-- page=Roman_circus el_id=452614662
	assert_done_title_is_pass_through(self, 'template pipe marker remains in direct output',
		'Roman sites by list {{!}} Spain {{!}} Italica')

	-- page=Cotswold_Water_Park el_id=524167330
	assert_done_title_is_pass_through(self, 'convert template remains in direct output',
		'Natural England Unit 8 of the Cotswold Lakes, the {{convert|8|ha|adj=on}} Whelford Pool (most northerly)')

	-- page=Noh_Hong-chul el_id=525269389
	assert_done_title_is_pass_through(self, 'numeric entity remains in direct output',
		"&#91;Issue&#93; Psy Unveils BTS Video of Noh Hong-chul's Pelvis Thrusting")

	-- page=List_of_monastic_houses_in_Hampshire el_id=543138443
	assert_done_title_is_pass_through(self, 'em dash and non-breaking space remain in direct output',
		'Pastscape&nbsp;— Detailed Result: BADDESLEY HOSPITALLERS PRECEPTORY')

	-- page=Yury_Lonchakov el_id=581483421
	assert_done_title_is_pass_through(self, 'entity in a non-Latin title remains in direct output',
		'Указ Президента Российской Федерации от 2 апреля 2010 г. №&nbsp;412')

	-- page=Erik_Hazelhoff_Roelfzema el_id=656995248
	assert_done_title_is_pass_through(self, 'in lang template remains in direct output',
		'Regional Archive, Leiden: Aantekeningen van Mr. P.J. Idenburg betreffende het Leids Universitair verzet (Notes by Mr. P.J. Idenburg regarding the Leiden University resistance) {{in lang|nl}}')

	-- page=1930_24_Hours_of_Le_Mans el_id=672143724
	assert_done_title_is_pass_through(self, 'entity with an en dash remains in direct output',
		'The greatest race&nbsp;– Telegraph')

	-- page=John_Key el_id=673644735
	assert_done_title_is_pass_through(self, 'italic title with an entity remains in direct output',
		"''New&nbsp;Zealand Gazette''")

	-- page=Follies el_id=675681223
	assert_done_title_is_pass_through(self, 'quote template remains in direct output',
		[=[{{"'}}Once', 'Clybourne Park', 'Porgy and Bess', Audra McDonald, 'Salesman' Win Tony Awards]=])

	-- page=The_Cenci el_id=683361255
	assert_done_title_is_pass_through(self, 'quote template and apostrophe remain in direct output',
		[=[{{"'}}A dark glory': The Divinely Violent Woman from Shelley to Hawthorne]=])

	-- page=Plovdiv el_id=713458628
	assert_done_title_is_pass_through(self, 'spaced dash template remains in direct output',
		[=["Statistics of the European Cities{{spaced ndash}} City of Plovdiv"]=])

	-- page=Adevărul el_id=713590262
	assert_done_title_is_pass_through(self, 'language template remains in direct output',
		[=["Adevărul despre {{Lang|ro|Adevărul}}"]=])

	-- page=Cardinal_Bird el_id=714792511
	assert_done_title_is_pass_through(self, 'angle-bracket text remains in direct output',
		'A Testimonial From the Cardinal Bird :: <blank>')
end

function p:test_non_entity_special_title_cases_have_expected_output()
	-- Keep this corpus independent from the sandbox suite so matching
	-- implementations cannot hide a shared regression.
	assert_done_title_is_pass_through(self, 'Brown University title passes through',
		'Dara Khosrowshahi: Executive Profile & Biography')
	assert_done_title_is_pass_through(self, 'German cuisine title passes through',
		'Guide to German Sausages & Meat Products')
	assert_done_title_is_pass_through(self, 'Alps title passes through',
		"Gods, Ghosts, and Shelley's 'Atheos'")
	assert_done_title_is_pass_through(self, 'Abu Zubaydah title passes through',
		'Jason Leopold "DOJ Report Says Yoo\'s Torture Memo Failed To Cite Supreme Court Case"')
	assert_done_title_is_pass_through(self, 'Economy of Armenia title passes through',
		"''Price Predictions: With present inflation at nearly triple expectation, economists challenge 2009 forecast''")
	assert_done_title_is_pass_through(self, 'Bauhaus title passes through',
		"''Вхутемас''")
	assert_done_title_is_pass_through(self, 'Ainu people title passes through',
		'市史編さんニュース №100 ヌプンケシ')
	assert_done_title_is_pass_through(self, 'Amphipolis title passes through',
		'Bulletin de Correspondance Hellénique')
	assert_done_title_is_pass_through(self, 'David Thompson title passes through',
		"David Thompson's narrative, 1784–1812")
	assert_done_title_is_pass_through(self, 'Foreign relations of Hungary title passes through',
		'Hungary–Malaysia relations on www.kln.gov.my')
	assert_done_title_is_pass_through(self, 'Spin glass title passes through',
		'Papercore Summary http://papercore.org/Sherrington1975')
	assert_done_title_is_pass_through(self, 'Natacha Atlas title passes through',
		'Ana Hina – Natacha Atlas & The Mazeeka Ensemble (World Village)')
end

return p