{
"comment": "\n\t\tThis language grammar tries to handle Mediawiki syntax. Mediawiki\n\t\tsyntax is a mess. This grammar will likely never quite work right.\n\t\tThis is unsurprising as Mediawiki itself has never quite worked right.\n\t\t\n\t\t\t\t--Jacob\n\t\t\n\t\tTODO: lots of fixes still to do:\n\t\t\n\t\t 1. Add a bunch of HTML tags. See the #block and #style sections.\n\t\t 3. Correctly scope all the parser functions and their contents.\n\t\t This on will be complicated, as there are several: expr, if, etc.\n\t\t 4. This is probably the biggest one: get all the lists to scope\n\t\t correctly by type of list. Right now we just scope every list\n\t\t as a list, and do not worry about what happens beyond that.\n\t\t Eventually we want to do numbered and unnumbered separately, etc.\n\t\t 5. Get some kind of folding by heading. Maybe it should just fold\n\t\t to the next header, no matter which level it is. Then we can\n\t\t make a contents just by folding everything. Not completely sure\n\t\t\tthis is possible with current TM folding.\n\t\t 7. Make sure that illegal things are correctly scoped illegal.\n\t\t This is non-trivial, and has several parts\n\t\t \n\t\t - Bold/italic are based on brain-dead heuristics. I want to\n\t\t be stricter than Mediawiki on this one. Also, we should\n\t\t scope as illegal when for instance a new heading starts\n\t\t before an italic has been closed.\n\t\t - Templates... these will be pretty tough to do, as they can\n\t\t be so flexible.\n\t\t - \n\t\t\n\t\t 9. tag. I am really not sure this one is\n\t\t worth trying to do\n\t\t10. Figure out a better scope for meta.function-call. Infininight\n\t\t suggests entity.name.function.call, to be paralleled by\n\t\t entity.name.function.definition. I am not completly sure I like\n\t\t that solution, but it is probably better than meta.function-call\n\t\t\n\t\t\n\t\tTODO items not closely related to the grammar:\n\t\t\n\t\t 2. Add a drop command for links/images, add keyboard shortcuts for\n\t\t them too\n\t\t 3. Make sure all the preference items are sorted out, for instance\n\t\t smart typing pairs, indent patterns, etc.\n\t\t 4. Commands to do bold/italic, and maybe things like big/small \n\t\t 5. \n\t\t\n\t\tFINISHED:\n\t\t 2. Add support for LaTeX math mode inside of tags.\n\t\t 1. Add a command for new list item. This one is trivial\n\t\t 6. Get the symbol list working on headings. Trivial.\n\t\t 8. tag. This one adds some complication, but\n\t\t is worth supporting.\n\t\t \n\t",
"fileTypes": [
"mediawiki",
"wikipedia",
"wiki"
],
"foldingStartMarker": "^(=+)",
"foldingStopMarker": "^.*$(?=\\n(=+)|(?!\\n))",
"keyEquivalent": "^~M",
"name": "Mediawiki",
"patterns": [
{
"include": "#block"
},
{
"include": "#inline"
}
],
"repository": {
"block": {
"patterns": [
{
"begin": "^\\s*(?i)(#redirect)",
"beginCaptures": {
"1": {
"name": "keyword.control.redirect.mediawiki"
}
},
"end": "\\n",
"name": "meta.redirect.mediawiki",
"patterns": [
{
"include": "#link"
}
]
},
{
"match": "^=+\\s*$",
"name": "markup.heading.mediawiki"
},
{
"begin": "^(=+)(?=.*\\1\\s*$)",
"comment": "\n\t\t\t\t\t\tThis matches lines which begin and end with some\n\t\t\t\t\t number of \u201c=\u201d marks. If they are mismatched, then\n\t\t\t\t\t interior \u201c=\u201d marks will be treated as invalid.\n\t\t\t\t ",
"end": "\\1\\s*$\\n?",
"name": "markup.heading.mediawiki",
"patterns": [
{
"match": "(?<=^=|^==|^===|^====|^=====|^======)=+|=(?==*\\s*$)",
"name": "invalid.illegal.extra-equals-sign.mediawiki"
},
{
"include": "#inline"
}
]
},
{
"comment": "\n\t\t\t\t\t\tA separator is made up of 4 or more -s alone on a\n\t\t\t\t\t\tline by themselves.\n\t\t\t\t\t",
"match": "^-{4,}[ \\t]*($\\n)?",
"name": "meta.separator.mediawiki"
},
{
"begin": "^ (?=\\s*\\S)",
"comment": "\n\t\t\t\t\t\tCode blocks start with one space. Wiki text and\n\t\t\t\t\t\thtml are still interpreted in MediaWiki, unlike in\n\t\t\t\t\t\tmediawiki.\n\t\t\t\t\t",
"end": "^(?=[^ ])",
"name": "markup.raw.block.mediawiki",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "^([#*:;])",
"comment": "\n\t\t\t\t\t\tThis is preliminary. Eventually it would be nice\n\t\t\t\t\t\tto scope each type of list differently, and even to\n\t\t\t\t\t\tdo scopes of nested lists. There are 4 main things\n\t\t\t\t\t\twhich will be scoped as lists:\n\t\t\t\t\t\t\n\t\t\t\t\t\t - numbered lists (#)\n\t\t\t\t\t\t - unnumbered lists (*)\n\t\t\t\t\t\t - definition lists (; :)\n\t\t\t\t\t\t - indented paragraphs, as used on talk pages (:)\n\t\t\t\t\t\t\n\t\t\t\t\t\tthis last one might not even be scoped as a list in\n\t\t\t\t\t\tthe ideal case. It is fine as a list for now,\n\t\t\t\t\t\thowever.\n\t\t\t\t\t",
"end": "^(?!\\1)",
"name": "markup.list.mediawiki",
"patterns": [
{
"include": "#inline"
}
]
},
{
"include": "#table"
},
{
"include": "#comments"
},
{
"begin": "^(?![\\t ;*#:=]|----|$)",
"comment": "\n\t\t\t\t\t\tAnything that is not a code block, list, header, etc.\n\t\t\t\t\t\tis a paragraph.\n\t\t\t\t\t",
"end": "^(?:\\s*$|(?=[;*#:=]|----))",
"name": "meta.paragraph.mediawiki",
"patterns": [
{
"include": "#inline"
}
]
}
]
},
"block_html": {
"comment": "\n\t\t\t\tThe available block HTML tags supported are:\n\t\t\t\t\n\t\t\t\t * blockquote, center, pre, div, hr, p\n\t\t\t\t * tables: table, th, tr, td, caption\n\t\t\t\t * lists: ul, ol, li\n\t\t\t\t * definition lists: dl, dt, dd\n\t\t\t\t * headers: h1, h2, h3, h4, h5, h6\n\t\t\t\t * br\n\t\t\t",
"patterns": [
{
"begin": "()",
"patterns": [
{
"include": "text.tex.math"
}
]
},
{
"begin": "([)",
"captures": {
"1": {
"name": "meta.tag.inline.ref.mediawiki"
}
},
"contentName": "meta.reference.content.mediawiki",
"end": "(])",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "()",
"captures": {
"1": {
"name": "meta.tag.inline.ref.mediawiki"
}
},
"contentName": "meta.gallery.mediawiki",
"end": "()",
"patterns": [
{
"begin": "(?x)\n\t\t\t\t\t\t\t\t^(?!\\s*\\n)\t\t\t\t# not an empty line\n\t\t\t\t\t\t\t\t( [ ]*(((i|I)mage)(:)) # spaces, image, colon\n\t\t\t\t\t\t\t\t ([^\\[\\]|]+) # anything\n\t\t\t\t\t\t\t\t (?",
"name": "comment.block.html.mediawiki",
"patterns": [
{
"match": "--",
"name": "invalid.illegal.bad-comments-or-CDATA.html.mediawiki"
}
]
}
]
},
"entities": {
"comment": "\n\t\t\t\tMediawiki supports Unicode, so these should not usually be\n\t\t\t\tnecessary, but they do show up on pages from time to time.\n\t\t\t",
"patterns": [
{
"match": "&([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+);",
"name": "constant.character.entity.html.mediawiki"
},
{
"match": "&",
"name": "invalid.illegal.bad-ampersand.html.mediawiki"
}
]
},
"inline": {
"patterns": [
{
"captures": {
"1": {
"name": "constant.other.date-time.mediawiki"
},
"2": {
"name": "invalid.illegal.too-many-tildes.mediawiki"
}
},
"match": "(~~~~~)(~{0,2})(?!~)"
},
{
"comment": "3 ~s for sig, 4 for sig + timestamp",
"match": "~~~~?",
"name": "constant.other.signature.mediawiki"
},
{
"include": "#link"
},
{
"include": "#style"
},
{
"include": "#template"
},
{
"include": "#block_html"
},
{
"include": "#comments"
}
]
},
"link": {
"patterns": [
{
"applyEndPatternLast": 1,
"begin": "(?x:\n\t\t\t\t\t\t(\\[\\[) # opening brackets\n\t\t\t\t\t\t ( [ ]*(((i|I)mage)(:)) # spaces, image, colon\n\t\t\t\t\t\t ([^\\[\\]|]+) # anything\n\t\t\t\t\t\t (?)",
"captures": {
"1": {
"name": "meta.tag.inline.bold.html.mediawiki"
}
},
"contentName": "markup.bold.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "(<(i|em)>)",
"captures": {
"1": {
"name": "meta.tag.inline.italic.html.mediawiki"
}
},
"contentName": "markup.italic.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "(<(s|strike)>)",
"captures": {
"1": {
"name": "meta.tag.inline.strikethrough.html.mediawiki"
}
},
"contentName": "markup.other.strikethrough.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "(<(u)>)",
"captures": {
"1": {
"name": "meta.tag.inline.underline.html.mediawiki"
}
},
"contentName": "markup.underline.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "(<(tt|code)>)",
"captures": {
"1": {
"name": "meta.tag.inline.raw.html.mediawiki"
}
},
"contentName": "markup.raw.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "(<(big|small|sub|sup)>)",
"captures": {
"1": {
"name": "meta.tag.inline.any.html.mediawiki"
}
},
"contentName": "markup.other.inline-styles.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#inline"
}
]
}
]
},
"style_in_link": {
"patterns": [
{
"begin": "'''",
"end": "'''",
"name": "markup.bold.mediawiki",
"patterns": [
{
"include": "#style_in_link"
}
]
},
{
"begin": "''",
"end": "''",
"name": "markup.italic.mediawiki",
"patterns": [
{
"include": "#style_in_link"
}
]
},
{
"begin": "(<(b|strong)>)",
"captures": {
"1": {
"name": "meta.tag.inline.bold.html.mediawiki"
}
},
"contentName": "markup.bold.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#style_in_link"
}
]
},
{
"begin": "(<(i|em)>)",
"captures": {
"1": {
"name": "meta.tag.inline.italic.html.mediawiki"
}
},
"contentName": "markup.italic.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#style_in_link"
}
]
},
{
"begin": "(<(s|strike)>)",
"captures": {
"1": {
"name": "meta.tag.inline.strikethrough.html.mediawiki"
}
},
"contentName": "markup.other.strikethrough.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#style_in_link"
}
]
},
{
"begin": "(<(u)>)",
"captures": {
"1": {
"name": "meta.tag.inline.underline.html.mediawiki"
}
},
"contentName": "markup.underline.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#style_in_link"
}
]
},
{
"begin": "(<(tt|code)>)",
"captures": {
"1": {
"name": "meta.tag.inline.raw.html.mediawiki"
}
},
"contentName": "markup.raw.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#style_in_link"
}
]
},
{
"begin": "(<(big|small|sub|sup)>)",
"captures": {
"1": {
"name": "meta.tag.inline.any.html.mediawiki"
}
},
"contentName": "markup.other.inline-styles.html.mediawiki",
"end": "(\\2>)",
"patterns": [
{
"include": "#style_in_link"
}
]
},
{
"include": "#comments"
}
]
},
"table": {
"patterns": [
{
"begin": "^{\\|",
"comment": "\n\t\t\t\t\t\twe are going to have to add the styling capabilities\n\t\t\t\t\t\tto this section eventually. It is complicated,\n\t\t\t\t\t\tthough, so I am putting it off.\n\t\t\t\t\t",
"end": "^\\|}",
"name": "markup.other.table.mediawiki",
"patterns": [
{
"begin": "^\\|-",
"comment": "\n\t\t\t\t\t\t\t\thopefully we can allow selection of a whole\n\t\t\t\t\t\t\t\ttable row, and possibly later allow things\n\t\t\t\t\t\t\t\tlike moving a whole row up/down, etc.\n\t\t\t\t\t\t\t",
"end": "^(?=\\|-|\\|})",
"name": "markup.other.table.row.mediawiki",
"patterns": [
{
"include": "#inline"
}
]
},
{
"include": "#inline"
}
]
}
]
},
"template": {
"comment": "\n\t\t\t\tThis repository item covers templates and parser functions.\n\t\t\t",
"patterns": [
{
"captures": {
"1": {
"name": "variable.parameter.template.numeric.mediawiki"
}
},
"match": "{{{[ ]*([0-9]+)[ ]*}}}",
"name": "meta.template-parameter.mediawiki"
},
{
"captures": {
"1": {
"name": "variable.parameter.template.named.mediawiki"
}
},
"match": "{{{[ ]*(.*?)[ ]*}}}",
"name": "meta.template-parameter.mediawiki"
},
{
"begin": "({{)(?=[ ]*#)",
"beginCaptures": {
"1": {
"name": "punctuation.fix_this_later.template.mediawiki"
},
"2": {
"name": "meta.function-call.template.mediawiki"
}
},
"comment": "\n\t\t\t\t\t\tWhy oh why did mediawiki have to add these??\n\t\t\t\t\t",
"end": "(}})",
"endCaptures": {
"1": {
"name": "punctuation.fix_this_later.template.mediawiki"
}
},
"name": "meta.template.parser-function.mediawiki",
"patterns": [
{
"include": "#inline"
}
]
},
{
"begin": "({{)([^{}\\|]+)?",
"beginCaptures": {
"1": {
"name": "punctuation.fix_this_later.template.mediawiki"
},
"2": {
"name": "meta.function-call.template.mediawiki"
}
},
"comment": "\n\t\t\t\t\t\tI am not sure I really like the scope of\n\t\t\t\t\t\tmeta.function-call for templates, but it seems like\n\t\t\t\t\t\tthe closest thing to what a template is really doing,\n\t\t\t\t\t\twith parameters, etc.\n\t\t\t\t\t",
"end": "(}})",
"endCaptures": {
"1": {
"name": "punctuation.fix_this_later.template.mediawiki"
}
},
"name": "meta.template.mediawiki",
"patterns": [
{
"include": "#comments"
},
{
"begin": "(\\|)\\s*(=)",
"beginCaptures": {
"1": {
"name": "punctuation.fix_this_later.pipe.mediawiki"
},
"2": {
"name": "punctuation.fix_this_later.equals-sign.mediawiki"
}
},
"contentName": "comment.block.template-hack.mediawiki",
"end": "(?=[|}])"
},
{
"begin": "(\\|)(([^{}\\|=]+)(=))?",
"beginCaptures": {
"1": {
"name": "punctuation.fix_this_later.pipe.mediawiki"
},
"2": {
"name": "variable.parameter.template.mediawiki"
},
"3": {
"name": "punctuation.fix_this_later.equals-sign.mediawiki"
}
},
"contentName": "meta.value.template.mediawiki",
"end": "(?=[|}])",
"patterns": [
{
"include": "#inline"
}
]
},
{
"match": "\\|",
"name": "punctuation.fix_this_later.pipe.mediawiki"
}
]
}
]
}
},
"scopeName": "text.html.mediawiki",
"uuid": "6AF21ADF-316A-47D1-A8B6-1BB38637DE9A"
}