Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4049329
parse.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
parse.js
View Options
(
function
()
{
Object
.
assign
(
mw
.
Api
.
prototype
,
/** @lends mw.Api.prototype */
{
/**
* Convenience method for 'action=parse'.
*
* @param {string|mw.Title} content Content to parse, either as a wikitext string or
* a mw.Title.
* @param {Object} additionalParams Parameters object to set custom settings, e.g.
* `redirects`, `sectionpreview`. `prop` should not be overridden.
* @return {jQuery.Promise<string>} Promise that resolves with the parsed HTML of `wikitext`
*/
parse
:
function
(
content
,
additionalParams
)
{
const
config
=
Object
.
assign
(
{
formatversion
:
2
,
action
:
'parse'
,
// Minimize the JSON we get back, there is no way to access anything else anyway
prop
:
'text'
,
contentmodel
:
'wikitext'
},
additionalParams
);
let
apiPromise
;
if
(
mw
.
Title
&&
content
instanceof
mw
.
Title
)
{
// Parse existing page
config
.
page
=
content
.
getPrefixedDb
();
apiPromise
=
this
.
get
(
config
);
}
else
{
// Parse wikitext from input
config
.
text
=
String
(
content
);
apiPromise
=
this
.
post
(
config
);
}
return
apiPromise
.
then
(
(
data
)
=>
data
.
parse
.
text
)
.
promise
(
{
abort
:
apiPromise
.
abort
}
);
}
}
);
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 15 2026, 15:26 (13 w, 8 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
27/8e/17a2a9749009fc2a9a2f79c3b45d
Default Alt Text
parse.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment