[ 'class' => ExtractBody::class, 'services' => [ 'UrlUtils', ], 'optional_services' => [ 'MobileFrontend.Context', ], ], 'AddRedirectHeader' => [ 'class' => AddRedirectHeader::class, ], 'RenderDebugInfo' => [ 'class' => RenderDebugInfo::class, 'services' => [ 'HookContainer', ], ], 'ParsoidLocalization' => [ 'class' => ParsoidLocalization::class, ], 'ExecutePostCacheTransformHooks' => [ 'class' => ExecutePostCacheTransformHooks::class, 'services' => [ 'HookContainer', ], ], 'AddWrapperDivClass' => [ 'class' => AddWrapperDivClass::class, 'services' => [ 'LanguageFactory', 'ContentLanguage', ], ], 'HandleSectionLinks' => [ 'class' => HandleSectionLinks::class, 'services' => [ 'TitleFactory', ], ], 'HandleParsoidSectionLinks' => [ 'class' => HandleParsoidSectionLinks::class, 'services' => [ 'TitleFactory', ], ], 'HandleTOCMarkers' => [ 'class' => HandleTOCMarkers::class, 'services' => [ 'Tidy', ], ], 'DeduplicateStyles' => [ 'class' => DeduplicateStyles::class, ], 'ExpandToAbsoluteUrls' => [ 'class' => ExpandToAbsoluteUrls::class, ], 'HydrateHeaderPlaceholders' => [ 'class' => HydrateHeaderPlaceholders::class, ], ]; public function __construct( ServiceOptions $options, Config $config, LoggerInterface $logger, ObjectFactory $objectFactory ) { $options->assertRequiredOptions( self::CONSTRUCTOR_OPTIONS ); $this->options = $options; $this->config = $config; $this->logger = $logger; $this->objectFactory = $objectFactory; } /** * Creates a pipeline of transformations to transform the content of the ParserOutput object from "parsed HTML" * to "output HTML" and returns it. * @internal * @return OutputTransformPipeline */ public function buildPipeline(): OutputTransformPipeline { // Add extension stages $list = array_merge( self::CORE_LIST, $this->options->get( MainConfigNames::OutputPipelineStages ) ); $otp = new OutputTransformPipeline(); foreach ( $list as $spec ) { $class = $spec['class']; $svcOptions = new ServiceOptions( $class::CONSTRUCTOR_OPTIONS, $this->config ); $transform = $this->objectFactory->createObject( $spec, [ 'assertClass' => OutputTransformStage::class, 'extraArgs' => [ $svcOptions, $this->logger ], ] ); $otp->addStage( $transform ); } return $otp; } }