aboutsummaryrefslogtreecommitdiffstats
path: root/includes/OutputTransform/OutputTransformPipeline.php
Commit message (Collapse)AuthorAgeFilesLines
* Namespace all remaining classes in includes/parserJames D. Forrester2024-10-151-1/+1
| | | | | Bug: T353458 Change-Id: If02cc9b1ff78e26c1cf8c91ee4695845eb133829
* Introduce runOutputPipeline and clone by defaultIsabelle Hurbain-Palatin2024-09-061-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the third patch of a series of patches to remove ParserOutput::getText() calls from core. This series of patches should be functionally equivalent to I2b4bcddb234f10fd8592570cb0496adf3271328e. Here we temporarily introduce runOutputPipeline in ParserOutput. It creates and runs the pipeline with default options, and is called by getText. (This is not entirely truthful because we go through a runPipelineInternal transient method for null-argument-passing reasons, but let's not over-complicate this commit message.) getText is responsible for maintaining the current behaviour, that is "disallow the cloning of the ParserOutput and putting text back to as it was" to mitigate T353257. As we get rid of getText, this behaviour should be moved, if necessary, to the caller site. The new method is currently added to ParserOutput so that further refactorings are, for the moment, simpler. It will eventually be moved to another place within the Content framework. We also rename 'suppressClone' to 'allowClone' (which is actually its negation) to avoid multiple levels of negations that make the code confusing. Note that the default value of 'allowClone' is true, and is currently overriden in two places: getText and OutputPage::getParserOutputText (which calls the pipeline directly and not through ParserOutput). Bug: T293512 Bug: T371022 Change-Id: Ibf04af1079aaa1934dc78685b00e636ff4d38a9a
* Ensure that `isParsoidContent` is initialized in OutputTransformPipelineC. Scott Ananian2024-08-261-0/+8
| | | | | | | | | | | | | | The refactorings in I45951a49e57a8031887ee6e4546335141d231c18 replaced calls to ParserOutput::getText() with direct invocations of the pipeline, including in OutputPage::getParserOutputText(). However, the direct invocation skipped the implicit initialization of the options array previously done in ParserOutput::getText(). Ensure that the options array gets appropriate default values; in particular 'isParsoidContent' is expected to always be set. Bug: T293512 Bug: T373405 Change-Id: Ib8d540b4221f7c00f6047706c4e3bfd88a2cb8cc
* [OutputTransform] Remove broken and unused 'bodyContentOnly' optionC. Scott Ananian2024-02-151-1/+0
| | | | | | | | | | This was formerly used by the REST api, but instead that code just uses ParserOutput::getRawText() when it needs the full HTML document. This option has been broken, with various passes like RenderDebugInfo and AddWrapperDiv adding content in inappropriate places if bodyContentOnly was false. Change-Id: Ib45f95ded59c81c16d61803f977d1edbfe82b262
* Fix capitalisation of MediaWiki\OutputTransform namespaceReedy2024-01-021-1/+1
| | | | | | | | It was using Mediawiki not MediaWiki Follows-Up: Ibc46c34072eadb3e84f69df49a3a424f3864c952 Follows-Up: I53551ec6d6471569709c71c1155729e550f64de8 Change-Id: Ia37a6330d64c3179d7abc12ec3f6fc7daca2e371
* Namespace ParserOutputJames D. Forrester2023-12-141-1/+1
| | | | | | | Most used non-namespaced class! Bug: T353458 Change-Id: I4c2cbb0a808b3881a4d6ca489eee5d8c8ebf26cf
* ParserOutput::getText(): do not clone ParserOutput when invoking pipelineIsabelle Hurbain-Palatin2023-12-121-3/+12
| | | | | | | | | | | | | | | | | OutputPage::getParserOutputText/addParserOutputContent expects ParserOutput to be mutated (e.g. by PostCacheTransformHookRunner). Hence, cloning it before running the pipeline is breaking DiscussionTools, probably among others. Suppress the clone for the case where the output pipeline is invoked from ParserOutput::getText() (which is a deprecated method anyway) and additionally suppress the side-effects to ParserOutput::$mText on that code path. Bug: T353257 Co-Authored-By: C. Scott Ananian <cananian@wikimedia.org> Co-Authored-By: Isabelle Hurbain-Palatin <ihurbainpalatin@wikimedia.org> Change-Id: I85c690fd37b781cb27c21970467639e852113b2a
* Refactor DefaultOutputTransform into a pipeline of transformsIsabelle Hurbain-Palatin2023-12-081-0/+69
Bug: T348253 Change-Id: I53551ec6d6471569709c71c1155729e550f64de8