{
	"description": "Test `Special:Ask` output on `mainlabel=.../?#...`, `format=table`",
	"setup": [
		{
			"namespace": "SMW_NS_PROPERTY",
			"page": "Has page extra",
			"contents": "[[Has type::Page]]"
		},
		{
			"page": "Example/S0029/1",
			"contents": "[[Has page extra::123]] [[Category:S0029]]"
		}
	],
	"tests": [
		{
			"type": "special",
			"about": "#0 (?#, empty mainlabel)",
			"special-page": {
				"page": "Ask",
				"query-parameters": "-5B-5BCategory:S0029-5D-5D/-3FHas-20page-20extra/-3F-23/mainlabel%3D/offset%3D0/format%3Dtable",
				"request-parameters": []
			},
			"assert-output": {
				"to-contain": [
					"<table class=\"sortable wikitable smwtable\">",
					"<a href=.*Property:Has_page_extra\" title=\"Property:Has page extra\">Has page extra</a></th><th>&nbsp;</th>",
					"<tr data-row-number=\"1\" class=\"row-odd\"><td class=\"Has-page-extra smwtype_wpg\" data-sort-value=\"123\">",
					"<td class=\"smwtype_wpg\"><a href=.*Example/S0029/1\" title=\"Example/S0029/1\">Example/S0029/1</a></td>"
				]
			}
		},
		{
			"type": "special",
			"about": "#0.1 (?, empty mainlabel)",
			"special-page": {
				"page": "Ask",
				"query-parameters": "-5B-5BCategory:S0029-5D-5D/-3FHas-20page-20extra/-3F/mainlabel%3D/offset%3D0/format%3Dtable",
				"request-parameters": []
			},
			"assert-output": {
				"to-contain": [
					"<table class=\"sortable wikitable smwtable\">",
					"<a href=.*Property:Has_page_extra\" title=\"Property:Has page extra\">Has page extra</a></th><th>&nbsp;</th>",
					"<tr data-row-number=\"1\" class=\"row-odd\"><td class=\"Has-page-extra smwtype_wpg\" data-sort-value=\"123\">",
					"<td class=\"smwtype_wpg\"><a href=.*Example/S0029/1\" title=\"Example/S0029/1\">Example/S0029/1</a></td>"
				]
			}
		},
		{
			"type": "special",
			"about": "#1 (?#, mainlabel=-, output the same as in #0)",
			"special-page": {
				"page": "Ask",
				"query-parameters": "-5B-5BCategory:S0029-5D-5D/-3FHas-20page-20extra/-3F-23/mainlabel%3D-2D/offset%3D0/format%3Dtable",
				"request-parameters": []
			},
			"assert-output": {
				"to-contain": [
					"<table class=\"sortable wikitable smwtable\">",
					"<a href=.*Property:Has_page_extra\" title=\"Property:Has page extra\">Has page extra</a></th><th>&nbsp;</th>",
					"<tr data-row-number=\"1\" class=\"row-odd\"><td class=\"Has-page-extra smwtype_wpg\" data-sort-value=\"123\">",
					"<td class=\"smwtype_wpg\"><a href=.*Example/S0029/1\" title=\"Example/S0029/1\">Example/S0029/1</a></td>"
				]
			}
		},
		{
			"type": "special",
			"about": "#2 (?#, mainlabel=FOO, ?# takes precedence over mainlabel, same output as in #0)",
			"special-page": {
				"page": "Ask",
				"query-parameters": "-5B-5BCategory:S0029-5D-5D/-3FHas-20page-20extra/-3F-23/mainlabel%3DFOO/offset%3D0/format%3Dtable",
				"request-parameters": []
			},
			"assert-output": {
				"to-contain": [
					"<table class=\"sortable wikitable smwtable\">",
					"<a href=.*Property:Has_page_extra\" title=\"Property:Has page extra\">Has page extra</a></th><th>&nbsp;</th>",
					"<tr data-row-number=\"1\" class=\"row-odd\"><td class=\"Has-page-extra smwtype_wpg\" data-sort-value=\"123\">",
					"<td class=\"smwtype_wpg\"><a href=.*Example/S0029/1\" title=\"Example/S0029/1\">Example/S0029/1</a></td>"
				]
			}
		},
		{
			"type": "special",
			"about": "#3 (?#- forces plain output, empty mainlabel)",
			"special-page": {
				"page": "Ask",
				"query-parameters": "-5B-5BCategory:S0029-5D-5D/-3FHas-20page-20extra/-3F-23-2D/mainlabel%3D/offset%3D0/format%3Dtable",
				"request-parameters": []
			},
			"assert-output": {
				"to-contain": [
					"<table class=\"sortable wikitable smwtable\">",
					"<a href=.*Property:Has_page_extra\" title=\"Property:Has page extra\">Has page extra</a></th><th>&nbsp;</th>",
					"<tr data-row-number=\"1\" class=\"row-odd\"><td class=\"Has-page-extra smwtype_wpg\" data-sort-value=\"123\">",
					"<td class=\"smwtype_wpg\">Example/S0029/1</td>"
				]
			}
		},
		{
			"type": "special",
			"about": "#4 (?#=Foo, empty mainlabel)",
			"special-page": {
				"page": "Ask",
				"query-parameters": "-5B-5BCategory:S0029-5D-5D/-3FHas-20page-20extra/-3F-23%3DFoo/mainlabel%3D/offset%3D0/format%3Dtable",
				"request-parameters": []
			},
			"assert-output": {
				"to-contain": [
					"<table class=\"sortable wikitable smwtable\">",
					"<a href=.*Property:Has_page_extra\" title=\"Property:Has page extra\">Has page extra</a></th><th class=\"Foo\">Foo</th>",
					"<tr data-row-number=\"1\" class=\"row-odd\"><td class=\"Has-page-extra smwtype_wpg\" data-sort-value=\"123\">",
					"<td class=\"Foo smwtype_wpg\"><a href=.*Example/S0029/1\" title=\"Example/S0029/1\">Example/S0029/1</a></td>"
				]
			}
		},
		{
			"type": "special",
			"about": "#4.1 (?=Foo, empty mainlabel)",
			"special-page": {
				"page": "Ask",
				"query-parameters": "-5B-5BCategory:S0029-5D-5D/-3FHas-20page-20extra/-3F%3DFoo/mainlabel%3D/offset%3D0/format%3Dtable",
				"request-parameters": []
			},
			"assert-output": {
				"to-contain": [
					"<table class=\"sortable wikitable smwtable\">",
					"<a href=.*Property:Has_page_extra\" title=\"Property:Has page extra\">Has page extra</a></th><th class=\"Foo\">Foo</th>",
					"<tr data-row-number=\"1\" class=\"row-odd\"><td class=\"Has-page-extra smwtype_wpg\" data-sort-value=\"123\">",
					"<td class=\"Foo smwtype_wpg\"><a href=.*Example/S0029/1\" title=\"Example/S0029/1\">Example/S0029/1</a></td>"
				]
			}
		},
		{
			"type": "special",
			"about": "#5 (?#=Foo#- forces plain output, empty mainlabel)",
			"special-page": {
				"page": "Ask",
				"query-parameters": "-5B-5BCategory:S0029-5D-5D/-3FHas-20page-20extra/-3F-23%3DFoo-23-2D/mainlabel%3D/offset%3D0/format%3Dtable",
				"request-parameters": []
			},
			"assert-output": {
				"to-contain": [
					"<table class=\"sortable wikitable smwtable\">",
					"<a href=.*Property:Has_page_extra\" title=\"Property:Has page extra\">Has page extra</a></th><th class=\"Foo\">Foo</th>",
					"<tr data-row-number=\"1\" class=\"row-odd\"><td class=\"Has-page-extra smwtype_wpg\" data-sort-value=\"123\">",
					"<td class=\"Foo smwtype_wpg\">Example/S0029/1</td>"
				]
			}
		},
		{
			"type": "special",
			"about": "#6 (?#=Foo#- forces plain output, mainlabel=-, same output as in #5)",
			"special-page": {
				"page": "Ask",
				"query-parameters": "-5B-5BCategory:S0029-5D-5D/-3FHas-20page-20extra/-3F-23%3DFoo-23-2D/mainlabel%3D-2D/offset%3D0/format%3Dtable",
				"request-parameters": []
			},
			"assert-output": {
				"to-contain": [
					"<table class=\"sortable wikitable smwtable\">",
					"<a href=.*Property:Has_page_extra\" title=\"Property:Has page extra\">Has page extra</a></th><th class=\"Foo\">Foo</th>",
					"<tr data-row-number=\"1\" class=\"row-odd\"><td class=\"Has-page-extra smwtype_wpg\" data-sort-value=\"123\">",
					"<td class=\"Foo smwtype_wpg\">Example/S0029/1</td>"
				]
			}
		}
	],
	"settings": {
		"wgContLang": "en",
		"wgLanguageCode": "en",
		"smwgPageSpecialProperties": [
			"_MDAT"
		],
		"smwgNamespacesWithSemanticLinks": {
			"NS_MAIN": true,
			"SMW_NS_PROPERTY": true
		}
	},
	"meta": {
		"version": "2",
		"is-incomplete": false,
		"debug": false
	}
}