Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4095354
mediawiki.jqueryMsg.peg
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
mediawiki.jqueryMsg.peg
View Options
/*
PEG
grammar
for
a
subset
of
wikitext,
useful
in
the
MediaWiki
frontend
*/
start
=
e
:
expression
*
{
return
e.length
>
1
?
[
"CONCAT"
]
.
concat
(
e
)
:
e
[
0
]
;
}
expression
=
template
/
link
/
extlink
/
replacement
/
literal
paramExpression
=
template
/
link
/
extlink
/
replacement
/
literalWithoutBar
template
=
"{{"
t
:
templateContents
"}}"
{
return
t;
}
templateContents
=
twr
:
templateWithReplacement
p
:
templateParam
*
{
return
twr.concat
(
p
)
}
/
twr
:
templateWithOutReplacement
p
:
templateParam
*
{
return
twr.concat
(
p
)
}
/
twr
:
templateWithOutFirstParameter
p
:
templateParam
*
{
return
twr.concat
(
p
)
}
/
t
:
templateName
p
:
templateParam
*
{
return
p.length
?
[
t, p
]
:
[
t
]
}
templateWithReplacement
=
t
:
templateName
":"
r
:
replacement
{
return
[
t, r
]
}
templateWithOutReplacement
=
t
:
templateName
":"
p
:
paramExpression
{
return
[
t, p
]
}
templateWithOutFirstParameter
=
t
:
templateName
":"
{
return
[
t, ""
]
}
templateParam
=
"|"
e
:
paramExpression
*
{
return
e.length
>
1
?
[
"CONCAT"
]
.
concat
(
e
)
:
e
[
0
]
;
}
templateName
=
tn
:
[
A-Za-z_
]
+
{
return
tn.join
(
''
)
.
toUpperCase
()
}
/*
TODO
:
Update
to
reflect
separate
piped
and
unpiped
handling
*/
link
=
"[["
w
:
expression
"]]"
{
return
[
'WLINK', w
]
;
}
extlink
=
"["
url
:
url
whitespace
text
:
expression
"]"
{
return
[
'LINK', url, text
]
}
url
=
url
:
[
^
]
+
{
return
url.join
(
''
)
;
}
whitespace
=
[
]
+
replacement
=
'$'
digits
:
digits
{
return
[
'REPLACE', parseInt( digits, 10 ) - 1
]
}
digits
=
[
0-9
]
+
literal
=
lit
:
escapedOrRegularLiteral
+
{
return
lit.join
(
''
)
;
}
literalWithoutBar
=
lit
:
escapedOrLiteralWithoutBar
+
{
return
lit.join
(
''
)
;
}
escapedOrRegularLiteral
=
escapedLiteral
/
regularLiteral
escapedOrLiteralWithoutBar
=
escapedLiteral
/
regularLiteralWithoutBar
escapedLiteral
=
"\\"
escaped
:
.
{
return
escaped;
}
regularLiteral
=
[
^{}\[\
]
$\\
]
regularLiteralWithoutBar
=
[
^{}\[\
]
$\\
|
]
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 18, 13:50 (4 w, 9 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
13/59/2da16dfaafb001a1771b64f9e4a0
Default Alt Text
mediawiki.jqueryMsg.peg (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment