1(function(a){if(typeof exports=="object"&&typeof module=="object"){a(require("../../lib/codemirror"))}else if(typeof define=="function"&&define.amd){define(["../../lib/codemirror"],a)}else{a(CodeMirror)}})(function(a){"use strict";var b={addition:"positive",attributes:"attribute",bold:"strong",cite:"keyword",code:"atom",definitionList:"number",deletion:"negative",div:"punctuation",em:"em",footnote:"variable",footCite:"qualifier",header:"header",html:"comment",image:"string",italic:"em",link:"link",linkDefinition:"link",list1:"variable-2",list2:"variable-3",list3:"keyword",notextile:"string-2",pre:"operator",p:"property",quote:"bracket",span:"quote",specialChar:"tag",strong:"strong",sub:"builtin",sup:"builtin",table:"variable-3",tableHeading:"operator"};function c(a,b){b.mode=m.newLayout;b.tableHeading=false;if(b.layoutType==="definitionList"&&b.spanningLayout&&a.match(l("definitionListEnd"),false))b.spanningLayout=false}function d(a,c,d){if(d==="_"){if(a.eat("_"))return e(a,c,"italic",/__/,2);else return e(a,c,"em",/_/,1)}if(d==="*"){if(a.eat("*")){return e(a,c,"bold",/\*\*/,2)}return e(a,c,"strong",/\*/,1)}if(d==="["){if(a.match(/\d+\]/))c.footCite=true;return f(c)}if(d==="("){var g=a.match(/^(r|tm|c)\)/);if(g)return h(c,b.specialChar)}if(d==="<"&&a.match(/(\w+)[^>]+>[^<]+<\/\1>/))return h(c,b.html);if(d==="?"&&a.eat("?"))return e(a,c,"cite",/\?\?/,2);if(d==="="&&a.eat("="))return e(a,c,"notextile",/==/,2);if(d==="-"&&!a.eat("-"))return e(a,c,"deletion",/-/,1);if(d==="+")return e(a,c,"addition",/\+/,1);if(d==="~")return e(a,c,"sub",/~/,1);if(d==="^")return e(a,c,"sup",/\^/,1);if(d==="%")return e(a,c,"span",/%/,1);if(d==="@")return e(a,c,"code",/@/,1);if(d==="!"){var i=e(a,c,"image",/(?:\([^\)]+\))?!/,1);a.match(/^:\S+/);return i}return f(c)}function e(a,b,c,d,e){var g=a.pos>e?a.string.charAt(a.pos-e-1):null;var h=a.peek();if(b[c]){if((!h||/\W/.test(h))&&g&&/\S/.test(g)){var i=f(b);b[c]=false;return i}}else if((!g||/\W/.test(g))&&h&&/\S/.test(h)&&a.match(new RegExp("^.*\\S"+d.source+"(?:\\W|$)"),false)){b[c]=true;b.mode=m.attributes}return f(b)}function f(a){var c=g(a);if(c)return c;var d=[];if(a.layoutType)d.push(b[a.layoutType]);d=d.concat(i(a,"addition","bold","cite","code","deletion","em","footCite","image","italic","link","span","strong","sub","sup","table","tableHeading"));if(a.layoutType==="header")d.push(b.header+"-"+a.header);return d.length?d.join(" "):null}function g(a){var c=a.layoutType;switch(c){case"notextile":case"code":case"pre":return b[c];default:if(a.notextile)return b.notextile+(c?" "+b[c]:"");return null}}function h(a,b){var c=g(a);if(c)return c;var d=f(a);if(b)return d?d+" "+b:b;else return d}function i(a){var c=[];for(var d=1;d<arguments.length;++d){if(a[arguments[d]])c.push(b[arguments[d]])}return c}function j(a){var b=a.spanningLayout,c=a.layoutType;for(var d in a)if(a.hasOwnProperty(d))delete a[d];a.mode=m.newLayout;if(b){a.layoutType=c;a.spanningLayout=true}}var k={cache:{},single:{bc:"bc",bq:"bq",definitionList:/- .*?:=+/,definitionListEnd:/.*=:\s*$/,div:"div",drawTable:/\|.*\|/,foot:/fn\d+/,header:/h[1-6]/,html:/\s*<(?:\/)?(\w+)(?:[^>]+)?>(?:[^<]+<\/\1>)?/,link:/[^"]+":\S/,linkDefinition:/\[[^\s\]]+\]\S+/,list:/(?:#+|\*+)/,notextile:"notextile",para:"p",pre:"pre",table:"table",tableCellAttributes:/[\/\\]\d+/,tableHeading:/\|_\./,tableText:/[^"_\*\[\(\?\+~\^%@|-]+/,text:/[^!"_=\*\[\(<\?\+~\^%@-]+/},attributes:{align:/(?:<>|<|>|=)/,selector:/\([^\(][^\)]+\)/,lang:/\[[^\[\]]+\]/,pad:/(?:\(+|\)+){1,2}/,css:/\{[^\}]+\}/},createRe:function(a){switch(a){case"drawTable":return k.makeRe("^",k.single.drawTable,"$");case"html":return k.makeRe("^",k.single.html,"(?:",k.single.html,")*","$");case"linkDefinition":return k.makeRe("^",k.single.linkDefinition,"$");case"listLayout":return k.makeRe("^",k.single.list,l("allAttributes"),"*\\s+");case"tableCellAttributes":return k.makeRe("^",k.choiceRe(k.single.tableCellAttributes,l("allAttributes")),"+\\.");case"type":return k.makeRe("^",l("allTypes"));case"typeLayout":return k.makeRe("^",l("allTypes"),l("allAttributes"),"*\\.\\.?","(\\s+|$)");case"attributes":return k.makeRe("^",l("allAttributes"),"+");case"allTypes":return k.choiceRe(k.single.div,k.single.foot,k.single.header,k.single.bc,k.single.bq,k.single.notextile,k.single.pre,k.single.table,k.single.para);case"allAttributes":return k.choiceRe(k.attributes.selector,k.attributes.css,k.attributes.lang,k.attributes.align,k.attributes.pad);default:return k.makeRe("^",k.single[a])}},makeRe:function(){var a="";for(var b=0;b<arguments.length;++b){var c=arguments[b];a+=typeof c==="string"?c:c.source}return new RegExp(a)},choiceRe:function(){var a=[arguments[0]];for(var b=1;b<arguments.length;++b){a[b*2-1]="|";a[b*2]=arguments[b]}a.unshift("(?:");a.push(")");return k.makeRe.apply(null,a)}};function l(a){return k.cache[a]||(k.cache[a]=k.createRe(a))}var m={newLayout:function(a,b){if(a.match(l("typeLayout"),false)){b.spanningLayout=false;return(b.mode=m.blockType)(a,b)}var c;if(!g(b)){if(a.match(l("listLayout"),false))c=m.list;else if(a.match(l("drawTable"),false))c=m.table;else if(a.match(l("linkDefinition"),false))c=m.linkDefinition;else if(a.match(l("definitionList")))c=m.definitionList;else if(a.match(l("html"),false))c=m.html}return(b.mode=c||m.text)(a,b)},blockType:function(a,b){var c,d;b.layoutType=null;if(c=a.match(l("type")))d=c[0];else return(b.mode=m.text)(a,b);if(c=d.match(l("header"))){b.layoutType="header";b.header=parseInt(c[0][1])}else if(d.match(l("bq"))){b.layoutType="quote"}else if(d.match(l("bc"))){b.layoutType="code"}else if(d.match(l("foot"))){b.layoutType="footnote"}else if(d.match(l("notextile"))){b.layoutType="notextile"}else if(d.match(l("pre"))){b.layoutType="pre"}else if(d.match(l("div"))){b.layoutType="div"}else if(d.match(l("table"))){b.layoutType="table"}b.mode=m.attributes;return f(b)},text:function(a,b){if(a.match(l("text")))return f(b);var c=a.next();if(c==='"')return(b.mode=m.link)(a,b);return d(a,b,c)},attributes:function(a,c){c.mode=m.layoutLength;if(a.match(l("attributes")))return h(c,b.attributes);else return f(c)},layoutLength:function(a,b){if(a.eat(".")&&a.eat("."))b.spanningLayout=true;b.mode=m.text;return f(b)},list:function(a,b){var c=a.match(l("list"));b.listDepth=c[0].length;var d=(b.listDepth-1)%3;if(!d)b.layoutType="list1";else if(d===1)b.layoutType="list2";else b.layoutType="list3";b.mode=m.attributes;return f(b)},link:function(a,c){c.mode=m.text;if(a.match(l("link"))){a.match(/\S+/);return h(c,b.link)}return f(c)},linkDefinition:function(a,c){a.skipToEnd();return h(c,b.linkDefinition)},definitionList:function(a,b){a.match(l("definitionList"));b.layoutType="definitionList";if(a.match(/\s*$/))b.spanningLayout=true;else b.mode=m.attributes;return f(b)},html:function(a,c){a.skipToEnd();return h(c,b.html)},table:function(a,b){b.layoutType="table";return(b.mode=m.tableCell)(a,b)},tableCell:function(a,b){if(a.match(l("tableHeading")))b.tableHeading=true;else a.eat("|");b.mode=m.tableCellAttributes;return f(b)},tableCellAttributes:function(a,c){c.mode=m.tableText;if(a.match(l("tableCellAttributes")))return h(c,b.attributes);else return f(c)},tableText:function(a,b){if(a.match(l("tableText")))return f(b);if(a.peek()==="|"){b.mode=m.tableCell;return f(b)}return d(a,b,a.next())}};a.defineMode("textile",function(){return{startState:function(){return{mode:m.newLayout}},token:function(a,b){if(a.sol())c(a,b);return b.mode(a,b)},blankLine:j}});a.defineMIME("text/x-textile","textile")}); 2//# sourceMappingURL=textile.min.js.map