Show:

Methods

(static) dataMwContentType(outputContentVersion)

Return the appropriate content-type string for a data-mw JSON blob.

Return the appropriate content-type string for a data-mw JSON blob.

Parameters:
Name Type Description
outputContentVersion string
Source:

(static) dataParsoidContentType(outputContentVersion)

Return the appropriate content-type string for a data-parsoid JSON blob.

Return the appropriate content-type string for a data-parsoid JSON blob.

Parameters:
Name Type Description
outputContentVersion string
Source:

(static) doDowngrade(downgrade, metricsopt, env, revision, version) → {Object}

Downgrade content

.

Downgrade content

Parameters:
Name Type Attributes Description
downgrade Object
metrics Object <optional>
env MWParserEnvironment
revision Object
version string
Source:
Returns:
Type
Object

(static) errorHandler(env, err)

Generic error response handler.

Generic error response handler.

Parameters:
Name Type Description
env MWParserEnvironment
err Error
Source:

(static) errorResponse(res, text, statusopt)

Error response.

Error response.

Parameters:
Name Type Attributes Description
res Response

The response object from our routing function.

text string
status number <optional>
Source:

(static) errorWrapper(env, promiseOrValue)

Wrap a promised value with a catch that invokes #errorHandler.

Wrap a promised value with a catch that invokes #errorHandler.

Parameters:
Name Type Description
env MWParserEnvironment
promiseOrValue Promise | any
Source:

(static) extractPageBundle(revision) → {Object}

Extracts a pagebundle from a revision.

Extracts a pagebundle from a revision.

Parameters:
Name Type Description
revision Object
Source:
Returns:
Type
Object

(static) fatalRequest(env, text, httpStatusopt)

Log a fatal/request.

Log a fatal/request.

Parameters:
Name Type Attributes Description
env MWParserEnvironment
text string
httpStatus number <optional>
Source:

(static) findDowngrade(from, to) → {Object|undefined}

Is this a transition we know how to handle?

.

Is this a transition we know how to handle?

Parameters:
Name Type Description
from string
to string
Source:
Returns:
Type
Object | undefined

(static) htmlContentType(outputContentVersion)

Return the appropriate content-type string for Parsoid HTML.

Return the appropriate content-type string for Parsoid HTML.

Parameters:
Name Type Description
outputContentVersion string
Source:

(static) htmlResponse(res, body, statusopt, headersopt, omitEscapeopt)

Send an html response, but only if response hasn't been sent.

Send an html response, but only if response hasn't been sent.

Parameters:
Name Type Attributes Description
res Response

The response object from our routing function.

body string
status number <optional>

HTTP status code.

headers Object <optional>

HTTP headers to include.

Properties
Name Type Attributes Description
content-type string <optional>

A more specific type to use.

content-language string <optional>

Content language of response.

vary string <optional>

Vary header contents.

omitEscape boolean <optional>

Be explicit about omitting escaping.

Source:

(static) jsonResponse(res, json, statusopt, contentTypeopt)

Send a JSON response, but only if response hasn't been sent.

Send a JSON response, but only if response hasn't been sent.

Parameters:
Name Type Attributes Description
res Response

The response object from our routing function.

json Object
status number <optional>

HTTP status code.

contentType string <optional>

A more specific type to use.

Source:

(static) pagebundleContentType(outputContentVersion)

Return the appropriate content-type string for a Parsoid page bundle.

Return the appropriate content-type string for a Parsoid page bundle.

Parameters:
Name Type Description
outputContentVersion string
Source:

(static) parseProfile(profile, format) → {Object|null}

Used to extract the format and content version from a profile.

Used to extract the format and content version from a profile.

Parameters:
Name Type Description
profile string
format string

Just used for backwards compatibility w/ <= 1.2.0 where the pagebundle didn't have a spec.

Source:
Returns:
Type
Object | null

(static) plainResponse(res, text, statusopt, contentTypeopt)

Send a plaintext response, but only if response hasn't been sent.

Send a plaintext response, but only if response hasn't been sent.

Parameters:
Name Type Attributes Description
res Response

The response object from our routing function.

text string
status number <optional>

HTTP status code.

contentType string <optional>

A more specific type to use.

Source:

(static) redirectToOldid(req, res)

Generate an HTTP redirect to a specific revision.

Generate an HTTP redirect to a specific revision.

Parameters:
Name Type Description
req Request
res Response
Source:

(static) relativeRedirect(res, path, httpStatusopt)

Send a redirect response with optional code and a relative URL.

Send a redirect response with optional code and a relative URL.

Parameters:
Name Type Attributes Description
res Response

The response object from our routing function.

path string
httpStatus number <optional>
Source:

(static) renderResponse(res, view, locals)

Render response, but only if response hasn't been sent.

Render response, but only if response hasn't been sent.

Parameters:
Name Type Description
res Response

The response object from our routing function.

view string
locals Object
Source:

(static) returnDowngrade(downgrade, metricsopt, env, revision, res, contentmodelopt)

Downgrade and return content

.

Downgrade and return content

Parameters:
Name Type Attributes Description
downgrade Object
metrics Object <optional>
env MWParserEnvironment
revision Object
res Response
contentmodel string <optional>
Source:

(static) setHeader(res, field, value)

Set header, but only if response hasn't been sent.

Set header, but only if response hasn't been sent.

Parameters:
Name Type Description
res Response

The response object from our routing function.

field string
value string
Source:

(static) shouldScrub() → {boolean}

...
Source:
Returns:
Type
boolean

(static) substTopLevelTemplates(env, target, wt)

To support the 'subst' API parameter, we need to prefix each top-level template with 'subst'.

To support the 'subst' API parameter, we need to prefix each top-level template with 'subst'. To make sure we do this for the correct templates, tokenize the starting wikitext and use that to detect top-level templates. Then, substitute each starting '{{' with '{{subst' using the template token's tsr.

Parameters:
Name Type Description
env MWParserEnvironment
target string
wt string
Source:

(static) validateAndSetOutputContentVersion(res, acceptableTypes) → {boolean}

Set the content version to an acceptable version.

Set the content version to an acceptable version. Returns false if Parsoid is unable to supply one.

Parameters:
Name Type Description
res Response
acceptableTypes Array
Source:
Returns:
Type
boolean

(static) validatePageBundle(pb, originalVersion)

Validates the pagebundle was provided in the expected format.

Validates the pagebundle was provided in the expected format.

Parameters:
Name Type Description
pb Object
originalVersion string
Source:

(static) versionFromType(html) → {string|null}

Determine the content version from the html's content type.

Determine the content version from the html's content type.

Parameters:
Name Type Description
html Object
Source:
Returns:
Type
string | null

(static) wikitextContentType(env)

Return the appropriate content-type string for wikitext.

Return the appropriate content-type string for wikitext.

Parameters:
Name Type Description
env MWParserEnvironment
Source:

(static) wt2htmlRes(res, html, pb, contentmodelopt, headers, outputContentVersion)

Send an appropriate response with the right content types for wt2html.

Send an appropriate response with the right content types for wt2html.

Parameters:
Name Type Attributes Description
res Object
html string
pb Object
contentmodel string <optional>
headers Object
outputContentVersion string
Source:

(inner) downgrade999to2(doc, pb)

Downgrade content from 999.x to 2.x.

Downgrade content from 999.x to 2.x.

Parameters:
Name Type Description
doc Document
pb Object
Source: