diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:12:12 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:12:12 -0400 |
commit | c9aa36da061816dee256a979c2ff8d2ee41824d9 (patch) | |
tree | 29f7002b80ee984b488bd047dbbd80b36bf892e9 /resources/mediawiki/mediawiki.jqueryMsg.peg | |
parent | b4274e0e33eafb5e9ead9d949ebf031a9fb8363b (diff) | |
parent | d1ba966140d7a60cd5ae4e8667ceb27c1a138592 (diff) |
Merge branch 'archwiki'
# Conflicts:
# skins/ArchLinux.php
# skins/ArchLinux/archlogo.gif
Diffstat (limited to 'resources/mediawiki/mediawiki.jqueryMsg.peg')
-rw-r--r-- | resources/mediawiki/mediawiki.jqueryMsg.peg | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/resources/mediawiki/mediawiki.jqueryMsg.peg b/resources/mediawiki/mediawiki.jqueryMsg.peg deleted file mode 100644 index 7879d6fa..00000000 --- a/resources/mediawiki/mediawiki.jqueryMsg.peg +++ /dev/null @@ -1,81 +0,0 @@ -/* 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) } - / 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 ] } - -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 - = [^{}\[\]$\\|] - |