Subramanya Sastry has uploaded a new change for review. https://gerrit.wikimedia.org/r/293796
Change subject: Emit url-links where appropriate no matter what rel attribute says ...................................................................... Emit url-links where appropriate no matter what rel attribute says * A bunch of parser tests changed for the better including a bug fix for fragments. [[#foo|#foo]] is correct, not #foo since #foo will serialize as a list item or plain text, not as a link! Change-Id: I273a4ea671e4455f2c67fb0c98e120445a5e4470 --- M lib/html2wt/LinkHandler.js M tests/parserTests-blacklist.js 2 files changed, 69 insertions(+), 56 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/96/293796/1 diff --git a/lib/html2wt/LinkHandler.js b/lib/html2wt/LinkHandler.js index a17f19a..eaf330d 100644 --- a/lib/html2wt/LinkHandler.js +++ b/lib/html2wt/LinkHandler.js @@ -402,6 +402,9 @@ linkData.content.string = Util.decodeURI(Util.decodeEntities(target.value)); } p = Promise.resolve(); + } else if (isURLLink(state.env, node, linkData)) { + state.emitChunk(new AutoURLLinkText(node.textContent, node), node); + return; } else { p = Promise.resolve(); } @@ -531,12 +534,25 @@ }); }); -var serializeAsExtLink = Promise.method(function(node, state, linkData) { - var env = state.env; - var wiki = env.conf.wiki; +var isURLLink = function(env, node, linkData) { var target = linkData.target; var dp = DU.getDataParsoid(node); + // Get plain text content, if any + var contentStr = node.childNodes.length >= 1 && + DU.allChildrenAreText(node) ? node.textContent : null; + // First check if we can serialize as an URL link + return (contentStr && + // Can we minimize this? + (target.value === contentStr || + getHref(env, node) === contentStr) && + Util.isProtocolValid(contentStr, env) && + // But preserve non-minimal encoding + (target.modified || linkData.contentModified || dp.stx === 'url')); +}; + +var serializeAsExtLink = Promise.method(function(node, state, linkData) { + var target = linkData.target; var urlStr = target.value; if (target.modified || !target.fromsrc) { // We expect modified hrefs to be percent-encoded already, so @@ -547,59 +563,57 @@ // percent-encoded because they are valid in URLs and HTML5 urlStr = escapeExtLinkURL(urlStr); } - // Get plain text content, if any - var contentStr = node.childNodes.length >= 1 && - DU.allChildrenAreText(node) ? node.textContent : null; - // First check if we can serialize as an URL link - if (contentStr && - // Can we minimize this? - (target.value === contentStr || - getHref(env, node) === contentStr) && - // But preserve non-minimal encoding - (target.modified || linkData.contentModified || dp.stx === 'url')) { + + if (isURLLink(state.env, node, linkData)) { // Serialize as URL link state.emitChunk(new AutoURLLinkText(urlStr, node), node); return; - } else { - // TODO: match vs. interwikis too - var magicLinkMatch = wiki.ExtResourceURLPatternMatcher.match(Util.decodeURI(linkData.origHref)); - // Fully serialize the content - return state.serializeLinkChildrenToString(node, - state.serializer.wteHandlers.aHandler).then(function(_contentStr) { - contentStr = _contentStr; - // First check for ISBN/RFC/PMID links. We rely on selser to - // preserve non-minimal forms. - if (magicLinkMatch) { - var serializer = wiki.ExtResourceSerializer[magicLinkMatch[0]]; - var serialized = serializer(magicLinkMatch, target.value, contentStr); - if (serialized[0] === '[') { - // Serialization as a magic link failed (perhaps the - // content string wasn't appropriate). - state.emitChunk(magicLinkMatch[0] === 'ISBN' ? - new WikiLinkText(serialized, node, wiki, 'mw:WikiLink') : - new ExtLinkText(serialized, node, wiki, 'mw:ExtLink')); - } else { - state.emitChunk(new MagicLinkText(serialized, node), node); - } - return; - // There is an interwiki for RFCs, but strangely none for PMIDs. - } else { - // serialize as auto-numbered external link - // [http://example.com] - var linktext, Construct; - // If it's just anchor text, serialize as an internal link. - if (/^#/.test(urlStr)) { - Construct = WikiLinkText; - linktext = '[[' + urlStr + (contentStr ? '|' + contentStr : '') + ']]'; - } else { - Construct = ExtLinkText; - linktext = '[' + urlStr + (contentStr ? ' ' + contentStr : '') + ']'; - } - state.emitChunk(new Construct(linktext, node, wiki, linkData.type), node); - return; - } - }); } + + var wiki = state.env.conf.wiki; + + // Get plain text content, if any + var contentStr = node.childNodes.length >= 1 && + DU.allChildrenAreText(node) ? node.textContent : null; + + // TODO: match vs. interwikis too + var magicLinkMatch = wiki.ExtResourceURLPatternMatcher.match(Util.decodeURI(linkData.origHref)); + // Fully serialize the content + return state.serializeLinkChildrenToString(node, + state.serializer.wteHandlers.aHandler).then(function(_contentStr) { + contentStr = _contentStr; + // First check for ISBN/RFC/PMID links. We rely on selser to + // preserve non-minimal forms. + if (magicLinkMatch) { + var serializer = wiki.ExtResourceSerializer[magicLinkMatch[0]]; + var serialized = serializer(magicLinkMatch, target.value, contentStr); + if (serialized[0] === '[') { + // Serialization as a magic link failed (perhaps the + // content string wasn't appropriate). + state.emitChunk(magicLinkMatch[0] === 'ISBN' ? + new WikiLinkText(serialized, node, wiki, 'mw:WikiLink') : + new ExtLinkText(serialized, node, wiki, 'mw:ExtLink')); + } else { + state.emitChunk(new MagicLinkText(serialized, node), node); + } + return; + // There is an interwiki for RFCs, but strangely none for PMIDs. + } else { + // serialize as auto-numbered external link + // [http://example.com] + var linktext, Construct; + // If it's just anchor text, serialize as an internal link. + if (/^#/.test(urlStr)) { + Construct = WikiLinkText; + linktext = '[[' + urlStr + (contentStr ? '|' + contentStr : '') + ']]'; + } else { + Construct = ExtLinkText; + linktext = '[' + urlStr + (contentStr ? ' ' + contentStr : '') + ']'; + } + state.emitChunk(new Construct(linktext, node, wiki, linkData.type), node); + return; + } + }); }); var linkHandler = Promise.method(function(node) { diff --git a/tests/parserTests-blacklist.js b/tests/parserTests-blacklist.js index 9f2973c..f0bc1c5 100644 --- a/tests/parserTests-blacklist.js +++ b/tests/parserTests-blacklist.js @@ -396,7 +396,6 @@ // Blacklist for html2html add("html2html", "Extra newlines followed by heading", "<p data-parsoid='{\"dsr\":[0,1,0,0]}'>a</p>\n\n<p data-parsoid='{\"dsr\":[3,3,0,0]}'><br data-parsoid='{\"dsr\":[3,3,0,0]}'/></p>\n\n<h1 data-parsoid='{\"dsr\":[5,10,1,1]}'> b </h1>\n<p data-parsoid='{\"dsr\":[11,55,0,0]}'>[/index.php?title=A&action=edit&redlink=1 a]</p>\n\n<p data-parsoid='{\"dsr\":[57,57,0,0]}'><br data-parsoid='{\"dsr\":[57,57,0,0]}'/></p>\n\n<h1 data-parsoid='{\"dsr\":[59,64,1,1]}'> b </h1>\n"); add("html2html", "Extra newlines between heading and content are swallowed", "<h1 data-parsoid='{\"dsr\":[0,5,1,1]}'> b </h1>\n<p data-parsoid='{\"dsr\":[6,50,0,0]}'>[/index.php?title=A&action=edit&redlink=1 a]</p>\n"); -add("html2html", "Parsing an URL", "<p data-parsoid='{\"dsr\":[0,42,0,0]}'><a rel=\"mw:ExtLink\" href=\"http://fr.wikipedia.org/wiki/🍺\" title=\"fr:🍺\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"http://fr.wikipedia.org/wiki/🍺\"},\"sa\":{\"href\":\":fr:🍺\"},\"isIW\":true,\"dsr\":[0,42,9,2]}'>http://fr.wikipedia.org/wiki/🍺</a></p>\n"); add("html2html", "Italics and possessives (1)", "<p data-parsoid='{\"dsr\":[0,115,0,0]}'>obtained by <i data-parsoid='{\"dsr\":[12,91,2,2]}'>[/index.php?title=Lunar_Prospector&action=edit&redlink=1 Lunar Prospector]'</i>s gamma-ray spectrometer</p>\n"); add("html2html", "Italics and possessives (3)", "<p data-parsoid='{\"dsr\":[0,421,0,0]}'>The first monolingual dictionary written in a Romance language was <i data-parsoid='{\"dsr\":[67,93,2,2]}'>Sebastián Covarrubias'</i> <i data-parsoid='{\"dsr\":[94,139,2,2]}'>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i data-parsoid='{\"dsr\":[203,310,2,2]}'>Vocabolario dell'[/index.php?title=Accademia_della_Crusca&action=edit&redlink=1 Accademia della Crusca]</i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i data-parsoid='{\"dsr\":[394,420,2,2]}'>Dictionnaire Universel</i>.</p>\n"); add("html2html", "Preformatted text", "<pre data-parsoid='{\"dsr\":[0,96,1,0]}'>This is some\nPreformatted text\nWith <i data-parsoid='{\"dsr\":[39,49,2,2]}'>italic</i>\nAnd <b data-parsoid='{\"dsr\":[55,65,3,3]}'>bold</b>\nAnd a <a rel=\"mw:WikiLink\" href=\"./Wiki/Main_Page\" title=\"Wiki/Main Page\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Wiki/Main_Page\"},\"sa\":{\"href\":\"wiki/Main Page\"},\"dsr\":[73,96,17,2]}'>link</a></pre>\n"); @@ -519,7 +518,7 @@ add("html2html", "Link inside a section heading", "<h2 data-parsoid='{\"dsr\":[0,50,2,2]}'> Section with a <a rel=\"mw:WikiLink\" href=\"./Wiki/Main_Page\" title=\"Wiki/Main Page\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Wiki/Main_Page\"},\"sa\":{\"href\":\"wiki/Main Page\"},\"dsr\":[18,41,17,2]}'>link</a> in it </h2>\n"); add("html2html", "TOC regression (T14077)", "<div id=\"toc\" class=\"toc\" data-parsoid='{\"stx\":\"html\",\"dsr\":[0,339,26,6]}'><div id=\"toctitle\" data-parsoid='{\"stx\":\"html\",\"dsr\":[26,67,19,6]}'>\n<h2 data-parsoid='{\"dsr\":[46,60,2,2]}'> Contents </h2>\n</div>\n\n<ul data-parsoid='{\"dsr\":[69,153,0,0]}'><li data-parsoid='{\"dsr\":[69,153,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#title_1\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#title_1\"},\"sa\":{\"href\":\"#title_1\"},\"dsr\":[71,153,11,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[82,114,24,7]}'>1</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[115,151,22,7]}'>title 1</span></a></li></ul>\n\n<ul data-parsoid='{\"dsr\":[155,331,0,0]}'><li data-parsoid='{\"dsr\":[155,246,1,0]}'><ul data-parsoid='{\"dsr\":[156,246,0,0]}'><li data-parsoid='{\"dsr\":[156,246,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#title_1.1\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#title_1.1\"},\"sa\":{\"href\":\"#title_1.1\"},\"dsr\":[158,246,13,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[171,205,24,7]}'>1.1</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[206,244,22,7]}'>title 1.1</span></a></li></ul></li>\n<li data-parsoid='{\"dsr\":[247,331,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#title_2\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#title_2\"},\"sa\":{\"href\":\"#title_2\"},\"dsr\":[249,331,11,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[260,292,24,7]}'>2</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[293,329,22,7]}'>title 2</span></a></li></ul>\n\n</div>\n\n<h2 data-parsoid='{\"dsr\":[341,354,2,2]}'> title 1 </h2>\n\n<h3 data-parsoid='{\"dsr\":[356,373,3,3]}'> title 1.1 </h3>\n\n<h2 data-parsoid='{\"dsr\":[375,388,2,2]}'> title 2 </h2>\n"); add("html2html", "Header with special characters (bug 25462)", "<p data-parsoid='{\"dsr\":[0,72,0,0]}'>The tooltips shall not show entities to the user (ie. be double escaped)</p>\n\n<div id=\"toc\" class=\"toc\" data-parsoid='{\"stx\":\"html\",\"dsr\":[74,625,26,6]}'><div id=\"toctitle\" data-parsoid='{\"stx\":\"html\",\"dsr\":[100,141,19,6]}'>\n<h2 data-parsoid='{\"dsr\":[120,134,2,2]}'> Contents </h2>\n</div>\n\n<ul data-parsoid='{\"dsr\":[143,617,0,0]}'><li data-parsoid='{\"dsr\":[143,237,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#text_.3E_text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#text_.3E_text\"},\"sa\":{\"href\":\"#text_.3E_text\"},\"dsr\":[145,237,17,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[162,194,24,7]}'>1</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[195,235,22,7]}'>text > text</span></a></li>\n<li data-parsoid='{\"dsr\":[238,332,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#text_.3C_text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#text_.3C_text\"},\"sa\":{\"href\":\"#text_.3C_text\"},\"dsr\":[240,332,17,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[257,289,24,7]}'>2</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[290,330,22,7]}'>text < text</span></a></li>\n<li data-parsoid='{\"dsr\":[333,427,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#text_.26_text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#text_.26_text\"},\"sa\":{\"href\":\"#text_.26_text\"},\"dsr\":[335,427,17,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[352,384,24,7]}'>3</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[385,425,22,7]}'>text & text</span></a></li>\n<li data-parsoid='{\"dsr\":[428,522,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#text_.27_text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#text_.27_text\"},\"sa\":{\"href\":\"#text_.27_text\"},\"dsr\":[430,522,17,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[447,479,24,7]}'>4</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[480,520,22,7]}'>text ' text</span></a></li>\n<li data-parsoid='{\"dsr\":[523,617,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#text_.22_text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#text_.22_text\"},\"sa\":{\"href\":\"#text_.22_text\"},\"dsr\":[525,617,17,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[542,574,24,7]}'>5</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[575,615,22,7]}'>text \" text</span></a></li></ul>\n\n</div>\n\n<h2 data-parsoid='{\"dsr\":[627,644,2,2]}'> text > text </h2>\n<p data-parsoid='{\"dsr\":[645,654,0,0]}'>section 1</p>\n\n<h2 data-parsoid='{\"dsr\":[656,673,2,2]}'> text < text </h2>\n<p data-parsoid='{\"dsr\":[674,683,0,0]}'>section 2</p>\n\n<h2 data-parsoid='{\"dsr\":[685,702,2,2]}'> text & text </h2>\n<p data-parsoid='{\"dsr\":[703,712,0,0]}'>section 3</p>\n\n<h2 data-parsoid='{\"dsr\":[714,731,2,2]}'> text ' text </h2>\n<p data-parsoid='{\"dsr\":[732,741,0,0]}'>section 4</p>\n\n<h2 data-parsoid='{\"dsr\":[743,760,2,2]}'> text \" text </h2>\n<p data-parsoid='{\"dsr\":[761,770,0,0]}'>section 5</p>\n"); -add("html2html", "Header with space, plus and underscore as entity", "<p data-parsoid='{\"dsr\":[0,34,0,0]}'>Id should not contain + for spaces</p>\n\n<div id=\"toc\" class=\"toc\" data-parsoid='{\"stx\":\"html\",\"dsr\":[36,820,26,6]}'><div id=\"toctitle\" data-parsoid='{\"stx\":\"html\",\"dsr\":[62,103,19,6]}'>\n<h2 data-parsoid='{\"dsr\":[82,96,2,2]}'> Contents </h2>\n</div>\n\n<ul data-parsoid='{\"dsr\":[105,812,0,0]}'><li data-parsoid='{\"dsr\":[105,211,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Space_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Space_between_Text\"},\"sa\":{\"href\":\"#Space_between_Text\"},\"dsr\":[107,211,22,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[129,161,24,7]}'>1</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[162,209,22,7]}'>Space between Text</span></a></li>\n<li data-parsoid='{\"dsr\":[212,332,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Space-Entity_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Space-Entity_between_Text\"},\"sa\":{\"href\":\"#Space-Entity_between_Text\"},\"dsr\":[214,332,29,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[243,275,24,7]}'>2</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[276,330,22,7]}'>Space-Entity between Text</span></a></li>\n<li data-parsoid='{\"dsr\":[333,441,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Plus.2Bbetween.2BText\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Plus.2Bbetween.2BText\"},\"sa\":{\"href\":\"#Plus.2Bbetween.2BText\"},\"dsr\":[335,441,25,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[360,392,24,7]}'>3</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[393,439,22,7]}'>Plus+between+Text</span></a></li>\n<li data-parsoid='{\"dsr\":[442,564,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Plus-Entity.2Bbetween.2BText\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Plus-Entity.2Bbetween.2BText\"},\"sa\":{\"href\":\"#Plus-Entity.2Bbetween.2BText\"},\"dsr\":[444,564,32,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[476,508,24,7]}'>4</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[509,562,22,7]}'>Plus-Entity+between+Text</span></a></li>\n<li data-parsoid='{\"dsr\":[565,681,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Underscore_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Underscore_between_Text\"},\"sa\":{\"href\":\"#Underscore_between_Text\"},\"dsr\":[567,681,27,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[594,626,24,7]}'>5</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[627,679,22,7]}'>Underscore_between_Text</span></a></li>\n<li data-parsoid='{\"dsr\":[682,812,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Underscore-Entity_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Underscore-Entity_between_Text\"},\"sa\":{\"href\":\"#Underscore-Entity_between_Text\"},\"dsr\":[684,812,34,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[718,750,24,7]}'>6</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[751,810,22,7]}'>Underscore-Entity_between_Text</span></a></li></ul>\n\n</div>\n\n<h2 data-parsoid='{\"dsr\":[822,846,2,2]}'> Space between Text </h2>\n<p data-parsoid='{\"dsr\":[847,856,0,0]}'>section 1</p>\n\n<h2 data-parsoid='{\"dsr\":[858,889,2,2]}'> Space-Entity between Text </h2>\n<p data-parsoid='{\"dsr\":[890,899,0,0]}'>section 2</p>\n\n<h2 data-parsoid='{\"dsr\":[901,924,2,2]}'> Plus+between+Text </h2>\n<p data-parsoid='{\"dsr\":[925,934,0,0]}'>section 3</p>\n\n<h2 data-parsoid='{\"dsr\":[936,966,2,2]}'> Plus-Entity+between+Text </h2>\n<p data-parsoid='{\"dsr\":[967,976,0,0]}'>section 4</p>\n\n<h2 data-parsoid='{\"dsr\":[978,1007,2,2]}'> Underscore_between_Text </h2>\n<p data-parsoid='{\"dsr\":[1008,1017,0,0]}'>section 5</p>\n\n<h2 data-parsoid='{\"dsr\":[1019,1055,2,2]}'> Underscore-Entity_between_Text </h2>\n<p data-parsoid='{\"dsr\":[1056,1065,0,0]}'>section 6</p>\n\n<p data-parsoid='{\"dsr\":[1067,1274,0,0]}'><a rel=\"mw:WikiLink\" href=\"./Main_Page#Space_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Space_between_Text\"},\"sa\":{\"href\":\"#Space_between_Text\"},\"dsr\":[1067,1110,22,2]}'>#Space between Text</a>\n<a rel=\"mw:WikiLink\" href=\"./Main_Page#Space-Entity_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Space-Entity_between_Text\"},\"sa\":{\"href\":\"#Space-Entity_between_Text\"},\"dsr\":[1111,1168,29,2]}'>#Space-Entity between Text</a>\n<a rel=\"mw:WikiLink\" href=\"./Main_Page#Plus.2Bbetween.2BText\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Plus.2Bbetween.2BText\"},\"sa\":{\"href\":\"#Plus.2Bbetween.2BText\"},\"dsr\":[1169,1214,25,2]}'>#Plus+between+Text</a>\n<a rel=\"mw:WikiLink\" href=\"./Main_Page#Plus-Entity.2Bbetween.2BText\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Plus-Entity.2Bbetween.2BText\"},\"sa\":{\"href\":\"#Plus-Entity.2Bbetween.2BText\"},\"dsr\":[1215,1274,32,2]}'>#Plus-Entity+between+Text</a></p>\n<ol data-parsoid='{\"dsr\":[1275,1331,0,0]}'><li data-parsoid='{\"dsr\":[1275,1299,1,0]}'>Underscore_between_Text</li>\n<li data-parsoid='{\"dsr\":[1300,1331,1,0]}'>Underscore-Entity_between_Text</li></ol>\n"); +add("html2html", "Header with space, plus and underscore as entity", "<p data-parsoid='{\"dsr\":[0,34,0,0]}'>Id should not contain + for spaces</p>\n\n<div id=\"toc\" class=\"toc\" data-parsoid='{\"stx\":\"html\",\"dsr\":[36,820,26,6]}'><div id=\"toctitle\" data-parsoid='{\"stx\":\"html\",\"dsr\":[62,103,19,6]}'>\n<h2 data-parsoid='{\"dsr\":[82,96,2,2]}'> Contents </h2>\n</div>\n\n<ul data-parsoid='{\"dsr\":[105,812,0,0]}'><li data-parsoid='{\"dsr\":[105,211,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Space_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Space_between_Text\"},\"sa\":{\"href\":\"#Space_between_Text\"},\"dsr\":[107,211,22,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[129,161,24,7]}'>1</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[162,209,22,7]}'>Space between Text</span></a></li>\n<li data-parsoid='{\"dsr\":[212,332,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Space-Entity_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Space-Entity_between_Text\"},\"sa\":{\"href\":\"#Space-Entity_between_Text\"},\"dsr\":[214,332,29,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[243,275,24,7]}'>2</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[276,330,22,7]}'>Space-Entity between Text</span></a></li>\n<li data-parsoid='{\"dsr\":[333,441,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Plus.2Bbetween.2BText\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Plus.2Bbetween.2BText\"},\"sa\":{\"href\":\"#Plus.2Bbetween.2BText\"},\"dsr\":[335,441,25,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[360,392,24,7]}'>3</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[393,439,22,7]}'>Plus+between+Text</span></a></li>\n<li data-parsoid='{\"dsr\":[442,564,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Plus-Entity.2Bbetween.2BText\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Plus-Entity.2Bbetween.2BText\"},\"sa\":{\"href\":\"#Plus-Entity.2Bbetween.2BText\"},\"dsr\":[444,564,32,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[476,508,24,7]}'>4</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[509,562,22,7]}'>Plus-Entity+between+Text</span></a></li>\n<li data-parsoid='{\"dsr\":[565,681,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Underscore_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Underscore_between_Text\"},\"sa\":{\"href\":\"#Underscore_between_Text\"},\"dsr\":[567,681,27,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[594,626,24,7]}'>5</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[627,679,22,7]}'>Underscore_between_Text</span></a></li>\n<li data-parsoid='{\"dsr\":[682,812,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Underscore-Entity_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Underscore-Entity_between_Text\"},\"sa\":{\"href\":\"#Underscore-Entity_between_Text\"},\"dsr\":[684,812,34,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[718,750,24,7]}'>6</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[751,810,22,7]}'>Underscore-Entity_between_Text</span></a></li></ul>\n\n</div>\n\n<h2 data-parsoid='{\"dsr\":[822,846,2,2]}'> Space between Text </h2>\n<p data-parsoid='{\"dsr\":[847,856,0,0]}'>section 1</p>\n\n<h2 data-parsoid='{\"dsr\":[858,889,2,2]}'> Space-Entity between Text </h2>\n<p data-parsoid='{\"dsr\":[890,899,0,0]}'>section 2</p>\n\n<h2 data-parsoid='{\"dsr\":[901,924,2,2]}'> Plus+between+Text </h2>\n<p data-parsoid='{\"dsr\":[925,934,0,0]}'>section 3</p>\n\n<h2 data-parsoid='{\"dsr\":[936,966,2,2]}'> Plus-Entity+between+Text </h2>\n<p data-parsoid='{\"dsr\":[967,976,0,0]}'>section 4</p>\n\n<h2 data-parsoid='{\"dsr\":[978,1007,2,2]}'> Underscore_between_Text </h2>\n<p data-parsoid='{\"dsr\":[1008,1017,0,0]}'>section 5</p>\n\n<h2 data-parsoid='{\"dsr\":[1019,1055,2,2]}'> Underscore-Entity_between_Text </h2>\n<p data-parsoid='{\"dsr\":[1056,1065,0,0]}'>section 6</p>\n\n<p data-parsoid='{\"dsr\":[1067,1396,0,0]}'><a rel=\"mw:WikiLink\" href=\"./Main_Page#Space_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Space_between_Text\"},\"sa\":{\"href\":\"#Space_between_Text\"},\"dsr\":[1067,1110,22,2]}'>#Space between Text</a>\n<a rel=\"mw:WikiLink\" href=\"./Main_Page#Space-Entity_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Space-Entity_between_Text\"},\"sa\":{\"href\":\"#Space-Entity_between_Text\"},\"dsr\":[1111,1168,29,2]}'>#Space-Entity between Text</a>\n<a rel=\"mw:WikiLink\" href=\"./Main_Page#Plus.2Bbetween.2BText\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Plus.2Bbetween.2BText\"},\"sa\":{\"href\":\"#Plus.2Bbetween.2BText\"},\"dsr\":[1169,1214,25,2]}'>#Plus+between+Text</a>\n<a rel=\"mw:WikiLink\" href=\"./Main_Page#Plus-Entity.2Bbetween.2BText\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Plus-Entity.2Bbetween.2BText\"},\"sa\":{\"href\":\"#Plus-Entity.2Bbetween.2BText\"},\"dsr\":[1215,1274,32,2]}'>#Plus-Entity+between+Text</a>\n<a rel=\"mw:WikiLink\" href=\"./Main_Page#Underscore_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Underscore_between_Text\"},\"sa\":{\"href\":\"#Underscore_between_Text\"},\"dsr\":[1275,1328,27,2]}'>#Underscore_between_Text</a>\n<a rel=\"mw:WikiLink\" href=\"./Main_Page#Underscore-Entity_between_Text\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Underscore-Entity_between_Text\"},\"sa\":{\"href\":\"#Underscore-Entity_between_Text\"},\"dsr\":[1329,1396,34,2]}'>#Underscore-Entity_between_Text</a></p>\n"); add("html2html", "Headers with excess '=' characters\n(Are similar tests necessary beyond the 1st level?)", "<div id=\"toc\" class=\"toc\" data-parsoid='{\"stx\":\"html\",\"dsr\":[0,452,26,6]}'><div id=\"toctitle\" data-parsoid='{\"stx\":\"html\",\"dsr\":[26,67,19,6]}'>\n<h2 data-parsoid='{\"dsr\":[46,60,2,2]}'> Contents </h2>\n</div>\n\n<ul data-parsoid='{\"dsr\":[69,444,0,0]}'><li data-parsoid='{\"dsr\":[69,149,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#foo.3D\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#foo.3D\"},\"sa\":{\"href\":\"#foo.3D\"},\"dsr\":[71,149,10,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[81,113,24,7]}'>1</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[114,147,22,7]}'>foo=</span></a></li>\n<li data-parsoid='{\"dsr\":[150,230,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#.3Dfoo\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#.3Dfoo\"},\"sa\":{\"href\":\"#.3Dfoo\"},\"dsr\":[152,230,10,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[162,194,24,7]}'>2</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[195,228,22,7]}'>=foo</span></a></li>\n<li data-parsoid='{\"dsr\":[231,337,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#italic_heading.3D\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#italic_heading.3D\"},\"sa\":{\"href\":\"#italic_heading.3D\"},\"dsr\":[233,337,21,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[254,286,24,7]}'>3</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[287,335,22,7]}'><i data-parsoid='{\"dsr\":[309,319,2,2]}'>italic</i> heading=</span></a></li>\n<li data-parsoid='{\"dsr\":[338,444,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#.3Ditalic_heading\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#.3Ditalic_heading\"},\"sa\":{\"href\":\"#.3Ditalic_heading\"},\"dsr\":[340,444,21,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[361,393,24,7]}'>4</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[394,442,22,7]}'>=<i data-parsoid='{\"dsr\":[417,427,2,2]}'>italic</i> heading</span></a></li></ul>\n\n</div>\n\n<h1 data-parsoid='{\"dsr\":[454,462,1,1]}'> foo= </h1>\n\n<h1 data-parsoid='{\"dsr\":[464,472,1,1]}'> =foo </h1>\n\n<h1 data-parsoid='{\"dsr\":[474,497,1,1]}'> <i data-parsoid='{\"dsr\":[476,486,2,2]}'>italic</i> heading= </h1>\n\n<h1 data-parsoid='{\"dsr\":[499,522,1,1]}'> =<i data-parsoid='{\"dsr\":[502,512,2,2]}'>italic</i> heading </h1>\n"); add("html2html", "HTML headers vs TOC (bug 23393)\n(__NOEDITSECTION__ for clearer output, doesn't matter here)", "<div id=\"toc\" class=\"toc\" data-parsoid='{\"stx\":\"html\",\"dsr\":[0,628,26,6]}'><div id=\"toctitle\" data-parsoid='{\"stx\":\"html\",\"dsr\":[26,67,19,6]}'>\n<h2 data-parsoid='{\"dsr\":[46,60,2,2]}'> Contents </h2>\n</div>\n\n<ul data-parsoid='{\"dsr\":[69,155,0,0]}'><li data-parsoid='{\"dsr\":[69,155,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Header_1\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Header_1\"},\"sa\":{\"href\":\"#Header_1\"},\"dsr\":[71,155,12,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[83,115,24,7]}'>1</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[116,153,22,7]}'>Header 1</span></a></li></ul>\n\n<ul data-parsoid='{\"dsr\":[157,431,0,0]}'><li data-parsoid='{\"dsr\":[157,344,1,0]}'><ul data-parsoid='{\"dsr\":[158,344,0,0]}'><li data-parsoid='{\"dsr\":[158,250,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Header_1.1\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Header_1.1\"},\"sa\":{\"href\":\"#Header_1.1\"},\"dsr\":[160,250,14,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[174,208,24,7]}'>1.1</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[209,248,22,7]}'>Header 1.1</span></a></li>\n<li data-parsoid='{\"dsr\":[251,344,2,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Header_1.2\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Header_1.2\"},\"sa\":{\"href\":\"#Header_1.2\"},\"dsr\":[254,344,14,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[268,302,24,7]}'>1.2</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[303,342,22,7]}'>Header 1.2</span></a></li></ul></li>\n<li data-parsoid='{\"dsr\":[345,431,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Header_2\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Header_2\"},\"sa\":{\"href\":\"#Header_2\"},\"dsr\":[347,431,12,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[359,391,24,7]}'>2</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[392,429,22,7]}'>Header 2</span></a></li></ul>\n\n<ul data-parsoid='{\"dsr\":[433,620,0,0]}'><li data-parsoid='{\"dsr\":[433,620,1,0]}'><ul data-parsoid='{\"dsr\":[434,620,0,0]}'><li data-parsoid='{\"dsr\":[434,526,1,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Header_2.1\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Header_2.1\"},\"sa\":{\"href\":\"#Header_2.1\"},\"dsr\":[436,526,14,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[450,484,24,7]}'>2.1</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[485,524,22,7]}'>Header 2.1</span></a></li>\n<li data-parsoid='{\"dsr\":[527,620,2,0]}'> <a rel=\"mw:WikiLink\" href=\"./Main_Page#Header_2.2\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"./Main_Page#Header_2.2\"},\"sa\":{\"href\":\"#Header_2.2\"},\"dsr\":[530,620,14,2]}'><span class=\"tocnumber\" data-parsoid='{\"stx\":\"html\",\"dsr\":[544,578,24,7]}'>2.2</span> <span class=\"toctext\" data-parsoid='{\"stx\":\"html\",\"dsr\":[579,618,22,7]}'>Header 2.2</span></a></li></ul></li></ul>\n\n</div>\n\n<h1 data-parsoid='{\"dsr\":[630,642,1,1]}'> Header 1 </h1>\n\n<h2 data-parsoid='{\"dsr\":[644,660,2,2]}'> Header 1.1 </h2>\n\n<h2 data-parsoid='{\"dsr\":[662,678,2,2]}'> Header 1.2 </h2>\n\n<h1 data-parsoid='{\"dsr\":[680,692,1,1]}'> Header 2 </h1>\n\n<h2 data-parsoid='{\"dsr\":[694,710,2,2]}'> Header 2.1 </h2>\n\n<h2 data-parsoid='{\"dsr\":[712,728,2,2]}'> Header 2.2 </h2>\n"); add("html2html", "Media link", "<p data-parsoid='{\"dsr\":[0,60,0,0]}'><a rel=\"mw:ExtLink\" href=\"http://example.com/images/3/3a/Foobar.jpg\" data-parsoid='{\"targetOff\":43,\"contentOffsets\":[43,59],\"dsr\":[0,60,43,1]}'>Media:Foobar.jpg</a></p>\n"); @@ -634,7 +633,7 @@ add("html2wt", "Extra newlines: More paragraphs with indented comment", "a\n\n\nb\n"); add("html2wt", "Extra newlines followed by heading", "a\n\n\n\n= b =\n[/index.php?title=A&action=edit&redlink=1 a]\n\n\n\n= b =\n"); add("html2wt", "Extra newlines between heading and content are swallowed", "= b =\n[/index.php?title=A&action=edit&redlink=1 a]\n"); -add("html2wt", "Parsing an URL", "[[:fr:🍺|http://fr.wikipedia.org/wiki/🍺]]\n"); +add("html2wt", "Parsing an URL", "http://fr.wikipedia.org/wiki/🍺\n"); add("html2wt", "Italics and possessives (1)", "obtained by ''[/index.php?title=Lunar_Prospector&action=edit&redlink=1 Lunar Prospector]'''s gamma-ray spectrometer\n"); add("html2wt", "Italics and possessives (3)", "The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[/index.php?title=Accademia_della_Crusca&action=edit&redlink=1 Accademia della Crusca]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.\n"); add("html2wt", "<wbr> is valid wikitext (bug 52468)", "<wbr />\n"); @@ -1059,7 +1058,7 @@ add("html2wt", "TOC regression (T14077)", "<div id=\"toc\" class=\"toc\"><div id=\"toctitle\">\n== Contents ==\n</div>\n\n* [[#title_1|<span class=\"tocnumber\">1</span> <span class=\"toctext\">title 1</span>]]\n\n** [[#title_1.1|<span class=\"tocnumber\">1.1</span> <span class=\"toctext\">title 1.1</span>]]\n* [[#title_2|<span class=\"tocnumber\">2</span> <span class=\"toctext\">title 2</span>]]\n\n</div>\n\n== title 1 ==\n\n=== title 1.1 ===\n\n== title 2 ==\n"); add("html2wt", "Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)", "= = =\nThe line above must have a trailing space!\n\n= = =\nBut just in case it doesn't...\n"); add("html2wt", "Header with special characters (bug 25462)", "The tooltips shall not show entities to the user (ie. be double escaped)\n\n<div id=\"toc\" class=\"toc\"><div id=\"toctitle\">\n== Contents ==\n</div>\n\n* [[#text_.3E_text|<span class=\"tocnumber\">1</span> <span class=\"toctext\">text > text</span>]]\n* [[#text_.3C_text|<span class=\"tocnumber\">2</span> <span class=\"toctext\">text < text</span>]]\n* [[#text_.26_text|<span class=\"tocnumber\">3</span> <span class=\"toctext\">text & text</span>]]\n* [[#text_.27_text|<span class=\"tocnumber\">4</span> <span class=\"toctext\">text ' text</span>]]\n* [[#text_.22_text|<span class=\"tocnumber\">5</span> <span class=\"toctext\">text \" text</span>]]\n\n</div>\n\n== text > text ==\nsection 1\n\n== text < text ==\nsection 2\n\n== text & text ==\nsection 3\n\n== text ' text ==\nsection 4\n\n== text \" text ==\nsection 5\n"); -add("html2wt", "Header with space, plus and underscore as entity", "Id should not contain + for spaces\n\n<div id=\"toc\" class=\"toc\"><div id=\"toctitle\">\n== Contents ==\n</div>\n\n* [[#Space_between_Text|<span class=\"tocnumber\">1</span> <span class=\"toctext\">Space between Text</span>]]\n* [[#Space-Entity_between_Text|<span class=\"tocnumber\">2</span> <span class=\"toctext\">Space-Entity between Text</span>]]\n* [[#Plus.2Bbetween.2BText|<span class=\"tocnumber\">3</span> <span class=\"toctext\">Plus+between+Text</span>]]\n* [[#Plus-Entity.2Bbetween.2BText|<span class=\"tocnumber\">4</span> <span class=\"toctext\">Plus-Entity+between+Text</span>]]\n* [[#Underscore_between_Text|<span class=\"tocnumber\">5</span> <span class=\"toctext\">Underscore_between_Text</span>]]\n* [[#Underscore-Entity_between_Text|<span class=\"tocnumber\">6</span> <span class=\"toctext\">Underscore-Entity_between_Text</span>]]\n\n</div>\n\n== Space between Text ==\nsection 1\n\n== Space-Entity between Text ==\nsection 2\n\n== Plus+between+Text ==\nsection 3\n\n== Plus-Entity+between+Text ==\nsection 4\n\n== Underscore_between_Text ==\nsection 5\n\n== Underscore-Entity_between_Text ==\nsection 6\n\n[[#Space_between_Text|#Space between Text]]\n[[#Space-Entity_between_Text|#Space-Entity between Text]]\n[[#Plus.2Bbetween.2BText|#Plus+between+Text]]\n[[#Plus-Entity.2Bbetween.2BText|#Plus-Entity+between+Text]]\n#Underscore_between_Text\n#Underscore-Entity_between_Text\n"); +add("html2wt", "Header with space, plus and underscore as entity", "Id should not contain + for spaces\n\n<div id=\"toc\" class=\"toc\"><div id=\"toctitle\">\n== Contents ==\n</div>\n\n* [[#Space_between_Text|<span class=\"tocnumber\">1</span> <span class=\"toctext\">Space between Text</span>]]\n* [[#Space-Entity_between_Text|<span class=\"tocnumber\">2</span> <span class=\"toctext\">Space-Entity between Text</span>]]\n* [[#Plus.2Bbetween.2BText|<span class=\"tocnumber\">3</span> <span class=\"toctext\">Plus+between+Text</span>]]\n* [[#Plus-Entity.2Bbetween.2BText|<span class=\"tocnumber\">4</span> <span class=\"toctext\">Plus-Entity+between+Text</span>]]\n* [[#Underscore_between_Text|<span class=\"tocnumber\">5</span> <span class=\"toctext\">Underscore_between_Text</span>]]\n* [[#Underscore-Entity_between_Text|<span class=\"tocnumber\">6</span> <span class=\"toctext\">Underscore-Entity_between_Text</span>]]\n\n</div>\n\n== Space between Text ==\nsection 1\n\n== Space-Entity between Text ==\nsection 2\n\n== Plus+between+Text ==\nsection 3\n\n== Plus-Entity+between+Text ==\nsection 4\n\n== Underscore_between_Text ==\nsection 5\n\n== Underscore-Entity_between_Text ==\nsection 6\n\n[[#Space_between_Text|#Space between Text]]\n[[#Space-Entity_between_Text|#Space-Entity between Text]]\n[[#Plus.2Bbetween.2BText|#Plus+between+Text]]\n[[#Plus-Entity.2Bbetween.2BText|#Plus-Entity+between+Text]]\n[[#Underscore_between_Text|#Underscore_between_Text]]\n[[#Underscore-Entity_between_Text|#Underscore-Entity_between_Text]]\n"); add("html2wt", "Headers with excess '=' characters\n(Are similar tests necessary beyond the 1st level?)", "<div id=\"toc\" class=\"toc\"><div id=\"toctitle\">\n== Contents ==\n</div>\n\n* [[#foo.3D|<span class=\"tocnumber\">1</span> <span class=\"toctext\">foo=</span>]]\n* [[#.3Dfoo|<span class=\"tocnumber\">2</span> <span class=\"toctext\">=foo</span>]]\n* [[#italic_heading.3D|<span class=\"tocnumber\">3</span> <span class=\"toctext\">''italic'' heading=</span>]]\n* [[#.3Ditalic_heading|<span class=\"tocnumber\">4</span> <span class=\"toctext\">=''italic'' heading</span>]]\n\n</div>\n\n= foo= =\n\n= =foo =\n\n= ''italic'' heading= =\n\n= =''italic'' heading =\n"); add("html2wt", "HTML headers vs TOC (bug 23393)\n(__NOEDITSECTION__ for clearer output, doesn't matter here)", "<div id=\"toc\" class=\"toc\"><div id=\"toctitle\">\n== Contents ==\n</div>\n\n* [[#Header_1|<span class=\"tocnumber\">1</span> <span class=\"toctext\">Header 1</span>]]\n\n** [[#Header_1.1|<span class=\"tocnumber\">1.1</span> <span class=\"toctext\">Header 1.1</span>]]\n** [[#Header_1.2|<span class=\"tocnumber\">1.2</span> <span class=\"toctext\">Header 1.2</span>]]\n* [[#Header_2|<span class=\"tocnumber\">2</span> <span class=\"toctext\">Header 2</span>]]\n\n** [[#Header_2.1|<span class=\"tocnumber\">2.1</span> <span class=\"toctext\">Header 2.1</span>]]\n** [[#Header_2.2|<span class=\"tocnumber\">2.2</span> <span class=\"toctext\">Header 2.2</span>]]\n\n</div>\n\n= Header 1 =\n\n== Header 1.1 ==\n\n== Header 1.2 ==\n\n= Header 2 =\n\n== Header 2.1 ==\n\n== Header 2.2 ==\n"); add("html2wt", "Namespaced link must have a title", "<nowiki>[[Project:]]</nowiki>\n"); -- To view, visit https://gerrit.wikimedia.org/r/293796 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I273a4ea671e4455f2c67fb0c98e120445a5e4470 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Subramanya Sastry <ssas...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits