/***\n|Name|Plugin: arXiv Links|\n|Created by|BobMcElrath|\n|Email|my first name at my last name dot org|\n|Location|http://bob.mcelrath.org/tiddlyjsmath-2.0.3.html|\n|Version|1.0|\n|Requires|[[TiddlyWiki|http://www.tiddlywiki.com]] ≥ 2.0.3|\n!Description\nThis formatting plugin will render links to the [[arXiv|http://www.arxiv.org]] preprint system. If you type a paper reference such as hep-ph/0509024, it will be rendered as an external link to the abstract of that paper.\n!Installation\nAdd this tiddler to your tiddlywiki, and give it the {{{systemConfig}}} tag.\n!History\n* 1-Feb-06, version 1.0, Initial release\n!Code\n***/\n//{{{\nconfig.formatters.push({\n name: "arXivLinks",\n match: "\s\sb(?:astro-ph|cond-mat|hep-ph|hep-th|hep-lat|gr-qc|nucl-ex|nucl-th|quant-ph|(?:cs|math|nlin|physics|q-bio)(?:\s\s.[A-Z]{2})?)/[0-9]{7}\s\sb",\n element: "a",\n handler: function(w) {\n var e = createExternalLink(w.output, "http://arxiv.org/abs/"+w.matchText);\n e.target = "_blank"; // open in new window\n w.outputText(e,w.matchStart,w.nextMatch);\n }\n});\n//}}}\n\n
/***\n|Name|Plugin: jsMath|\n|Created by|BobMcElrath|\n|Email|my first name at my last name dot org|\n|Location|http://bob.mcelrath.org/tiddlyjsmath.html|\n|Version|1.5.1|\n|Requires|[[TiddlyWiki|http://www.tiddlywiki.com]] ≥ 2.0.3, [[jsMath|http://www.math.union.edu/~dpvc/jsMath/]] ≥ 3.0|\n!Description\nLaTeX is the world standard for specifying, typesetting, and communicating mathematics among scientists, engineers, and mathematicians. For more information about LaTeX itself, visit the [[LaTeX Project|http://www.latex-project.org/]]. This plugin typesets math using [[jsMath|http://www.math.union.edu/~dpvc/jsMath/]], which is an implementation of the TeX math rules and typesetting in javascript, for your browser. Notice the small button in the lower right corner which opens its control panel.\n!Installation\nIn addition to this plugin, you must also [[install jsMath|http://www.math.union.edu/~dpvc/jsMath/download/jsMath.html]] on the same server as your TiddlyWiki html file. If you're using TiddlyWiki without a web server, then the jsMath directory must be placed in the same location as the TiddlyWiki html file.\n\nI also recommend modifying your StyleSheet use serif fonts that are slightly larger than normal, so that the math matches surrounding text, and \s\ssmall fonts are not unreadable (as in exponents and subscripts).\n{{{\n.viewer {\n line-height: 125%;\n font-family: serif;\n font-size: 12pt;\n}\n}}}\n\nIf you had used a previous version of [[Plugin: jsMath]], it is no longer necessary to edit the main tiddlywiki.html file to add the jsMath <script> tag. [[Plugin: jsMath]] now uses ajax to load jsMath.\n!History\n* 11-Nov-05, version 1.0, Initial release\n* 22-Jan-06, version 1.1, updated for ~TW2.0, tested with jsMath 3.1, editing tiddlywiki.html by hand is no longer necessary.\n* 24-Jan-06, version 1.2, fixes for Safari, Konqueror\n* 27-Jan-06, version 1.3, improved error handling, detect if ajax was already defined (used by ZiddlyWiki)\n* 12-Jul-06, version 1.4, fixed problem with not finding image fonts\n* 26-Feb-07, version 1.5, fixed problem with Mozilla "unterminated character class".\n* 27-Feb-07, version 1.5.1, Runs compatibly with TW 2.1.0+, by Bram Chen\n!Examples\n|!Source|!Output|h\n|{{{The variable $x$ is real.}}}|The variable $x$ is real.|\n|{{{The variable \s(y\s) is complex.}}}|The variable \s(y\s) is complex.|\n|{{{This \s[\sint_a^b x = \sfrac{1}{2}(b^2-a^2)\s] is an easy integral.}}}|This \s[\sint_a^b x = \sfrac{1}{2}(b^2-a^2)\s] is an easy integral.|\n|{{{This $$\sint_a^b \ssin x = -(\scos b - \scos a)$$ is another easy integral.}}}|This $$\sint_a^b \ssin x = -(\scos b - \scos a)$$ is another easy integral.|\n|{{{Block formatted equations may also use the 'equation' environment \sbegin{equation} \sint \stan x = -\sln \scos x \send{equation} }}}|Block formatted equations may also use the 'equation' environment \sbegin{equation} \sint \stan x = -\sln \scos x \send{equation}|\n|{{{Equation arrays are also supported \sbegin{eqnarray} a &=& b \s\s c &=& d \send{eqnarray} }}}|Equation arrays are also supported \sbegin{eqnarray} a &=& b \s\s c &=& d \send{eqnarray} |\n|{{{I spent \s$7.38 on lunch.}}}|I spent \s$7.38 on lunch.|\n|{{{I had to insert a backslash (\s\s) into my document}}}|I had to insert a backslash (\s\s) into my document|\n!Code\n***/\n//{{{\n\n// AJAX code adapted from http://timmorgan.org/mini\n// This is already loaded by ziddlywiki...\nif(typeof(window["ajax"]) == "undefined") {\n ajax = {\n x: function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest()}}},\n gets: function(url){var x=ajax.x();x.open('GET',url,false);x.send(null);return x.responseText}\n }\n}\n\n// Load jsMath\njsMath = {\n Setup: {inited: 1}, // don't run jsMath.Setup.Body() yet\n Autoload: {root: new String(document.location).replace(/[^\s/]*$/,'jsMath/')} // URL to jsMath directory, change if necessary\n};\nvar jsMathstr;\ntry {\n jsMathstr = ajax.gets(jsMath.Autoload.root+"jsMath.js");\n} catch(e) {\n alert("jsMath was not found: you must place the 'jsMath' directory in the same place as this file. "\n +"The error was:\sn"+e.name+": "+e.message);\n throw(e); // abort eval\n}\ntry {\n window.eval(jsMathstr);\n} catch(e) {\n alert("jsMath failed to load. The error was:\sn"+e.name + ": " + e.message + " on line " + e.lineNumber);\n}\njsMath.Setup.inited=0; // allow jsMath.Setup.Body() to run again\n\n// Define wikifers for latex\nconfig.formatterHelpers.mathFormatHelper = function(w) {\n var e = document.createElement(this.element);\n e.className = this.className;\n var endRegExp = new RegExp(this.terminator, "mg");\n endRegExp.lastIndex = w.matchStart+w.matchLength;\n var matched = endRegExp.exec(w.source);\n if(matched) {\n var txt = w.source.substr(w.matchStart+w.matchLength, \n matched.index-w.matchStart-w.matchLength);\n if(this.keepdelim) {\n txt = w.source.substr(w.matchStart, matched.index+matched[0].length-w.matchStart);\n }\n e.appendChild(document.createTextNode(txt));\n w.output.appendChild(e);\n w.nextMatch = endRegExp.lastIndex;\n }\n}\n\nconfig.formatters.push({\n name: "displayMath1",\n match: "\s\s\s$\s\s\s$",\n terminator: "\s\s\s$\s\s\s$\s\sn?", // 2.0 compatibility\n termRegExp: "\s\s\s$\s\s\s$\s\sn?",\n element: "div",\n className: "math",\n handler: config.formatterHelpers.mathFormatHelper\n});\n\nconfig.formatters.push({\n name: "inlineMath1",\n match: "\s\s\s$", \n terminator: "\s\s\s$", // 2.0 compatibility\n termRegExp: "\s\s\s$",\n element: "span",\n className: "math",\n handler: config.formatterHelpers.mathFormatHelper\n});\n\nvar backslashformatters = new Array(0);\n\nbackslashformatters.push({\n name: "inlineMath2",\n match: "\s\s\s\s\s\s\s(",\n terminator: "\s\s\s\s\s\s\s)", // 2.0 compatibility\n termRegExp: "\s\s\s\s\s\s\s)",\n element: "span",\n className: "math",\n handler: config.formatterHelpers.mathFormatHelper\n});\n\nbackslashformatters.push({\n name: "displayMath2",\n match: "\s\s\s\s\s\s\s[",\n terminator: "\s\s\s\s\s\s\s]\s\sn?", // 2.0 compatibility\n termRegExp: "\s\s\s\s\s\s\s]\s\sn?",\n element: "div",\n className: "math",\n handler: config.formatterHelpers.mathFormatHelper\n});\n\nbackslashformatters.push({\n name: "displayMath3",\n match: "\s\s\s\sbegin\s\s{equation\s\s}",\n terminator: "\s\s\s\send\s\s{equation\s\s}\s\sn?", // 2.0 compatibility\n termRegExp: "\s\s\s\send\s\s{equation\s\s}\s\sn?",\n element: "div",\n className: "math",\n handler: config.formatterHelpers.mathFormatHelper\n});\n\n// These can be nested. e.g. \sbegin{equation} \sbegin{array}{ccc} \sbegin{array}{ccc} ...\nbackslashformatters.push({\n name: "displayMath4",\n match: "\s\s\s\sbegin\s\s{eqnarray\s\s}",\n terminator: "\s\s\s\send\s\s{eqnarray\s\s}\s\sn?", // 2.0 compatibility\n termRegExp: "\s\s\s\send\s\s{eqnarray\s\s}\s\sn?",\n element: "div",\n className: "math",\n keepdelim: true,\n handler: config.formatterHelpers.mathFormatHelper\n});\n\n// The escape must come between backslash formatters and regular ones.\n// So any latex-like \scommands must be added to the beginning of\n// backslashformatters here.\nbackslashformatters.push({\n name: "escape",\n match: "\s\s\s\s.",\n handler: function(w) {\n w.output.appendChild(document.createTextNode(w.source.substr(w.matchStart+1,1)));\n w.nextMatch = w.matchStart+2;\n }\n});\n\nconfig.formatters=backslashformatters.concat(config.formatters);\n\nwindow.wikify = function(source,output,highlightRegExp,tiddler)\n{\n if(source && source != "") {\n if(version.major == 2 && version.minor > 0) {\n var wikifier = new Wikifier(source,getParser(tiddler),highlightRegExp,tiddler);\n wikifier.subWikifyUnterm(output);\n } else {\n var wikifier = new Wikifier(source,formatter,highlightRegExp,tiddler);\n wikifier.subWikify(output,null);\n }\n jsMath.ProcessBeforeShowing();\n }\n}\n//}}}\n
/***\n|Name|Plugin: Scientific Notation|\n|Created by|BobMcElrath|\n|Email|my first name at my last name dot org|\n|Location|http://bob.mcelrath.org/tiddlyjsmath-2.0.3.html|\n|Version|1.0|\n|Requires|[[TiddlyWiki|http://www.tiddlywiki.com]] ≥ 2.0.3, [[jsMath|http://www.math.union.edu/~dpvc/jsMath/]] ≥ 3.0, [[Plugin: jsMath]]|\n!Description\nThis plugin will render numbers expressed in scientific notation, such as {{{3.5483e12}}} using the jsMath plugin to display it in an intuitive way such as 3.5483e12. You may customize the number of significant figures displayed, as well as "normalize" numbers so that {{{47392.387e9}}} is displayed as 47392.387e9.\n!Installation\nInstall the Requirements, above, add this tiddler to your tiddlywiki, and give it the {{{systemConfig}}} tag.\n!History\n* 1-Feb-06, version 1.0, Initial release\n!Code\n***/\n//{{{\nconfig.formatters.push({\n name: "scientificNotation",\n match: "\s\sb[0-9]+\s\s.[0-9]+[eE][+-]?[0-9]+\s\sb",\n element: "span",\n className: "math",\n normalize: true, // set to 'true' to convert numbers to X.XXX \stimes 10^{y}\n sigfigs: 3, // with this many digits in the mantissa\n handler: function(w) {\n var snRegExp = new RegExp("\s\sb([0-9]+(?:\s\s.[0-9]+)?)[eE]([-0-9+]+)\s\sb");\n var mymatch = snRegExp.exec(w.matchText);\n var mantissa = mymatch[1];\n var exponent = parseInt(mymatch[2]);\n // normalize the number.\n if(this.normalize) {\n mantissa = parseFloat(mantissa);\n while(mantissa > 10.0) {\n mantissa = mantissa / 10.0;\n exponent++; \n }\n while(mantissa < 1.0) {\n mantissa = mantissa * 10.0;\n exponent--;\n }\n var sigfigsleft = this.sigfigs;\n mantissa = parseInt(mantissa) + "." + (Math.round(Math.pow(10,this.sigfigs-1)*mantissa)+"").substr(1,this.sigfigs-1);\n }\n var e = document.createElement(this.element);\n e.className = this.className;\n if(exponent == 0) {\n e.appendChild(document.createTextNode(mantissa));\n } else {\n e.appendChild(document.createTextNode(mantissa + "\s\stimes 10^{" + exponent + "}"));\n }\n w.output.appendChild(e);\n }\n});\n//}}}\n
/***\n|''Name:''|Plugin: Syntaxify|\n|''Description:''|Performs syntax highlighting on CSS, JavaScript, and HTML/XML|\n|''Version:''|1.2|\n|''Date:''|January 27, 2007|\n|''Source:''|http://bob.mcelrath.org/syntaxify.html|\n|''Author:''|BobMcElrath|\n|''Email:''|my first name at my last name dot org|\n|''License:''|[[GPL open source license|http://www.gnu.org/licenses/gpl.html]]|\n|''~CoreVersion:''|2.0.0|\n!Description\nThis plugin will syntax highlight ("pretty-print") source code used by TiddlyWiki. To activate CSS markup, enclose the code in the CSS code in the delimiters \n<html><code>\n/*{{{*/<br/>\n/* CSS code here */<br/>\n/*}}}*/<br/>\n</code></html>\nTo activate XML markup, enclose your HTML/XML in the delimiters\n<html><code>\n<!--{{{--><br/>\n<!-- XML/HTML code here --><br/>\n<!--}}}--><br/>\n</code></html>\nAnd to activate JavaScript markup, enclose your code in the delimiters\n<html><code>\n//{{{<br/>\n// JavaScript code here.<br/>\n//}}}<br/>\n</code></html>\n\nIn addition, all of the above languages can be syntaxified by using the custom class formatter\n<html><code>\n{{foo{<br/>\n code for language "foo" here<br/>\n}}}<br/>\n</code></html>\nwhere {{{foo}}} is the name of the language: {{{css}}}, {{{javascript}}}, or {{{xml}}}. This plugin can be extended with new languages by creating a data structure like those below (in {{{syntaxify.languages}}} and then calling {{{syntaxify.addLanguages}}}.\n!History\n* 1.2 Release\n** Now syntaxifies in-line style code (thanks [[Conal Elliott|http://conal.net]]).\n** Fix multi-line comments in CSS.\n** Consolidate customClassesHelper and monospacedByLineHelper which had lots of duplicated code.\n** Fix autoLinkWikiWords bug when using custom classes and the tag formatter.\n** Fix compatability problems between 2.1 and 2.0 (termRegExp vs. terminator)\n* 1.1 Release\n** Rewrite things to make it easier to add new languages.\n** Override customClasses to syntaxify when the class corresponds to a known language.\n** TiddlyWiki 2.1 beta compatibility\n* 1.0.2 Release\n** Don't use {{{class}}} as a variable name, dummy.\n* 1.0.1 Release\n** Simplified stylesheet and removed line numbering.\n** Fixed highlighting when <html><code>*/</code></html> appeared at the beginning of a line.\n** Fixed blank lines not being shown if {{{list-style-type: none}}} was turned on.\n** Small speedups\n* 1.0.0 Initial Release\n!Code\n***/\n//{{{\nversion.extensions.Syntaxify = { major: 1, minor: 2, revision: 0, date: new Date("2007","01","27"),\n source: "http://bob.mcelrath.org/syntaxify.html"\n};\n\nvar syntaxify = {};\n\nsyntaxify.regexpSpace = new RegExp(" ", "mg");\nsyntaxify.regexpTab = new RegExp("\st", "mg");\nsyntaxify.regexpAmp = new RegExp("&","mg");\nsyntaxify.regexpLessThan = new RegExp("<","mg");\nsyntaxify.regexpGreaterThan = new RegExp(">","mg");\nsyntaxify.regexpQuote = new RegExp("\s"","mg");\nsyntaxify.regexpDoubleQuotedString = new RegExp("\s"(?:\s\s\s\s.|[^\s\s\s\s\s"])*?\s"", "mg");\nsyntaxify.regexpSingleQuotedString = new RegExp("'(?:\s\s\s\s.|[^\s\s\s\s'])*?'", "mg");\nsyntaxify.regexpCSingleLineComment = new RegExp('//.*$', "g");\nsyntaxify.regexpCMultiLineComment \n = new RegExp('/\s\s*(?:(?:.|(?:\s\sr)?\s\sn)(?!\s\s*/))*(?:.|(?:\s\sr)?\s\sn)?\s\s*/',"mg");\nString.prototype.htmlListMono = function() {\n return(this.replace(syntaxify.regexpAmp,"&")\n .replace(syntaxify.regexpLessThan,"<")\n .replace(syntaxify.regexpGreaterThan,">")\n .replace(syntaxify.regexpQuote,""")\n .replace(syntaxify.regexpSpace," ")\n .replace(syntaxify.regexpTab," "));\n}\n\nsyntaxify.handleSpanClass = function(w) {\n var match, lastPos=0;\n if(this.lookahead) {\n var lookaheadRegExp = new RegExp(this.lookahead,"mg"); \n lookaheadRegExp.lastIndex = w.matchStart; \n var lookaheadMatch = lookaheadRegExp.exec(w.source); \n if(lookaheadMatch && lookaheadMatch.index == w.matchStart) { \n createTiddlyText(w.output, lookaheadMatch[1]);\n var e = createTiddlyElement(w.output, "span", null, this.name);\n e.innerHTML = this.hasSpaces?lookaheadMatch[2].htmlListMono():lookaheadMatch[2];\n }\n } else {\n while((match = regexpNewLine.exec(w.matchText)) != null) { // multi-line\n var alt = "";\n var e = createTiddlyElement(w.output, "span", null, this.name);\n e.innerHTML = this.hasSpaces?w.matchText.substr(lastPos,match.index-lastPos).htmlListMono()\n :w.matchText.substr(lastPos,match.index-lastPos);\n if(w.output.className != "alt") alt = "alt";\n w.output = createTiddlyElement(w.output.parentNode, "li", null, alt);\n lastPos = match.index;\n } \n var e = createTiddlyElement(w.output, "span", null, this.name);\n e.innerHTML = this.hasSpaces?w.matchText.substr(lastPos, w.matchText.length-lastPos).htmlListMono()\n :w.matchText.substr(lastPos, w.matchText.length-lastPos)\n }\n}\n\n/* This is a shadow tiddler. Do not edit it here. Instead, open the tiddler StyleSheetSyntaxify \n * and edit it instead. (go to the toolbar on the right and select "More"->"Shadowed") */\nconfig.shadowTiddlers.StyleSheetSyntaxify = "/*{{{*/\sn"\n+".viewer .syntaxify {\sn"\n+" font-family: monospace;\sn"\n+"}\sn"\n+".viewer div.syntaxify {\sn"\n+" background-color: #ffc;\sn"\n+" border: 1px solid #fe8;\sn"\n+" padding: 0.5em;\sn"\n+" margin: 0 0 1em 0.5em;\sn"\n+" font-size: 1.2em;\sn"\n+" overflow: auto;\sn"\n+"}\sn\sn"\n+".syntaxify ol {\sn"\n+" margin: 0;\sn"\n+" padding: 1px;\sn"\n+" color: #2B91AF;\sn"\n+"}\sn\sn"\n+".syntaxify ol li {\sn"\n+" background-color: #ffc;\sn"\n+" color: black;\sn"\n+" list-style-type: none;\sn"\n+"/* An alternate style to enable line numbering -- remove the line above and uncomment below if desired */\sn"\n+"/*\sn"\n+" list-style-type: 1;\sn"\n+" border-left: 3px solid #fe8;\sn"\n+" margin-left: 3.5em;\sn"\n+"*/\sn"\n+"}\sn\sn"\n+"/* To disable alternating lines having a different colors, comment out the following line. */\sn"\n+".syntaxify ol li.alt { background-color: #ffe; }\sn\sn"\n+".syntaxify ol li span { color: black; }\sn"\n+".syntaxify .singleLineComments { color: green; }\sn"\n+".syntaxify .multiLineComments { color: green; }\sn"\n+".syntaxify .multiLineComments1 { color: red; }\sn"\n+".syntaxify .tag { font-weight: bold; color: blue; }\sn"\n+".syntaxify .tagname { font-weight: bold; color: black; }\sn"\n+".syntaxify .attribute { color: rgb(127,0,85); }\sn"\n+".syntaxify .value { color: rgb(42,0,255); }\sn"\n+".syntaxify .keywords { color: #006699; }\sn"\n+".syntaxify .keywords1 { color: red; }\sn"\n+".syntaxify .delimiters { color: maroon; }\sn"\n+".syntaxify .delimiters1 { color: olive; }\sn"\n+".syntaxify .literals { color: maroon; }\sn"\n+".syntaxify .literals1 { color: blue; }\sn"\n+".syntaxify .literals2 { color: blue; }\sn"\n+".syntaxify .literals3 { color: #129; }\sn"\n+".syntaxify .identifiers { font-weight: bold; color: blue; }\sn"\n+".syntaxify .identifiers1 { font-weight: bold; color: black; }\sn"\n+"/*}}}*/";\n\nstore.addNotification("StyleSheetSyntaxify",refreshStyles);\nconfig.shadowTiddlers.ViewTemplate = "<!--{{{-->\sn"+config.shadowTiddlers.ViewTemplate+"\sn<!--}}}-->";\nconfig.shadowTiddlers.EditTemplate = "<!--{{{-->\sn"+config.shadowTiddlers.EditTemplate+"\sn<!--}}}-->";\nconfig.shadowTiddlers.PageTemplate = "<!--{{{-->\sn"+config.shadowTiddlers.PageTemplate+"\sn<!--}}}-->";\nconfig.shadowTiddlers.StyleSheetPrint = "/*{{{*/\sn"+config.shadowTiddlers.StyleSheetPrint+"\sn/*}}}*/";\n\nsyntaxify.commonFormatters = [\n{ name: "spaces",\n match: "[ \s\st]+",\n handler: function(w) {\n w.output.innerHTML += w.matchText.htmlListMono();\n }\n},{ name: "newline",\n match: "\s\sn",\n handler: function(w) {\n var alt = ""\n if(w.output.className != "alt") alt = "alt";\n if(!w.output.hasChildNodes()) w.output.innerHTML = " ";\n w.output = createTiddlyElement(w.output.parentNode, "li", null, alt);\n }\n}];\n\nsyntaxify.xmlTagFormatters = syntaxify.commonFormatters;\nsyntaxify.xmlTagFormatters = syntaxify.xmlTagFormatters.concat([\n{ name: "tagname",\n match: '<[/\s\s?]?\s\ss*(?:[\s\sw-\s\s.]+)',\n lookahead: '(<[/\s\s?]?\s\ss*)([\s\sw-\s\s.]+)',\n handler: syntaxify.handleSpanClass\n},{\n name: "attribute-value",\n match: '[\s\sw-\s.]+(?:\s\ss*=\s\ss*"[^"]*?"|\s'[^\s']*?\s'|\s\sw+)?',\n lookahead: '([\s\sw-\s.]+)(?:(\s\ss*=\s\ss*)("[^"]*?"|\s'[^\s']*?\s'|\s\sw+))?',\n handler: function(w) {\n var lookaheadRegExp = new RegExp(this.lookahead,"mg"); \n lookaheadRegExp.lastIndex = w.matchStart; \n var lookaheadMatch = lookaheadRegExp.exec(w.source); \n if(lookaheadMatch && lookaheadMatch.index == w.matchStart) { \n var e = createTiddlyElement(w.output, "span", null, "attribute");\n e.innerHTML = lookaheadMatch[1];\n if(lookaheadMatch[2]) {\n var e = createTiddlyElement(w.output, "span");\n e.innerHTML = lookaheadMatch[2].htmlListMono();\n e = createTiddlyElement(w.output, "span", null, "value");\n e.innerHTML = lookaheadMatch[3].htmlListMono();\n }\n }\n w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length; \n }\n}]);\n\n\n// A rather huge data structure to store languages. Add to it!\nsyntaxify.languages = {\njavascript: {\n singleLineComments: [[syntaxify.regexpCSingleLineComment.source]],\n multiLineComments: [[syntaxify.regexpCMultiLineComment.source]],\n keywords: [['abstract', 'boolean', 'break', 'byte', 'case', 'catch', 'char',\n 'class', 'const', 'continue', 'debugger', 'default', 'delete', 'do',\n 'double', 'else', 'enum', 'export', 'extends', 'false', 'final',\n 'finally', 'float', 'for', 'function', 'goto', 'if', 'implements',\n 'import', 'in', 'instanceof', 'int', 'interface', 'long', 'native',\n 'new', 'null', 'package', 'private', 'protected', 'public', 'return',\n 'short', 'static', 'super', 'switch', 'synchronized', 'this', 'throw',\n 'throws', 'transient', 'true', 'try', 'typeof', 'var', 'void',\n 'volatile', 'while', 'with']\n ],\n literals: [\n [syntaxify.regexpSingleQuotedString.source],\n [syntaxify.regexpDoubleQuotedString.source],\n ["\s\sb\s\sd+(?:\s\s.\s\sd+(?:[eE][\s\s+-]\s\sd+)?)?\s\sb"] // Numbers\n ],\n delimiters: [["[\s\s{\s\s}]"],["[\s\s(\s\s)]"],["[\s\s[\s\s]]"]]\n}, \ncss: {\n multiLineComments: [[syntaxify.regexpCMultiLineComment.source]],\n keywords: [\n // Keywords appearing on the LHS of expressions\n ['ascent', 'azimuth', 'background-attachment', 'background-color',\n 'background-image', 'background-position', 'background-repeat',\n 'background', 'baseline', 'bbox', 'border-collapse', 'border-color',\n 'border-spacing', 'border-style', 'border-top', 'border-right',\n 'border-bottom', 'border-left', 'border-top-color',\n 'border-right-color', 'border-bottom-color', 'border-left-color',\n 'border-top-style', 'border-right-style', 'border-bottom-style',\n 'border-left-style', 'border-top-width', 'border-right-width',\n 'border-bottom-width', 'border-left-width', 'border-width', 'border',\n 'bottom', 'cap-height', 'caption-side', 'centerline', 'clear', 'clip',\n 'color', 'content', 'counter-increment', 'counter-reset', 'cue-after',\n 'cue-before', 'cue', 'cursor', 'definition-src', 'descent',\n 'direction', 'display', 'elevation', 'empty-cells', 'float',\n 'font-size-adjust', 'font-family', 'font-size', 'font-stretch',\n 'font-style', 'font-variant', 'font-weight', 'font', 'height', 'left',\n 'letter-spacing', 'line-height', 'list-style-image',\n 'list-style-position', 'list-style-type', 'list-style', 'margin-top',\n 'margin-right', 'margin-bottom', 'margin-left', 'margin',\n 'marker-offset', 'marks', 'mathline', 'max-height', 'max-width',\n 'min-height', 'min-width', 'orphans', 'outline-color',\n 'outline-style', 'outline-width', 'outline', 'overflow', 'padding-top',\n 'padding-right', 'padding-bottom', 'padding-left', 'padding', 'page',\n 'page-break-after', 'page-break-before', 'page-break-inside', 'pause',\n 'pause-after', 'pause-before', 'pitch', 'pitch-range', 'play-during',\n 'position', 'quotes', 'richness', 'right', 'size', 'slope', 'src',\n 'speak-header', 'speak-numeral', 'speak-punctuation', 'speak',\n 'speech-rate', 'stemh', 'stemv', 'stress', 'table-layout',\n 'text-align', 'text-decoration', 'text-indent', 'text-shadow',\n 'text-transform', 'unicode-bidi', 'unicode-range', 'units-per-em',\n 'vertical-align', 'visibility', 'voice-family', 'volume',\n 'white-space', 'widows', 'width', 'widths', 'word-spacing', 'x-height',\n 'z-index'],\n // Treat !important as a different kind of keyword\n ["important"]\n ],\n literals: [\n // Literals appearing on the RHS of expressions\n ['above', 'absolute', 'all', 'always', 'aqua', 'armenian', 'attr',\n 'aural', 'auto', 'avoid', 'baseline', 'behind', 'below',\n 'bidi-override', 'black', 'blink', 'block', 'blue', 'bold', 'bolder',\n 'both', 'bottom', 'braille', 'capitalize', 'caption', 'center',\n 'center-left', 'center-right', 'circle', 'close-quote', 'code',\n 'collapse', 'compact', 'condensed', 'continuous', 'counter',\n 'counters', 'crop', 'cross', 'crosshair', 'cursive', 'dashed',\n 'decimal', 'decimal-leading-zero', 'default', 'digits', 'disc',\n 'dotted', 'double', 'embed', 'embossed', 'e-resize', 'expanded',\n 'extra-condensed', 'extra-expanded', 'fantasy', 'far-left',\n 'far-right', 'fast', 'faster', 'fixed', 'format', 'fuchsia', 'gray',\n 'green', 'groove', 'handheld', 'hebrew', 'help', 'hidden', 'hide',\n 'high', 'higher', 'icon', 'inline-table', 'inline', 'inset', 'inside',\n 'invert', 'italic', 'justify', 'landscape', 'large', 'larger',\n 'left-side', 'left', 'leftwards', 'level', 'lighter', 'lime',\n 'line-through', 'list-item', 'local', 'loud', 'lower-alpha',\n 'lowercase', 'lower-greek', 'lower-latin', 'lower-roman', 'lower',\n 'low', 'ltr', 'marker', 'maroon', 'medium', 'message-box', 'middle',\n 'mix', 'move', 'narrower', 'navy', 'ne-resize', 'no-close-quote',\n 'none', 'no-open-quote', 'no-repeat', 'normal', 'nowrap', 'n-resize',\n 'nw-resize', 'oblique', 'olive', 'once', 'open-quote', 'outset',\n 'outside', 'overline', 'pointer', 'portrait', 'pre', 'print',\n 'projection', 'purple', 'red', 'relative', 'repeat', 'repeat-x',\n 'repeat-y', 'ridge', 'right', 'right-side', 'rightwards', 'rtl',\n 'run-in', 'screen', 'scroll', 'semi-condensed', 'semi-expanded',\n 'separate', 'se-resize', 'show', 'silent', 'silver', 'slower', 'slow',\n 'small', 'small-caps', 'small-caption', 'smaller', 'soft', 'solid',\n 'speech', 'spell-out', 'square', 's-resize', 'static', 'status-bar',\n 'sub', 'super', 'sw-resize', 'table-caption', 'table-cell',\n 'table-column', 'table-column-group', 'table-footer-group',\n 'table-header-group', 'table-row', 'table-row-group', 'teal',\n 'text-bottom', 'text-top', 'thick', 'thin', 'top', 'transparent',\n 'tty', 'tv', 'ultra-condensed', 'ultra-expanded', 'underline',\n 'upper-alpha', 'uppercase', 'upper-latin', 'upper-roman', 'url',\n 'visible', 'wait', 'white', 'wider', 'w-resize', 'x-fast', 'x-high',\n 'x-large', 'x-loud', 'x-low', 'x-slow', 'x-small', 'x-soft',\n 'xx-large', 'xx-small', 'yellow'],\n // Font literals\n ['[mM]ono(?:space)?', '[tT]ahoma', '[vV]erdana', '[aA]rial',\n '[hH]elvetica', '[sS]ans(?:-serif)?', '[sS]erif', '[Cc]ourier'],\n // Measurement literals\n ["\s\sb\s\sd+(?:\s\s.\s\sd+)?(?:em|pt|px|cm|in|pc|mm)\s\sb"],\n // Color literals\n ['(?:\s\s#[a-fA-F0-9]{6}\s\sb|\s\s#[a-fA-F0-9]{3}\s\sb|rgb\s\s(\s\ss*\s\sd+\s\ss*,\s\ss*\s\sd+\s\ss*,\s\ss*\s\sd+\s\ss*\s\s))']\n ],\n identifiers: [["\s\s.[a-zA-Z_]\s\sw*"],["\s\s#[a-zA-Z_]\s\sw*"]],\n delimiters: [["[\s\s{\s\s}]"]]\n}, \nxml: {\n multiLineComments: [\n ["<[^!>]*!--\s\ss*(?:(?:.|(?:\s\sr)?\s\sn)(?!--))*?(?:(?:.|(?:\s\sr)?\s\sn)(?=--))?\s\ss*--[^>]*?>"],\n ['<\s\s!\s\s[[\s\sw\s\ss]*?\s\s[(?:(?:.|(?:\s\sr)?\s\sn)(?!\s\s]\s\s]>))*?(?:(?:.|(?:\s\sr)?\s\sn)(?=\s\s]\s\s]>))?\s\s]\s\s]>']\n ],\n customFormatters: [{\n name: "tag",\n match: "<[/\s\s?]?[^>]*?>",\n handler: function(w) {\n var formatter = new Formatter(syntaxify.xmlTagFormatters);\n var wikifier = new Wikifier(w.matchText, formatter, w.highlightRegExp, w.tiddler);\n wikifier.subWikify(w.output, null);\n }\n }]\n}};\n\nconfig.formatterHelpers.customClassesHelper = function(w) {\n var lookaheadRegExp = (typeof(this.lookaheadRegExp) == "undefined")?(new RegExp(this.lookahead,"mg")):this.lookaheadRegExp;\n lookaheadRegExp.lastIndex = w.matchStart;\n var lookaheadMatch = lookaheadRegExp.exec(w.source);\n var language = (typeof(this.language) == "undefined")?lookaheadMatch[1]:this.language;\n if(lookaheadMatch && lookaheadMatch.index == w.matchStart)\n {\n var isByLine = (typeof(this.byLine) == "undefined")?(lookaheadMatch[2] == "\sn"):this.byLine;\n var p = createTiddlyElement(w.output,isByLine ? "div" : "span",null,language);\n w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length;\n if(typeof(syntaxify.formatters[language]) != "undefined") {\n var d = createTiddlyElement(w.output,isByLine?"div":"span",\n null,"syntaxify "+language);\n var formatter = new Formatter(syntaxify.formatters[language]);\n if(typeof(this.termRegExp) == "undefined") {\n var text = lookaheadMatch[1]; \n } else {\n this.termRegExp.lastIndex = w.nextMatch;\n var terminatorMatch = this.termRegExp.exec(w.source);\n var text = w.source.substr(w.nextMatch, terminatorMatch.index-w.nextMatch);\n }\n if(config.browser.isIE) text = text.replace(/\sn/g,"\sr"); \n if (isByLine) {\n var l = createTiddlyElement(d,"ol");\n var li = createTiddlyElement(l,"li");\n var wikifier = new Wikifier(text, formatter, w.highlightRegExp, w.tiddler);\n wikifier.subWikify(li, null);\n if(!l.childNodes[l.childNodes.length-1].hasChildNodes())\n l.removeChild(l.childNodes[l.childNodes.length-1]);\n } else {\n var wikifier = new Wikifier(text,formatter,w.highlightRegExp,w.tiddler);\n wikifier.subWikify(d, null);\n }\n if(typeof(this.termRegExp) != "undefined")\n w.nextMatch = terminatorMatch.index + terminatorMatch[0].length;\n else\n w.nextMatch = lookaheadMatch.index + lookaheadMatch[0].length; \n } else {\n if(isByLine)\n var e = createTiddlyElement(w.output,"code",null,null,text); \n else\n var e = createTiddlyElement(w.output,"pre",null,null,text); \n }\n }\n}\n\nsyntaxify.formatters = {};\n\nsyntaxify.addLanguages = function(languages) {\n for(lang in languages) {\n syntaxify.formatters[lang] = new Array();\n for(var i=0;i<syntaxify.commonFormatters.length;i++)\n syntaxify.formatters[lang].push(syntaxify.commonFormatters[i]);\n var addSpanClass = function(rule, spaces, wordbreak) {\n if(typeof(languages[lang][rule]) != "undefined") {\n for(var j=0;j<languages[lang][rule].length;j++) {\n syntaxify.formatters[lang].push({\n name: rule+((j==0)?"":j),\n match: wordbreak?("(?:\s\sb"+languages[lang][rule][j].join("\s\sb|\s\sb")+"\s\sb)")\n :("(?:"+languages[lang][rule][j].join("|")+")"),\n hasSpaces: spaces,\n handler: syntaxify.handleSpanClass\n });\n }\n }\n };\n addSpanClass("singleLineComments", true, false);\n addSpanClass("multiLineComments", true, false);\n addSpanClass("keywords", false, true);\n addSpanClass("literals", true, false);\n addSpanClass("delimiters", false, false);\n addSpanClass("identifiers", false, false);\n if(typeof(languages[lang].customFormatters) != "undefined") \n syntaxify.formatters[lang] = syntaxify.formatters[lang].concat(languages[lang].customFormatters);\n }\n}\n\nsyntaxify.addLanguages(syntaxify.languages);\n\n// Override the several built-in TiddlyWiki language-specific <pre> formatters\nfor(var i=0;i<config.formatters.length;i++) { \n if(config.formatters[i].name == "monospacedByLineForPlugin") { \n config.formatters[i].language = "javascript";\n config.formatters[i].byLine = true;\n config.formatters[i].handler = config.formatterHelpers.customClassesHelper; \n } \n if(config.formatters[i].name == "monospacedByLineForCSS") { \n config.formatters[i].language = "css";\n config.formatters[i].byLine = true;\n config.formatters[i].handler = config.formatterHelpers.customClassesHelper; \n } \n if(config.formatters[i].name == "monospacedByLineForTemplate") { \n config.formatters[i].language = "xml";\n config.formatters[i].byLine = true;\n config.formatters[i].handler = config.formatterHelpers.customClassesHelper; \n } \n if(config.formatters[i].name == "customClasses") {\n config.formatters[i].handler = config.formatterHelpers.customClassesHelper; \n if(typeof(config.formatters[i].termRegExp) == "undefined")\n config.formatters[i].termRegExp = new RegExp(config.formatters[i].terminator, "mg");\n }\n}\n\n// make syntaxify reliably accessible from dependent plugins even under IE.\nconfig.macros.syntaxify = syntaxify;\n//}}}\n