Mixing Handlers with Helpers doesn't look nice for consistency
reasons. Helpers should be in their own place (grouped) in the
Handlers directory as they're really "helpers for the handlers".
Change-Id: Ieeb7a0a706a4cb38778f312bfbfe781a1f366d14
Pages with content models not supported by Parsoid before already
had dummy parser output written to PC but we still got an internal
server error because the output didn't have a render key.
This patch fixes the issue and when we try to render page with
unsupported content models, we get the dummy parser outputs.
Bug: T311728
Change-Id: I49ebbfc0475fb296f2a906ce7dce237641fb375b
The motivation is to restore parsoid support for the content models
defined in the Proofread extension.
Bug: T246403
Change-Id: I33d269e42fede28139f7c923504326a77d11ee13
If HtmlOutputRendererHelper can't produce output because the page
doesn't exist, don't crash. Return a 404 instead.
Bug: T325205
Change-Id: I6a713025e2eb447ed61de8949c820bd9cda7594e
Logging linter data should be enabled automatically by
HtmlOutputRendererHelper.
This change enables linting data for requests coming in via the
v1/page/{title}/html endpoint.
Change-Id: Idafd29784ec712547e36fea88a8c159784b97f2b
The previous attempt at restoring call to the ParserLogLinterData hook
had the undesirable effect of bypassing parser cache. This change
optionally enables the call to the lind data hook without disabling
parser cache.
This patch us working under the assumption that we only need to log lint
data for canonical parses.
Follow-Up to I1f69498ef75
Change-ID: I39ab54ca6e9f9a6a58b59cdd6feea07638fc908f
getRevisionId is documented to return 0 for fake revisions, but it was
returning 0 for the current revision as well. This patch makes a clear
distinction, with 0 meaning current (like elsewhere in the code), and
null meaning a fake revision.
This patch includes a fix for redirect handling in ParsoidHandler::wt2html.
This fix is needed here because it previously relied on getRevisionId()
to return the actual revision ID; this would fail, since getRevisionId()
will return 0 when the current revision of a page is requested.
Change-Id: I33d1ab54023c6ac96c6bb5e4750b980e381cb464
The test cases getETag and getLastModified where checking the method's
return values against themselves.
Change-Id: I13c5abfdd07373795ca9b661d812ec0eed11f766
Fixes the reason for reverting Ie430acd0753880d88370bb9f22bb40a0f9ded917:
The issue was that with my patch, the transform/wikitext/to/html started
ignoring the offsetType field in the body. So the offsetType used in the
response (or stashed data) would always be 'byte'.
But the roundtrip-test.js scripts requests 'ucs2'.
This causes an error when sending the HTML and data-parsoid back to
transform/html/to/wikitext, again with offsetType:'ucs2': the offsetType
embededed in data-parsoid will be byte, and the mismatch causes a 400
to be returned. This broke the roundtrip-test.js script.
The fix is to no ignore the offsetType specified in the request body.
Change-Id: Ief721c23ed9a57d781cfdac625a62113f22f87a5
This adds support for an "edit" flavor to HtmlOutputRendererhelper,
which causes data-parsoid attributes to be present in the HTML output.
In addition, this adds the ability to request HTML output using a
specific profile versionThis adds support for an "edit" flavor to
HtmlOutputRendererhelper, which causes data-parsoid attributes to be
present in the HTML output.
In addition, this adds the ability to request HTML output using a
specific profile version..
Change-Id: I5c21e0358da6a8915ddfe574fb2d13e469f625c5
REST helper objects should be geared towards accepting input directly
from an HTTP request. As such, they should offer setters that take
string values. And native representation of things like page titles,
languages, or content objects should be done implicitly by the helper.
Change-Id: I9b81cad4d5cc575e7c5283035e385ac0457e8059
When visual editor switches from source mode to visual mode, we need to
stash the wikitext. Otherwise, we later lack the proper context to
convert the modified HTML back to wikitext.
Bug: T321862
Change-Id: Id611e6e022bf8d9d774ca1a3a214220ada713285
* We will have several kinds of HTML transformations.
Rename HTMLTransform to indicate that its for converting HTML to Content
objects.
* Using Naming Convention 'Html' instead of 'HTML'
Change-Id: I506f3303ae8f9e4db17299211366bef1558f142c
Variant conversion is based on the Accept-Language header. Updated
the HtmlOutputRendererHelper to set the HTTP headers related to
variant conversion.
Bug: T317019
Change-Id: I5e11452f1c531a757e8d860f9c727b5810406bce
This adds setters to HtmlOutputRendererHelper which allow it to be used
more conveniently in different contexts. This is aimed specifically at
making it easier for DirectParsoidClient in the VisualEditor extension
to re-use this code.
NOTE: HtmlOutputRendererHelper is declared @unstable, but the changes in
this patch need to be backwards compatible at least temporarily, to
allow the VisualEditor extension to be updated in a follow-up.
Change-Id: I18c8bc6f5aa7c204f0faa56919bfe64026761bd4
This is needed by VE when performing Wikitext -> HTML transformation
during editing.
Also, this patch introduces the new flavor: fragment, that is passed in
via $envOptions to activate VisualEditor's body only mode functionality.
NOTE: This patch also fixes a PHPUnit test that broke by correctly
injecting the appropriate parsoid instance for checking error handling.
Bug: T308743
Change-Id: I838a3b05d7d8523a469236cf112158349063283c
We need the output content language when fetching HTML in VE
so this needs to match whatever parsoid gives us. In order for
this to happen, we need to loop in more data to the parser output
after parsing. This patch adds that more relevant data and
exposes it via a public method: `getHtmlOutputContentLanguage()`
In addition, this patch fixes a bug that was introduced in the
PageBundleParserOutputConverterTest when setting extension data
on parser output (L#64).
Follow-up: I33076c359ee45719c1c4ef63f77c1f1285951d0c (test fix)
Change-Id: I06bf9f575ed5a2521cf4b2c42fc6e0e7faab6bc0
In Ie87f823e721ed5ae9d49cf7ead8e77cbef254cd7, we changed the signature
of `parse()` to accept a PageIdentity instead of PageRecord and it broke
some tests in other places, specifically: HtmlOutputRendererHelperTest,
so this patch fixes the interfaces.
Change-Id: I35685412c52f7d4ae9e63960695e686fb2bb9b21
Move code to create ParserOutput from PageBundle and vice versa to a
separate final class. An final class was used instead of a trait
because traits do not support constants for PHP version < 8.2.
The plan is to use this final class in various interfaces in order
to avoid exposing them to Parsoid concepts.
Bug: T317019
Change-Id: I33076c359ee45719c1c4ef63f77c1f1285951d0c
NOTE: stats key has been updated to reflect this change so we'll
no longer get data on the "parsoidhtmlhelper..." key after this
is deployed.
Change-Id: I599b1fd22c2d962b57e80beb84fe6f3a335f488c
2022-09-06 10:30:55 +01:00
Renamed from tests/phpunit/integration/includes/Rest/Handler/ParsoidHTMLHelperTest.php (Browse further)