Methods
(static) dataMwContentType(outputContentVersion)
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.
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.
Parameters:
Name | Type | Description |
---|---|---|
env |
MWParserEnvironment | |
err |
Error |
- Source:
(static) errorResponse(res, text, statusopt)
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.
Parameters:
Name | Type | Description |
---|---|---|
env |
MWParserEnvironment | |
promiseOrValue |
Promise | any |
- Source:
(static) extractPageBundle(revision) → {Object}
(static) fatalRequest(env, text, httpStatusopt)
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.
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.
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
|
||||||||||||||||
omitEscape |
boolean |
<optional> |
Be explicit about omitting escaping. |
- Source:
(static) jsonResponse(res, json, statusopt, contentTypeopt)
(static) pagebundleContentType(outputContentVersion)
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.
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.
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)
(static) relativeRedirect(res, path, httpStatusopt)
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)
(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.
Parameters:
Name | Type | Description |
---|---|---|
res |
Response | The response object from our routing function. |
field |
string | |
value |
string |
- Source:
(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}
(static) validatePageBundle(pb, originalVersion)
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.
Parameters:
Name | Type | Description |
---|---|---|
html |
Object |
- Source:
Returns:
- Type
-
string
|
null
(static) wikitextContentType(env)
Return the appropriate content-type string for wikitext.
Parameters:
Name | Type | Description |
---|---|---|
env |
MWParserEnvironment |
- Source: