aboutsummaryrefslogtreecommitdiffstats
path: root/tests/parser/parserTests.txt
Commit message (Collapse)AuthorAgeFilesLines
...
* Sync up core repo with ParsoidSubramanya Sastry2023-11-071-137/+45
| | | | | | This now aligns with Parsoid commit f73c9f0f665a57f5c0247ad1973a4f33f165f96b Change-Id: Ibd531ddb1d545c1286e3cd3c3c6c08536f954768
* Add parser test for escaped wikitext in section headingBartosz Dziewoński2023-10-091-0/+12
| | | | Change-Id: I4f0c2107541b668f6ddd093dadcb6f391724d57f
* Sync up core repo with ParsoidIsabelle Hurbain-Palatin2023-07-131-6/+41
| | | | | | This now aligns with Parsoid commit 273c783374efdb148f26d7a0f3d590eb6ae66551 Change-Id: I742825115730b5697a1da47ce5d135adcdef1f8c
* Sync up core repo with ParsoidArlo Breault2023-05-261-4/+6
| | | | | | This now aligns with Parsoid commit 0dc439dd46b5db02bd515d642caa15f9e081270d Change-Id: I513703b4c1f002c75afd7d4792d47aa3cca0e726
* Merge "Sync up core repo with Parsoid"jenkins-bot2023-05-251-6/+47
|\
| * Sync up core repo with ParsoidArlo Breault2023-05-251-6/+47
| | | | | | | | | | | | This now aligns with Parsoid commit db0772cd77d89ea166bf6ea162f9d223264a6f50 Change-Id: I988d8e3bd4953fdf8e71ca0ed72f2f0755e4948c
* | Sanitizer: Permit the `aria-level` HTML attribute in wikitextMatt Fitzpatrick2023-05-211-0/+14
|/ | | | | | | | | | | | Allows editors to identify a pseudo-heading as a heading of a given hierarchical level to assistive technologies. Also allows levels 7 and deeper. <div role="heading" aria-level="2">Example</div> See also https://www.w3.org/WAI/GL/wiki/Using_role%3Dheading Change-Id: Ia465a076db334d08cd1f548f2363a0f7cafe7690
* Sync up core repo with ParsoidC. Scott Ananian2023-05-111-16/+59
| | | | | | This now aligns with Parsoid commit ede7e1c0afab3dea5c02033b9ad4e9a064e27717 Change-Id: Ib8ec513f3cef75c071b6d08913a18515a15ec82a
* Sync up core repo with ParsoidArlo Breault2023-04-261-1475/+1
| | | | | | This now aligns with Parsoid commit eb7a6ce7afac292b7e8a43c622fea6ac65791fc1 Change-Id: Ie704588c71bff4525632e6aa918ae6d0bd3364fb
* Add classes on elements inside the media structureArlo Breault2023-04-261-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | The purpose of which is to improve the performance of the css selectors targeting the output, as analyzed in T270150#8524965, as well as eliminate some of the brittleness in depending on direct descendents and first-child, which can be seen in T320285 and T304010. mw-file-element is targeted to apply margins, borders, and vertical-alignment to that element. The current css rules have wildcard selectors in the rightmost position, which, since css is parsed right-to-left, can be quite slow on a wiki page. The legacy parser has an equivalent class, thumbimage, when rendering thumbs but here we apply the class more broadly. A follow-up patch in I70c61493fe492445702f036e5b24ef87fc3bdf43 will remove the redundant wildcard selectors once parsercache has turned over. Bug: T270150 Bug: T314097 Depends-On: Ie85ee7048273023a2c51f42a333a9c1493360404 Depends-On: Ie0ec018ac6c2c42c05610b342d7ef87493dfdc42 Depends-On: Ifc17fdf530af515b066de706ca5e69e118fd1c5b Depends-On: Ib60edacdae2ff41a0de2b2b584718fd9ce925f97 Change-Id: Ifd4001e312a5fa4b7beaad63ba8c4e79e3201b9b
* ParserTestRunner: use TOCData::prettyPrint() for 'showtocdata'C. Scott Ananian2023-03-101-4/+9
| | | | | | | | This provides a bit of isolation from the actual layout and names of properties in the object, as well as being a touch more readable when debugging test failures. Change-Id: I5ddca850f577b2ac24e237a2518f03983e79a51d
* Don't clear LanguageConverter display title when converting ToCC. Scott Ananian2023-03-091-0/+46
| | | | | | | | | | | | | | | | The LanguageConverter::convert()/::convertTo() methods clear the converted title and reset other (less important) bits of LanguageConverter state. Add an optional parameter in order to skip this reset. (The LanguageConverter::translate() methods are available which don't reset LanguageConverter state, but they also don't process embedded language converter markup. Since headings can contain embedded markup, the ::translate() methods aren't appropriate.) Bug: T306862 Bug: T331316 Change-Id: Ifb2745e45974755ba5a6068c13e84be6c4e3f329
* ParserTestRunner: handle metadata output as separate sectionC. Scott Ananian2023-02-281-40/+98
| | | | | | | | | | | | | | | | | | | | | | | | If a ParserTest mixes HTML output and metadata properties, it can complicate HTML normalization and other test processes, especially for Parsoid-mode bidirectional tests. Support splitting metadata output into a separate section, named `!! metadata`, with the standard options for legacy and parsoid variants, like `!! metadata/php` and `!! metadata/parsoid` and `!! metadata/parsoid+integrated` etc. For compatibility, if the metadata flags are present on the test and the new section is not present, we'll continue to handle the metadata output as we have before, aka append or prepend the metadata to the HTML. Code search for uses of these options (uses in parsoid and core can be ignored; uses of 'pst' are harmless when they are not combined with another option): https://codesearch.wmcloud.org/search/?q=%28%5E%7C%20%29%28%28showtitle%7Cshowindicators%7Cill%7Ccat%7Cpst%7Cshowflags%29%28%20%7C%24%29%7C%28extension%3D%7Cproperty%3D%29%29&i=nope&files=%5Etests%2Fparser%2F.*%5C.txt&excludeFiles=&repos= Change-Id: I845694d4f2109a8b9125410e8533ca69bbea50fa
* Language-convert Table of Contents at parse timeC. Scott Ananian2023-02-241-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 24949480eb22947298e6a82db06c55af0d262db2 (Oct 2021) injection of the Table of Contents was moved from Parser to ParserOutput::getText(); that is, from parse time to "postprocess text possibly fetched from the cache" time. Unfortunately, this meant that language conversion wasn't done on the table of contents (!), for either traditional skins or the vector-2022 skin. This was fixed for traditional skins by 059e62cde6cdf4a87dfa45a79191bed531045501 (Nov 2021), later amended by 0955046ca59aae705fee8b098e4cfef394647b5e (Mar 2022), which added explicit language conversion to the TOC injection process in ParserOptions::getText(). This fix was still not complete, however, since editor-defined custom language-conversion rules defined in the article body were no longer available to the language converter when conversion was done in ParserOutput::getText(); the ToC title was also being double-converted. Further, neither of these short-term fixes addressed the output of ParserOutput::getSections() (now ParserOutput::getTOCData()) which was used by vector-2022 to generate the ToC in the sidebar and which remained entirely unconverted. With 439656e01974e3cbc57902fb4ef33e71c1a386d5 (Jan 2023), we started using the ::getSections()/::getTOCData() output for main article text as well, but we kept the previous hack which post-converted the generated HTML. This kept old skins at parity with the post-Oct-2021 status, but also didn't address the conversion issue for vector-2022. The solution here is to perform language conversion on the ToC lines at parse time along with the rest of the language conversion, and store *converted* headings in TOCData. This has a number of side effects: 1. The ToC information array available via the action API is now language converted. This is *probably* what you wanted in the first place, but could potentially be disruptive. 2. The ToC is consistently converted with the full set of editor-defined custom conversion rules. Before Oct 2021, the ToC was converted using the set of custom conversion rules *active at the point at which the ToC was inserted* (which was usually near the beginning of the article). When all conversion rules appear at the very top of the article (best practice!): -{en:Foo; en-x-piglatin:Bar;} Lead section text == Introduction == == Foo == There should be no difference before pre-Oct 2021 behavior and the behavior after this patch: in both cases the rule defined in the article body will be applied both to the heading and to the TOC, and they will be consistent. (After Oct 2021 and before this patch, Foo would be converted in the heading but not in the table of contents.) But in cases where conversion rules are defined after the TOC insertion point, the section heading as it appears in the body text could appear different from the section heading as it appears in the ToC. For example, if you defined a conversion rule just before using a term in a heading: == Introduction == -{en:Foo; en-x-piglatin:Bar;}- == Foo == Before Oct 2021, this rule would be applied to the heading, but not to the TOC (because the TOC insertion point was before the rule definition). This would also be the behavior before this patch (since rules defined in the article body are currently not applied at all). After this patch, the rule will be applied to both the heading and the TOC (because the rule application location is effectively "at the very end of the article"). In the rare cases when rules are not defined in glossaries at the top of the article, this type of usage (definition immediately preceding first use) is expected to be the most common and the behavior after this patch is more correct. But alternatively, if you defined a conversion rule *after* using the term in a heading: == Introduction == == Foo == -{en:Foo; en-x-piglatin:Bar;}- Before Oct 2021, this rule wouldn't be applied to the heading *or* the TOC. Before this patch, this would also be the case (because rules defined in the article body are not applied at all). After this patch, the rule will be applied to the ToC but not the heading, since the application point for the TOC is effectively at the end of the article. This inconsistency is probably not desirable, but this case is expected to be rare, and (assuming the editor intended 'Foo' to be unconverted) the editor can work around the inconsistency by explicitly protecting 'Foo' from conversion: == -{Foo}- == -{en:Foo; en-x-piglatin:Bar;}- And if the editor /intended/ Foo to be converted, the rule definition should be moved earlier in the article. Again, putting all rules at the top of the article is the preferred style, and works better with the glossary style used by the zhwiki community (see also https://www.mediawiki.org/wiki/Requests_for_comment/Scoped_language_converter ). Bug: T306862 Depends-On: I0c9c9fec920f7cb028d935e552a8f11475a23ba7 Change-Id: I321cd31dae64bbf845d53282e5d28a55bc4ec319
* Sync up core repo with ParsoidC. Scott Ananian2023-02-231-1/+1
| | | | | | This now aligns with Parsoid commit 90bc541138035d4ff6b62efa0050bd03161bc43b Change-Id: I9f16f71996da5e5baf1e0506129342a25c2ece75
* Merge "ParserTestRunner: Move 'showflags' handling inside ↵jenkins-bot2023-02-231-4/+2
|\ | | | | | | ::addParserOutputInfo()"
| * ParserTestRunner: Move 'showflags' handling inside ::addParserOutputInfo()C. Scott Ananian2023-02-221-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is just a clean up refactor to keep the option handling code in one place, and to allow Parsoid to share it when running in integrated mode. But in the process we tweaked a few other things for consistency: * The 'pst' option now can add all of the parser output metadata flags (not just 'showflags') * The 'ill' and 'cat' options append to, instead of replacing, the parser output. * A new 'nohtml' option was added to allow suppressing the HTML in cases where replacing, rather than appending to, the HTML is desired. * 'showflags' doesn't emit an 'extra' newline at the start of its output any more. The appropriate changes to parser tests were performed to accomodate these tweaks. Code search for uses of these options (uses in parsoid and core can be ignored; uses of 'pst' are largely unchanged): https://codesearch.wmcloud.org/search/?q=%28%5E%7C%20%29%28pst%7Cill%7Ccat%7Cshowflags%29%28%20%7C%24%29&i=nope&files=%5Etests%2Fparser%2F.*%5C.txt&excludeFiles=&repos= Depends-On: I5c22f456a3ae5ea25b59c4246d68965099c465cc Depends-On: If307de5d683829beb552663c72288d065827cfb6 Change-Id: I61a67a0e6928463e3872be9a42ff6992c6754662
* | ParserTestRunner: set the user language to variant when present (take 2)C. Scott Ananian2023-02-211-2/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | In production the user language is set to the variant code, not the base language code, and the parser test runner should match that. Similarly, we don't need to explicitly ::setLanguage() in the RequestContext; let it pick up the appropriate language (actually, variant) from ::setUser(). This exposes a bug in the way ToC conversion is done, which results in double-conversion of the ToC title. This will be fixed in I321cd31dae64bbf845d53282e5d28a55bc4ec319. Some of the variant tests use Pig Latin as the target variant. But in order to have good results from parser tests with Pig Latin as a variant, it needs to be "supported" aka have at least one localized message, so we can verify that the correct localization is being done. Some tweaks were needed to LanguageNameUtils in order to ensure that Pig Latin is supported if (and only if) the UsePigLatinVariant is enabled in the site configuration. This is a revision of Ia72c960b2c7914342eb4d5e3e63f2d6af14719ad, which had to be reverted when it broke Parsoid CI: the ParserTestRunner used $context->getLanguage() in some places (which is the *user* language) where it ought to have used the *page* language. Depends-On: I318c2fb8694c90efef07f1e2951c6d9aa6b3e82f Change-Id: I0c9c9fec920f7cb028d935e552a8f11475a23ba7
* Use alt as link content for broken mediaArlo Breault2023-02-161-1/+1
| | | | | | | | | | Matches Parsoid commit Iddf3e204d6e489cc8a33034da0d9e540efe65553 This is what browsers will do if an image can't be loaded but we're preempting that with a span, rather than an img tag with a broken src. Bug: T273014 Change-Id: Ic24fcbb932d02f1c820d4cb1c353d63844a023f6
* Remove back-compatibility code for ToC markerC. Scott Ananian2023-02-101-3/+6
| | | | | | | | | | | | Before 1.39 we used <mw:toc> and in 1.39 we switched to <mw:tocplace/> (commit 24949480eb22947298e6a82db06c55af0d262db2). This was changed to a <meta> tag in 1.40 (commit 0b10563895c8fcb57a1b2205b4c905ba3a6104d3 and fa8646ca7ba3bb599154f02d1793c8c6c99b0875) and the old content has long since expired from the ParserCache. Clean up the old ParserCache transition code. Change-Id: I3254d0acba31e107b50767797a2b0ad28aba59ee
* Do not use media filename as alt attributeArlo Breault2023-02-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Matches Parsoid's current output. Not a canonical source, but, this site says, https://help.siteimprove.com/support/solutions/articles/80000863904-accessibility-image-alt-text-best-practices > If no alt attribute is present, the screen reader will read the file > name for the image instead, which can be a major distraction to those > using screen-reading technology. So, reading the filename seems to be a default behaviour anyways and using the filename doesn't seem to adding any benefit. However, placing it preempts any improvements that might happen in screen reading technology since the screen reader would likely prefer the alt attribute to any magic it tries to do in its absence (like machine vision processing of the image). An alternative proposal would be to strip off the file extension as in I218e5565816b7643f3b85083031644e3e4749a5c and implement the same in Parsoid. Longer term plans that actually address the issue here are in T325955 and T63566. Bug: T326041 Bug: T63566 Bug: T325955 Depends-On: I7b1f07190e8eaca5cbda38d9ce366aa60041ab81 Depends-On: I9dd37f70be8163df76c154f175ef50134fb811d8 Depends-On: If9cdabdfac26656272fcf3b4aaae0576aaed1346 Change-Id: If1e55feb86ce8b32f772e3b78bc9d29f122f4d58
* Sync up core repo with ParsoidArlo Breault2023-02-091-1/+1
| | | | | | This now aligns with Parsoid commit 9e80bdc35d49443bcbb361f5b3110f98956d97e6 Change-Id: I3f10d62545a928b09c4341c125e555dc4757cbb2
* Revert "ParserTestRunner: properly set the user language when a variant is ↵C. Scott Ananian2023-02-011-8/+2
| | | | | | | | | | present" This reverts commit 7bc46b33351dff43219845a071e4a9511f694c0a. Reason for revert: This seems to regress parser tests involving language converter, which are included in the parsoid repository but not (for some reason) in core. Since this breaks Parsoid CI, I'm reverting this patch until I can investigate and fix those issues. Change-Id: I6bc8e425ea35de4e9237895d48ed0178f8641500
* ParserTestRunner: properly set the user language when a variant is presentC. Scott Ananian2023-02-011-2/+8
| | | | | | | | | | | | | | | | | | | | | | In production the user language is set to the variant code, not the base language code, and the parser test runner should match that. Similarly, we don't need to explicitly ::setLanguage() in the RequestContext; let it pick up the appropriate language (actually, variant) from ::setUser(). This exposes a bug in the way ToC conversion is done, which results in double-conversion of the ToC title. This will be fixed in I321cd31dae64bbf845d53282e5d28a55bc4ec319. Some of the variant tests use Pig Latin as the target variant. But in order to have good results from parser tests with Pig Latin as a variant, it needs to be "supported" aka have at least one localized message, so we can verify that the correct localization is being done. Some tweaks were needed to LanguageNameUtils in order to ensure that Pig Latin is supported if (and only if) the UsePigLatinVariant is enabled in the site configuration. Depends-On: I318c2fb8694c90efef07f1e2951c6d9aa6b3e82f Change-Id: Ia72c960b2c7914342eb4d5e3e63f2d6af14719ad
* Self link fragments should be properly escapedJon Robson2023-01-231-0/+14
| | | | | Bug: T327467 Change-Id: Ic0625f8503ad7f6c918dcb263c5a4ef27d191759
* Sync up core repo with ParsoidArlo Breault2023-01-181-0/+4
| | | | | | This now aligns with Parsoid commit 6769188d590002757556ebc0b56a66574ebe9796 Change-Id: I289d03995302e7fd85b0a1b2545f9f3fa5799bb4
* Sync tests with parsoidIsabelle Hurbain-Palatin2023-01-131-1/+3
| | | | | | | Split output sections between html/php and html/parsoid on the self-link so that it doesn't break Parsoid when syncing in the other direction. Change-Id: Ib746a457e07e09c9a9f296079858206109afb8e3
* Merge "Parser: Add mw-selflink-fragment class to links to hash fragments in ↵jenkins-bot2023-01-111-1/+1
|\ | | | | | | the same page"
| * Parser: Add mw-selflink-fragment class to links to hash fragments in the ↵Jon Robson2023-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | same page It should be cheap for JavaScript modules to identify all links in the page which point to hash fragments within the current article. These should not be styled the same as self links given the existing parser text. This will be used by Popups to disable previews on links that link back to the same page. Bug: T198652 Change-Id: Ic6cca5023c32291032cf10c1ece9c70ddd0f40c2
* | Sync up core repo with ParsoidSubramanya Sastry2023-01-061-4970/+340
|/ | | | | | This now aligns with Parsoid commit f4a186b9b63f9216b2d7a363aa1ed45aef59b0c4 Change-Id: Ie48f0c03a1539a575389f766b994c54a75bfb3e1
* Replace comments about deprecated Linker::commentBlock/formatCommentUmherirrender2022-12-111-1/+1
| | | | | Bug: T324906 Change-Id: I7d9766ffca47e1ea3f2120b095d6ca7c8ae7aeb6
* Sync up core repo with ParsoidSubramanya Sastry2022-10-191-3073/+19
| | | | | | This now aligns with Parsoid commit 00d6c00c5972705c0f88d398e4b78f757ef86f4b Change-Id: I051d1b29e480292078f681fc722a63d0d1588d15
* Sync up core repo with ParsoidC. Scott Ananian2022-10-121-5016/+0
| | | | | | | | | | | | | | | | This now aligns with Parsoid commit a3d35adf78c3c7e6a8f04e9a55b76f3efefaedb8 The monolithic parserTests.txt have been split up into a number of smaller test files (more splitting to come) and three existing parser test files have been renamed: mediaParserTests.txt => media.txt legacyMediaParserTests.txt => legacyMedia.txt extraParserTests.txt => badCharacters.txt This reduces redundancy and filename length now that we've got a dozen or so of these. Change-Id: I2c1461341fcb3f3cef8e49b5575cd30f3a38e500
* Sync up core repo with ParsoidC. Scott Ananian2022-10-121-2/+3
| | | | | | This now aligns with Parsoid commit 5c6d948979bba6b58db13790cf3afcc883fe4ff6 Change-Id: Ide7239edc93180c329ab4459f82f84439d9beedd
* Sync up with Parsoid parserTests.txtSubramanya Sastry2022-10-031-203/+581
| | | | | | This now aligns with Parsoid commit adaa34c746d802e320dab362ba89787145e2a14e Change-Id: I746ecd6796d252b58cef4f3baac2f3043da87dd7
* Ensure Parser::fetchFileAndTitle returns title after img redirectsBrian Wolff2022-09-271-0/+18
| | | | | | | | | | | | | This is a regression from 4880a8255528. Previously this function returned the resulting Title after resolving all redirects. The difference is subtle, mostly around what title attribute to use for Media: links, and what alt text to use for images with no specified alt text. Adds parser tests for the image redirect case. Change-Id: If5de59968d17054c9b8860513a08fdce6a4bb6c6
* Sync up with Parsoid parserTests.txtIsabelle Hurbain-Palatin2022-09-261-0/+25
| | | | | | This now aligns with Parsoid commit 01e9bed038ff995fcc40b36183f6d395d491bfd2 Change-Id: Ibbac89fff052a67dc393a18f984c3c4e8985f1e0
* Unify no-arg and 1-arg forms of {{REVISIONTIMESTAMP}} and friendsC. Scott Ananian2022-09-211-9/+52
| | | | | | | | | | | | | | | | | | | | | | | Eliminate a difference between the magic variable (no-arg) and parser function (1-arg) forms; aka the difference between {REVISIONTIMESTAMP}} and {{REVISIONTIMESTAMP:{{PAGENAME}}}}. This is a follow up to I8d25755e4d92bd91988cfb706d85bdb170abb207. The magic variable contains a MAX_TTS optimisation which reduces the use of vary-revision-timestamp, since it has severe performance implications; this patch applies the same optimisation to the parser function. The ParserTestRunner has a small issue with test setup: ParserOptions::setTimestamp() was called with a unix-format timestamp, where it expected a TS_MW format timestamp. This issue was fixed, along with tweaking the test timestamps so that a timestamp coming from ParserOptions would still be distinguishable from one coming from the revision. Bug: T204370 Change-Id: I883d42d67013b6fb0da57c61e715b51d3a807879
* Sync up with Parsoid parserTests.txtArlo Breault2022-08-221-1/+35
| | | | | | This now aligns with Parsoid commit 9cce1184520a09ce498d26f2dca4390851df8ac4 Change-Id: Iaf3fe40ca138a8bff0e15d81cc9b04c0d2350853
* Merge "Ensure that `flags=` output in ParserTestRunner is more complete"jenkins-bot2022-08-221-1/+5
|\
| * Ensure that `flags=` output in ParserTestRunner is more completeC. Scott Ananian2022-07-281-1/+5
| | | | | | | | | | | | | | | | | | | | In particular, there was a test of __NEWSECTIONLINK__ added by 4e717c01589378893c98e333884315c166c217b3 (way back when) which seemed to be intended to check that the appropriate ParserOutputFlag was set, but that output flag was never included in the `flags=` parser test output. Address that to improve coverage. Change-Id: Iccd80e63e9fd724bf7dfb7f243f823a2b9f9915d
* | Add markup to page titles to distinguish the namespace and the main textBartosz Dziewoński2022-08-161-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pages outside of the main namespace now have the following markup in their <h1> page titles, using 'Talk:Hello' as an example: <h1> <span class="mw-page-title-namespace">Talk</span> <span class="mw-page-title-separator">:</span> <span class="mw-page-title-main">Hello</span> </h1> (line breaks and spaces added for readability) Pages in the main namespace only have the last part, e.g. for 'Hello': <h1> <span class="mw-page-title-main">Hello</span> </h1> The change is motivated by a desire to style the titles differently on talk pages in the DiscussionTools extension (T313636), but it could also be used for other things: * Language-specific tweaks (e.g. adding typographically-correct spaces around the colon separator: T249149, or replacing it with a different character: T36295) * Site-specific tweaks (e.g. de-emphasize or emphasize specific namespaces like 'Draft': T62973 / T236215) The markup is also added to automatically language-converted titles. It is not added when the title is overridden using the wikitext `{{DISPLAYTITLE:…}}` or `-{T|…}-` forms. I think this is a small limitation, as those forms mostly used in the main namespace, where the extra markup isn't very helpful anyway. This may be improved in the future. As a workaround, users could also just add the same HTML markup to their wikitext (as those forms accept it). It is not also added when the title is overridden by an extension like Translate. Maybe we'll have a better API before anyone wants to do that. If not, one could un-mark Parser::formatPageTitle() as @internal, and use that method to add the markup themselves. Bug: T306440 Change-Id: I62b17ef22de3606d736e6c261e542a34b58b5a05
* | parser: Prepare to use a <meta> tag for the internal TOC_PLACEHOLDERC. Scott Ananian2022-08-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Split out from the I44045b3b9e78e and Ie63eed07b9bca changes. We first add code to handle the new tag as well as the old tag in ParserCache contents. This will allow us to safely rollback if needed when deploying the follow-on patch which actually changes the tag used. Bug: T287767 Bug: T270199 Bug: T311502 Change-Id: Ib3e5e010b9f5ca2c4ea7c4fe28080170b6a88812
* | tests: Update parser test after i18n changeUmherirrender2022-08-051-1/+1
| | | | | | | | | | Follow-Up: Ie0ce427238412d3badb247d2e2fae9bc9f57fbeb Change-Id: Id40ffd53a4dbc14d9c9f33c3962035698d1a80e1
* | Improve parser tests for {{REVISIONTIMESTAMP}} and {{REVISIONUSER}}C. Scott Ananian2022-08-041-1/+77
|/ | | | | | | | Clarify the distinction between "not yet created" (but currently being parsed) and "not existing", and how the parser output varies for these cases. Change-Id: I669f1e0adcef1071868afc31d84919633c1c4866
* ParserOutputFlags: change HIDE_TOC to SHOW_TOCC. Scott Ananian2022-07-271-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When I implemented the ParserOutput merge logic in OutputPage (I0909ac85c6c785d9089b077a16923c61d6a09996) I realized that consistent "combine with OR" merge logic for the TOC flag is obtained only if we invert the flag; that is, the existing code showed a TOC *if any ParserOutput contained a shown TOC* otherwise the TOC was hidden. I'd originally implemented this in I35e199cca40c0e4359ac493e5806dcf4ae49321c with the opposite sense in order to avoid having to wait for ParserCache contents to expire: since the default on most pages was to have the TOC shown anyway, if "out of date" parser cache entries were missing a HIDE_TOC flag, it wouldn't be a big deal, whereas if a SHOW_TOC flag were required then upon deploy all cached pages would lose their TOC rendering. BUT a better solution is just to let a "parser cache expiration time" elapse between the time we start generating this flag and the time we start using it. The existing patch to export this (I6cf76c870124c162dc1bcbc2f7e9ca0c5fdcd10e) uses ParserOutput::getTOCHTML() anyway, so we can just wait to switch this over to use the SHOW_TOC flag (I10c3d06fb162103c06395bf9d1d27ac3c199d7b6) until the parser cache has expired. Anyway, this is a bit of a hassle to switch now, but I think having consistent merge semantics for ParserOutput flags is worth the short-term pain. Bug: T310083 Change-Id: I3b76010f1e2283add629b84bf3824f215f932903
* Sync up with Parsoid parserTests.txtC. Scott Ananian2022-07-271-12/+12
| | | | | | This now aligns with Parsoid commit 6488f4ff1c95990bef9dfc15e54c7646b8c8c8f6 Change-Id: Idfd7d49c78c1f3a23bd06809ae99d1d34c611479
* Sync up with Parsoid parserTests.txtIsabelle Hurbain-Palatin2022-07-271-77/+144
| | | | | | This now aligns with Parsoid commit a4596c2b39f9c5609ff9f717e8086bb597af0c09 Change-Id: I97b00e55b83a6a7dffd97cfa512c29e4c9efb0b9
* ParserOption/ParserOutput flag to suppress or hide the table of contentsC. Scott Ananian2022-07-211-12/+204
| | | | | | | | | | | | | | | | | | | | | There are two related issues here: first, when parsing non-wikitext pages for side effects (categories, etc) we want to ensure that any spurious `===` or `<h2>` on the page don't create nonsense "sections". We introduce a ParserOption to suppress the ToC in this case; a follow-up patch will set this parser option from the correct path in CodeContentHandler and its subclasses. [T307691] Second, modern skins can generate the ToC on-the-fly outside the content area, and need to be able to regenerate the ToC from API output when the page is edited. A ParserOutput flag is added to mirror the $enoughToc variable from the parser to indicate whether or not the ToC should be generated and/or updated after edit. (See I6cf76c870124c162dc1bcbc2f7e9ca0c5fdcd10e for parallel code to echo this value in ApiParse.) Bug: T294950 Bug: T307691 Change-Id: I35e199cca40c0e4359ac493e5806dcf4ae49321c
* Sync up with Parsoid parserTests.txtSubramanya Sastry2022-07-141-36/+114
| | | | | | This now aligns with Parsoid commit 58f62d4a52d909e9719dcb2c9bc69bc4e4e3bfd7 Change-Id: I8793a6363cb8680b50f0910bb85d3c0f7ef8c013