├── README.md ├── code-snippet.gif ├── debug-snippets ├── chrome-snippets.gif └── snippets.md └── fun-snippets ├── commonmark.js ├── examples ├── blur-focus.html ├── create-a-tour.html ├── fade-in-out-layers.html ├── have-a-look-around.html ├── print-camera.html ├── rotate-the-globe.html └── switch-2d-3d.html ├── index.html ├── script.js ├── snippet-page.png ├── snippets.md └── style.css /README.md: -------------------------------------------------------------------------------- 1 | 2 | # A collection of code snippets for ArcGIS API for JavaScript 3 | 4 | This repository contains code snippets that might come in handy when programming 3D applications with ArcGIS API for JavaScript. 5 | 6 | ## Development code snippets 7 | 8 | These are the ones that you use often and that follow the same pattern: setting renderers, symbols, labels, visual variables etc. To avoid to always go to the documentation and copy the examples there is a [VSCode plugin](https://marketplace.visualstudio.com/items?itemName=Esri.arcgis-jsapi-snippets) that you can install. 9 | 10 |
11 | How to use it 12 | 13 | ![VSCode-demo](./code-snippet.gif) 14 |
15 | 16 | In VSCode, go to Extensions, search for `arcgis api for javascript` and press the install button. Check out the list of code snippets that we added there. In your app, type in the prefix of the code snippet you want to add and press Tab . That should create the code snippet with the placeholders just like in the animated gif above. 17 | 18 | ## Debugging code snippets 19 | 20 | [These code snippets](./debug-snippets/snippets.md) are useful to figure out what's going on in the browser. What is my camera position? Why is the layer not showing up? Getting access to the view will grant you super powers, like access to the layers and their views etc. 21 | 22 | You will most likely use these code snippets in the browser. Therefore it's useful to also store them in the browser. Google Chrome has a useful feature in the dev tools called `Snippets`, where you can keep all of these snippets handy. 23 | 24 |
25 | Here's how it works 26 | 27 | ![Chrome-demo](./debug-snippets/chrome-snippets.gif) 28 |
29 | 30 | ## Fun code snippets 31 | 32 | These are the code snippets that you use to spice up your app. You might only need them once every 10 apps or so, but they provide some nice effects. For example rotating the globe, fading layers in or out, animating between several points etc. View them all live [here](https://ralucanicola.github.io/code-snippets-arcgis-api-js/fun-snippets/index.html). 33 | 34 | [![fun-snippets](./fun-snippets/snippet-page.png)](https://ralucanicola.github.io/code-snippets-arcgis-api-js/fun-snippets/index.html) 35 | 36 | Feel free to make a PR to contribute with your own snippets or suggest 37 | new code snippets with an [issue](https://github.com/RalucaNicola/code-snippets-arcgis-api-js/issues) :) 38 | -------------------------------------------------------------------------------- /code-snippet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RalucaNicola/code-snippets-arcgis-api-js/aafe3c608a80ce42dbec9f074a9a30edc9af0a42/code-snippet.gif -------------------------------------------------------------------------------- /debug-snippets/chrome-snippets.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RalucaNicola/code-snippets-arcgis-api-js/aafe3c608a80ce42dbec9f074a9a30edc9af0a42/debug-snippets/chrome-snippets.gif -------------------------------------------------------------------------------- /debug-snippets/snippets.md: -------------------------------------------------------------------------------- 1 | ### 💪 Get the view 2 | 3 | Once you get to the view, it will allow you to access the webscene, layers, layerviews etc. 4 | 5 | ```js 6 | const view = require("esri/views/View").views.getItemAt(0); 7 | ``` 8 | 9 | --- 10 | 11 | ### 👀 Show me the layers 12 | 13 | ```js 14 | view.map.allLayers.forEach((layer, index) => { 15 | console.log(`${index} -> ${layer.title}`); 16 | }); 17 | ``` 18 | 19 | ### 👻 Layer doesn't show up 20 | 21 | Step 1: check that the LayerView gets created 22 | 23 | ```js 24 | const layer = view.map.allLayers.getItemAt(index); 25 | 26 | view.whenLayerView(layer) 27 | .then((layerView) => console.log(layerView)) 28 | // if there were problems with the layerview, you'll get an error here 29 | .catch(console.error); 30 | ``` 31 | 32 | Further steps: check that your layer doesn't have `min/maxScale`, is underground etc. 33 | 34 | --- 35 | 36 | ### 🎥 Pretty print camera 37 | 38 | Print it in the console and set it in your app afterwards. 39 | 40 | ```js 41 | 42 | (function() { 43 | const p = view.camera.position; 44 | 45 | if (p.spatialReference.isWebMercator || p.spatialReference.isWGS84) { 46 | console.log(` 47 | { 48 | position: [ 49 | ${p.longitude.toFixed(8)}, 50 | ${p.latitude.toFixed(8)}, 51 | ${p.z.toFixed(5)} 52 | ], 53 | heading: ${view.camera.heading.toFixed(2)}, 54 | tilt: ${view.camera.tilt.toFixed(2)} 55 | }`); 56 | } 57 | else { 58 | console.log(` 59 | { 60 | position: { 61 | x: ${p.x.toFixed(5)}, 62 | y: ${p.y.toFixed(5)}, 63 | z: ${p.z.toFixed(3)}, 64 | spatialReference: ${p.spatialReference.wkid} 65 | }, 66 | heading: ${view.camera.heading.toFixed(2)}, 67 | tilt: ${view.camera.tilt.toFixed(2)} 68 | }`); 69 | } 70 | })(); 71 | 72 | // Code from Jesse van den Kieboom 73 | 74 | ``` 75 | 76 | --- 77 | 78 | ### Pretty print extent 79 | 80 | You might need the extent to set a [clippingArea](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html#clippingArea) on your local view. 81 | 82 | ```js 83 | 84 | (function() { 85 | const e = view.extent; 86 | 87 | console.log(` 88 | { 89 | xmin: ${e.xmin.toFixed(4)}, 90 | xmax: ${e.xmax.toFixed(4)}, 91 | ymin: ${e.ymin.toFixed(4)}, 92 | ymax: ${e.ymax.toFixed(4)}, 93 | spatialReference: ${e.spatialReference.wkid} 94 | }`); 95 | })(); 96 | 97 | // Code from Jesse van den Kieboom 98 | 99 | ``` 100 | 101 | --- 102 | 103 | ### ⌛ Show when the view finished updating 104 | 105 | ```js 106 | 107 | // works reliably only with version 4.12 108 | 109 | view.watch("updating", (value) => { 110 | const status = value ? "is updating" : "finished updating"; 111 | console.log(`View ${status}.`); 112 | }); 113 | 114 | ``` 115 | 116 | --- 117 | 118 | ### 🌗 Change daytime with arrow keys 119 | 120 | Setting the daytime in an app without a widget. Use this code snippet in the console. 121 | 122 | ```js 123 | view.when(() => { 124 | view.on("key-down", event => { 125 | if (event.key === "ArrowRight") { 126 | let lighting = view.environment.lighting.clone(); 127 | lighting.date.setMinutes(lighting.date.getMinutes() + 30); 128 | view.environment.lighting = lighting; 129 | event.stopPropagation(); 130 | } 131 | if (event.key === "ArrowLeft") { 132 | let lighting = view.environment.lighting.clone(); 133 | lighting.date.setMinutes(lighting.date.getMinutes() - 30); 134 | view.environment.lighting = lighting; 135 | event.stopPropagation(); 136 | } 137 | }); 138 | }); 139 | ``` 140 | -------------------------------------------------------------------------------- /fun-snippets/commonmark.js: -------------------------------------------------------------------------------- 1 | (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.commonmark = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o|$)/i, 23 | /^/, 35 | /\?>/, 36 | />/, 37 | /\]\]>/ 38 | ]; 39 | 40 | var reThematicBreak = /^(?:(?:\*[ \t]*){3,}|(?:_[ \t]*){3,}|(?:-[ \t]*){3,})[ \t]*$/; 41 | 42 | var reMaybeSpecial = /^[#`~*+_=<>0-9-]/; 43 | 44 | var reNonSpace = /[^ \t\f\v\r\n]/; 45 | 46 | var reBulletListMarker = /^[*+-]/; 47 | 48 | var reOrderedListMarker = /^(\d{1,9})([.)])/; 49 | 50 | var reATXHeadingMarker = /^#{1,6}(?:[ \t]+|$)/; 51 | 52 | var reCodeFence = /^`{3,}(?!.*`)|^~{3,}(?!.*~)/; 53 | 54 | var reClosingCodeFence = /^(?:`{3,}|~{3,})(?= *$)/; 55 | 56 | var reSetextHeadingLine = /^(?:=+|-+)[ \t]*$/; 57 | 58 | var reLineEnding = /\r\n|\n|\r/; 59 | 60 | // Returns true if string contains only space characters. 61 | var isBlank = function(s) { 62 | return !(reNonSpace.test(s)); 63 | }; 64 | 65 | var isSpaceOrTab = function(c) { 66 | return c === C_SPACE || c === C_TAB; 67 | }; 68 | 69 | var peek = function(ln, pos) { 70 | if (pos < ln.length) { 71 | return ln.charCodeAt(pos); 72 | } else { 73 | return -1; 74 | } 75 | }; 76 | 77 | // DOC PARSER 78 | 79 | // These are methods of a Parser object, defined below. 80 | 81 | // Returns true if block ends with a blank line, descending if needed 82 | // into lists and sublists. 83 | var endsWithBlankLine = function(block) { 84 | while (block) { 85 | if (block._lastLineBlank) { 86 | return true; 87 | } 88 | var t = block.type; 89 | if (t === 'list' || t === 'item') { 90 | block = block._lastChild; 91 | } else { 92 | break; 93 | } 94 | } 95 | return false; 96 | }; 97 | 98 | // Add a line to the block at the tip. We assume the tip 99 | // can accept lines -- that check should be done before calling this. 100 | var addLine = function() { 101 | if (this.partiallyConsumedTab) { 102 | this.offset += 1; // skip over tab 103 | // add space characters: 104 | var charsToTab = 4 - (this.column % 4); 105 | this.tip._string_content += (' '.repeat(charsToTab)); 106 | } 107 | this.tip._string_content += this.currentLine.slice(this.offset) + '\n'; 108 | }; 109 | 110 | // Add block of type tag as a child of the tip. If the tip can't 111 | // accept children, close and finalize it and try its parent, 112 | // and so on til we find a block that can accept children. 113 | var addChild = function(tag, offset) { 114 | while (!this.blocks[this.tip.type].canContain(tag)) { 115 | this.finalize(this.tip, this.lineNumber - 1); 116 | } 117 | 118 | var column_number = offset + 1; // offset 0 = column 1 119 | var newBlock = new Node(tag, [[this.lineNumber, column_number], [0, 0]]); 120 | newBlock._string_content = ''; 121 | this.tip.appendChild(newBlock); 122 | this.tip = newBlock; 123 | return newBlock; 124 | }; 125 | 126 | // Parse a list marker and return data on the marker (type, 127 | // start, delimiter, bullet character, padding) or null. 128 | var parseListMarker = function(parser, container) { 129 | var rest = parser.currentLine.slice(parser.nextNonspace); 130 | var match; 131 | var nextc; 132 | var spacesStartCol; 133 | var spacesStartOffset; 134 | var data = { type: null, 135 | tight: true, // lists are tight by default 136 | bulletChar: null, 137 | start: null, 138 | delimiter: null, 139 | padding: null, 140 | markerOffset: parser.indent }; 141 | if ((match = rest.match(reBulletListMarker))) { 142 | data.type = 'bullet'; 143 | data.bulletChar = match[0][0]; 144 | 145 | } else if ((match = rest.match(reOrderedListMarker)) && 146 | (container.type !== 'paragraph' || 147 | match[1] === '1')) { 148 | data.type = 'ordered'; 149 | data.start = parseInt(match[1]); 150 | data.delimiter = match[2]; 151 | } else { 152 | return null; 153 | } 154 | // make sure we have spaces after 155 | nextc = peek(parser.currentLine, parser.nextNonspace + match[0].length); 156 | if (!(nextc === -1 || nextc === C_TAB || nextc === C_SPACE)) { 157 | return null; 158 | } 159 | 160 | // if it interrupts paragraph, make sure first line isn't blank 161 | if (container.type === 'paragraph' && !parser.currentLine.slice(parser.nextNonspace + match[0].length).match(reNonSpace)) { 162 | return null; 163 | } 164 | 165 | // we've got a match! advance offset and calculate padding 166 | parser.advanceNextNonspace(); // to start of marker 167 | parser.advanceOffset(match[0].length, true); // to end of marker 168 | spacesStartCol = parser.column; 169 | spacesStartOffset = parser.offset; 170 | do { 171 | parser.advanceOffset(1, true); 172 | nextc = peek(parser.currentLine, parser.offset); 173 | } while (parser.column - spacesStartCol < 5 && 174 | isSpaceOrTab(nextc)); 175 | var blank_item = peek(parser.currentLine, parser.offset) === -1; 176 | var spaces_after_marker = parser.column - spacesStartCol; 177 | if (spaces_after_marker >= 5 || 178 | spaces_after_marker < 1 || 179 | blank_item) { 180 | data.padding = match[0].length + 1; 181 | parser.column = spacesStartCol; 182 | parser.offset = spacesStartOffset; 183 | if (isSpaceOrTab(peek(parser.currentLine, parser.offset))) { 184 | parser.advanceOffset(1, true); 185 | } 186 | } else { 187 | data.padding = match[0].length + spaces_after_marker; 188 | } 189 | return data; 190 | }; 191 | 192 | // Returns true if the two list items are of the same type, 193 | // with the same delimiter and bullet character. This is used 194 | // in agglomerating list items into lists. 195 | var listsMatch = function(list_data, item_data) { 196 | return (list_data.type === item_data.type && 197 | list_data.delimiter === item_data.delimiter && 198 | list_data.bulletChar === item_data.bulletChar); 199 | }; 200 | 201 | // Finalize and close any unmatched blocks. 202 | var closeUnmatchedBlocks = function() { 203 | if (!this.allClosed) { 204 | // finalize any blocks not matched 205 | while (this.oldtip !== this.lastMatchedContainer) { 206 | var parent = this.oldtip._parent; 207 | this.finalize(this.oldtip, this.lineNumber - 1); 208 | this.oldtip = parent; 209 | } 210 | this.allClosed = true; 211 | } 212 | }; 213 | 214 | // 'finalize' is run when the block is closed. 215 | // 'continue' is run to check whether the block is continuing 216 | // at a certain line and offset (e.g. whether a block quote 217 | // contains a `>`. It returns 0 for matched, 1 for not matched, 218 | // and 2 for "we've dealt with this line completely, go to next." 219 | var blocks = { 220 | document: { 221 | continue: function() { return 0; }, 222 | finalize: function() { return; }, 223 | canContain: function(t) { return (t !== 'item'); }, 224 | acceptsLines: false 225 | }, 226 | list: { 227 | continue: function() { return 0; }, 228 | finalize: function(parser, block) { 229 | var item = block._firstChild; 230 | while (item) { 231 | // check for non-final list item ending with blank line: 232 | if (endsWithBlankLine(item) && item._next) { 233 | block._listData.tight = false; 234 | break; 235 | } 236 | // recurse into children of list item, to see if there are 237 | // spaces between any of them: 238 | var subitem = item._firstChild; 239 | while (subitem) { 240 | if (endsWithBlankLine(subitem) && 241 | (item._next || subitem._next)) { 242 | block._listData.tight = false; 243 | break; 244 | } 245 | subitem = subitem._next; 246 | } 247 | item = item._next; 248 | } 249 | }, 250 | canContain: function(t) { return (t === 'item'); }, 251 | acceptsLines: false 252 | }, 253 | block_quote: { 254 | continue: function(parser) { 255 | var ln = parser.currentLine; 256 | if (!parser.indented && 257 | peek(ln, parser.nextNonspace) === C_GREATERTHAN) { 258 | parser.advanceNextNonspace(); 259 | parser.advanceOffset(1, false); 260 | if (isSpaceOrTab(peek(ln, parser.offset))) { 261 | parser.advanceOffset(1, true); 262 | } 263 | } else { 264 | return 1; 265 | } 266 | return 0; 267 | }, 268 | finalize: function() { return; }, 269 | canContain: function(t) { return (t !== 'item'); }, 270 | acceptsLines: false 271 | }, 272 | item: { 273 | continue: function(parser, container) { 274 | if (parser.blank) { 275 | if (container._firstChild == null) { 276 | // Blank line after empty list item 277 | return 1; 278 | } else { 279 | parser.advanceNextNonspace(); 280 | } 281 | } else if (parser.indent >= 282 | container._listData.markerOffset + 283 | container._listData.padding) { 284 | parser.advanceOffset(container._listData.markerOffset + 285 | container._listData.padding, true); 286 | } else { 287 | return 1; 288 | } 289 | return 0; 290 | }, 291 | finalize: function() { return; }, 292 | canContain: function(t) { return (t !== 'item'); }, 293 | acceptsLines: false 294 | }, 295 | heading: { 296 | continue: function() { 297 | // a heading can never container > 1 line, so fail to match: 298 | return 1; 299 | }, 300 | finalize: function() { return; }, 301 | canContain: function() { return false; }, 302 | acceptsLines: false 303 | }, 304 | thematic_break: { 305 | continue: function() { 306 | // a thematic break can never container > 1 line, so fail to match: 307 | return 1; 308 | }, 309 | finalize: function() { return; }, 310 | canContain: function() { return false; }, 311 | acceptsLines: false 312 | }, 313 | code_block: { 314 | continue: function(parser, container) { 315 | var ln = parser.currentLine; 316 | var indent = parser.indent; 317 | if (container._isFenced) { // fenced 318 | var match = (indent <= 3 && 319 | ln.charAt(parser.nextNonspace) === container._fenceChar && 320 | ln.slice(parser.nextNonspace).match(reClosingCodeFence)); 321 | if (match && match[0].length >= container._fenceLength) { 322 | // closing fence - we're at end of line, so we can return 323 | parser.finalize(container, parser.lineNumber); 324 | return 2; 325 | } else { 326 | // skip optional spaces of fence offset 327 | var i = container._fenceOffset; 328 | while (i > 0 && isSpaceOrTab(peek(ln, parser.offset))) { 329 | parser.advanceOffset(1, true); 330 | i--; 331 | } 332 | } 333 | } else { // indented 334 | if (indent >= CODE_INDENT) { 335 | parser.advanceOffset(CODE_INDENT, true); 336 | } else if (parser.blank) { 337 | parser.advanceNextNonspace(); 338 | } else { 339 | return 1; 340 | } 341 | } 342 | return 0; 343 | }, 344 | finalize: function(parser, block) { 345 | if (block._isFenced) { // fenced 346 | // first line becomes info string 347 | var content = block._string_content; 348 | var newlinePos = content.indexOf('\n'); 349 | var firstLine = content.slice(0, newlinePos); 350 | var rest = content.slice(newlinePos + 1); 351 | block.info = unescapeString(firstLine.trim()); 352 | block._literal = rest; 353 | } else { // indented 354 | block._literal = block._string_content.replace(/(\n *)+$/, '\n'); 355 | } 356 | block._string_content = null; // allow GC 357 | }, 358 | canContain: function() { return false; }, 359 | acceptsLines: true 360 | }, 361 | html_block: { 362 | continue: function(parser, container) { 363 | return ((parser.blank && 364 | (container._htmlBlockType === 6 || 365 | container._htmlBlockType === 7)) ? 1 : 0); 366 | }, 367 | finalize: function(parser, block) { 368 | block._literal = block._string_content.replace(/(\n *)+$/, ''); 369 | block._string_content = null; // allow GC 370 | }, 371 | canContain: function() { return false; }, 372 | acceptsLines: true 373 | }, 374 | paragraph: { 375 | continue: function(parser) { 376 | return (parser.blank ? 1 : 0); 377 | }, 378 | finalize: function(parser, block) { 379 | var pos; 380 | var hasReferenceDefs = false; 381 | 382 | // try parsing the beginning as link reference definitions: 383 | while (peek(block._string_content, 0) === C_OPEN_BRACKET && 384 | (pos = 385 | parser.inlineParser.parseReference(block._string_content, 386 | parser.refmap))) { 387 | block._string_content = block._string_content.slice(pos); 388 | hasReferenceDefs = true; 389 | } 390 | if (hasReferenceDefs && isBlank(block._string_content)) { 391 | block.unlink(); 392 | } 393 | }, 394 | canContain: function() { return false; }, 395 | acceptsLines: true 396 | } 397 | }; 398 | 399 | // block start functions. Return values: 400 | // 0 = no match 401 | // 1 = matched container, keep going 402 | // 2 = matched leaf, no more block starts 403 | var blockStarts = [ 404 | // block quote 405 | function(parser) { 406 | if (!parser.indented && 407 | peek(parser.currentLine, parser.nextNonspace) === C_GREATERTHAN) { 408 | parser.advanceNextNonspace(); 409 | parser.advanceOffset(1, false); 410 | // optional following space 411 | if (isSpaceOrTab(peek(parser.currentLine, parser.offset))) { 412 | parser.advanceOffset(1, true); 413 | } 414 | parser.closeUnmatchedBlocks(); 415 | parser.addChild('block_quote', parser.nextNonspace); 416 | return 1; 417 | } else { 418 | return 0; 419 | } 420 | }, 421 | 422 | // ATX heading 423 | function(parser) { 424 | var match; 425 | if (!parser.indented && 426 | (match = parser.currentLine.slice(parser.nextNonspace).match(reATXHeadingMarker))) { 427 | parser.advanceNextNonspace(); 428 | parser.advanceOffset(match[0].length, false); 429 | parser.closeUnmatchedBlocks(); 430 | var container = parser.addChild('heading', parser.nextNonspace); 431 | container.level = match[0].trim().length; // number of #s 432 | // remove trailing ###s: 433 | container._string_content = 434 | parser.currentLine.slice(parser.offset).replace(/^[ \t]*#+[ \t]*$/, '').replace(/[ \t]+#+[ \t]*$/, ''); 435 | parser.advanceOffset(parser.currentLine.length - parser.offset); 436 | return 2; 437 | } else { 438 | return 0; 439 | } 440 | }, 441 | 442 | // Fenced code block 443 | function(parser) { 444 | var match; 445 | if (!parser.indented && 446 | (match = parser.currentLine.slice(parser.nextNonspace).match(reCodeFence))) { 447 | var fenceLength = match[0].length; 448 | parser.closeUnmatchedBlocks(); 449 | var container = parser.addChild('code_block', parser.nextNonspace); 450 | container._isFenced = true; 451 | container._fenceLength = fenceLength; 452 | container._fenceChar = match[0][0]; 453 | container._fenceOffset = parser.indent; 454 | parser.advanceNextNonspace(); 455 | parser.advanceOffset(fenceLength, false); 456 | return 2; 457 | } else { 458 | return 0; 459 | } 460 | }, 461 | 462 | // HTML block 463 | function(parser, container) { 464 | if (!parser.indented && 465 | peek(parser.currentLine, parser.nextNonspace) === C_LESSTHAN) { 466 | var s = parser.currentLine.slice(parser.nextNonspace); 467 | var blockType; 468 | 469 | for (blockType = 1; blockType <= 7; blockType++) { 470 | if (reHtmlBlockOpen[blockType].test(s) && 471 | (blockType < 7 || 472 | container.type !== 'paragraph')) { 473 | parser.closeUnmatchedBlocks(); 474 | // We don't adjust parser.offset; 475 | // spaces are part of the HTML block: 476 | var b = parser.addChild('html_block', 477 | parser.offset); 478 | b._htmlBlockType = blockType; 479 | return 2; 480 | } 481 | } 482 | } 483 | 484 | return 0; 485 | 486 | }, 487 | 488 | // Setext heading 489 | function(parser, container) { 490 | var match; 491 | if (!parser.indented && 492 | container.type === 'paragraph' && 493 | ((match = parser.currentLine.slice(parser.nextNonspace).match(reSetextHeadingLine)))) { 494 | parser.closeUnmatchedBlocks(); 495 | var heading = new Node('heading', container.sourcepos); 496 | heading.level = match[0][0] === '=' ? 1 : 2; 497 | heading._string_content = container._string_content; 498 | container.insertAfter(heading); 499 | container.unlink(); 500 | parser.tip = heading; 501 | parser.advanceOffset(parser.currentLine.length - parser.offset, false); 502 | return 2; 503 | } else { 504 | return 0; 505 | } 506 | }, 507 | 508 | // thematic break 509 | function(parser) { 510 | if (!parser.indented && 511 | reThematicBreak.test(parser.currentLine.slice(parser.nextNonspace))) { 512 | parser.closeUnmatchedBlocks(); 513 | parser.addChild('thematic_break', parser.nextNonspace); 514 | parser.advanceOffset(parser.currentLine.length - parser.offset, false); 515 | return 2; 516 | } else { 517 | return 0; 518 | } 519 | }, 520 | 521 | // list item 522 | function(parser, container) { 523 | var data; 524 | 525 | if ((!parser.indented || container.type === 'list') 526 | && (data = parseListMarker(parser, container))) { 527 | parser.closeUnmatchedBlocks(); 528 | 529 | // add the list if needed 530 | if (parser.tip.type !== 'list' || 531 | !(listsMatch(container._listData, data))) { 532 | container = parser.addChild('list', parser.nextNonspace); 533 | container._listData = data; 534 | } 535 | 536 | // add the list item 537 | container = parser.addChild('item', parser.nextNonspace); 538 | container._listData = data; 539 | return 1; 540 | } else { 541 | return 0; 542 | } 543 | }, 544 | 545 | // indented code block 546 | function(parser) { 547 | if (parser.indented && 548 | parser.tip.type !== 'paragraph' && 549 | !parser.blank) { 550 | // indented code 551 | parser.advanceOffset(CODE_INDENT, true); 552 | parser.closeUnmatchedBlocks(); 553 | parser.addChild('code_block', parser.offset); 554 | return 2; 555 | } else { 556 | return 0; 557 | } 558 | } 559 | 560 | ]; 561 | 562 | var advanceOffset = function(count, columns) { 563 | var currentLine = this.currentLine; 564 | var charsToTab, charsToAdvance; 565 | var c; 566 | while (count > 0 && (c = currentLine[this.offset])) { 567 | if (c === '\t') { 568 | charsToTab = 4 - (this.column % 4); 569 | if (columns) { 570 | this.partiallyConsumedTab = charsToTab > count; 571 | charsToAdvance = charsToTab > count ? count : charsToTab; 572 | this.column += charsToAdvance; 573 | this.offset += this.partiallyConsumedTab ? 0 : 1; 574 | count -= charsToAdvance; 575 | } else { 576 | this.partiallyConsumedTab = false; 577 | this.column += charsToTab; 578 | this.offset += 1; 579 | count -= 1; 580 | } 581 | } else { 582 | this.partiallyConsumedTab = false; 583 | this.offset += 1; 584 | this.column += 1; // assume ascii; block starts are ascii 585 | count -= 1; 586 | } 587 | } 588 | }; 589 | 590 | var advanceNextNonspace = function() { 591 | this.offset = this.nextNonspace; 592 | this.column = this.nextNonspaceColumn; 593 | this.partiallyConsumedTab = false; 594 | }; 595 | 596 | var findNextNonspace = function() { 597 | var currentLine = this.currentLine; 598 | var i = this.offset; 599 | var cols = this.column; 600 | var c; 601 | 602 | while ((c = currentLine.charAt(i)) !== '') { 603 | if (c === ' ') { 604 | i++; 605 | cols++; 606 | } else if (c === '\t') { 607 | i++; 608 | cols += (4 - (cols % 4)); 609 | } else { 610 | break; 611 | } 612 | } 613 | this.blank = (c === '\n' || c === '\r' || c === ''); 614 | this.nextNonspace = i; 615 | this.nextNonspaceColumn = cols; 616 | this.indent = this.nextNonspaceColumn - this.column; 617 | this.indented = this.indent >= CODE_INDENT; 618 | }; 619 | 620 | // Analyze a line of text and update the document appropriately. 621 | // We parse markdown text by calling this on each line of input, 622 | // then finalizing the document. 623 | var incorporateLine = function(ln) { 624 | var all_matched = true; 625 | var t; 626 | 627 | var container = this.doc; 628 | this.oldtip = this.tip; 629 | this.offset = 0; 630 | this.column = 0; 631 | this.blank = false; 632 | this.partiallyConsumedTab = false; 633 | this.lineNumber += 1; 634 | 635 | // replace NUL characters for security 636 | if (ln.indexOf('\u0000') !== -1) { 637 | ln = ln.replace(/\0/g, '\uFFFD'); 638 | } 639 | 640 | this.currentLine = ln; 641 | 642 | // For each containing block, try to parse the associated line start. 643 | // Bail out on failure: container will point to the last matching block. 644 | // Set all_matched to false if not all containers match. 645 | var lastChild; 646 | while ((lastChild = container._lastChild) && lastChild._open) { 647 | container = lastChild; 648 | 649 | this.findNextNonspace(); 650 | 651 | switch (this.blocks[container.type].continue(this, container)) { 652 | case 0: // we've matched, keep going 653 | break; 654 | case 1: // we've failed to match a block 655 | all_matched = false; 656 | break; 657 | case 2: // we've hit end of line for fenced code close and can return 658 | this.lastLineLength = ln.length; 659 | return; 660 | default: 661 | throw 'continue returned illegal value, must be 0, 1, or 2'; 662 | } 663 | if (!all_matched) { 664 | container = container._parent; // back up to last matching block 665 | break; 666 | } 667 | } 668 | 669 | this.allClosed = (container === this.oldtip); 670 | this.lastMatchedContainer = container; 671 | 672 | var matchedLeaf = container.type !== 'paragraph' && 673 | blocks[container.type].acceptsLines; 674 | var starts = this.blockStarts; 675 | var startsLen = starts.length; 676 | // Unless last matched container is a code block, try new container starts, 677 | // adding children to the last matched container: 678 | while (!matchedLeaf) { 679 | 680 | this.findNextNonspace(); 681 | 682 | // this is a little performance optimization: 683 | if (!this.indented && 684 | !reMaybeSpecial.test(ln.slice(this.nextNonspace))) { 685 | this.advanceNextNonspace(); 686 | break; 687 | } 688 | 689 | var i = 0; 690 | while (i < startsLen) { 691 | var res = starts[i](this, container); 692 | if (res === 1) { 693 | container = this.tip; 694 | break; 695 | } else if (res === 2) { 696 | container = this.tip; 697 | matchedLeaf = true; 698 | break; 699 | } else { 700 | i++; 701 | } 702 | } 703 | 704 | if (i === startsLen) { // nothing matched 705 | this.advanceNextNonspace(); 706 | break; 707 | } 708 | } 709 | 710 | // What remains at the offset is a text line. Add the text to the 711 | // appropriate container. 712 | 713 | // First check for a lazy paragraph continuation: 714 | if (!this.allClosed && !this.blank && 715 | this.tip.type === 'paragraph') { 716 | // lazy paragraph continuation 717 | this.addLine(); 718 | 719 | } else { // not a lazy continuation 720 | 721 | // finalize any blocks not matched 722 | this.closeUnmatchedBlocks(); 723 | if (this.blank && container.lastChild) { 724 | container.lastChild._lastLineBlank = true; 725 | } 726 | 727 | t = container.type; 728 | 729 | // Block quote lines are never blank as they start with > 730 | // and we don't count blanks in fenced code for purposes of tight/loose 731 | // lists or breaking out of lists. We also don't set _lastLineBlank 732 | // on an empty list item, or if we just closed a fenced block. 733 | var lastLineBlank = this.blank && 734 | !(t === 'block_quote' || 735 | (t === 'code_block' && container._isFenced) || 736 | (t === 'item' && 737 | !container._firstChild && 738 | container.sourcepos[0][0] === this.lineNumber)); 739 | 740 | // propagate lastLineBlank up through parents: 741 | var cont = container; 742 | while (cont) { 743 | cont._lastLineBlank = lastLineBlank; 744 | cont = cont._parent; 745 | } 746 | 747 | if (this.blocks[t].acceptsLines) { 748 | this.addLine(); 749 | // if HtmlBlock, check for end condition 750 | if (t === 'html_block' && 751 | container._htmlBlockType >= 1 && 752 | container._htmlBlockType <= 5 && 753 | reHtmlBlockClose[container._htmlBlockType].test(this.currentLine.slice(this.offset))) { 754 | this.finalize(container, this.lineNumber); 755 | } 756 | 757 | } else if (this.offset < ln.length && !this.blank) { 758 | // create paragraph container for line 759 | container = this.addChild('paragraph', this.offset); 760 | this.advanceNextNonspace(); 761 | this.addLine(); 762 | } 763 | } 764 | this.lastLineLength = ln.length; 765 | }; 766 | 767 | // Finalize a block. Close it and do any necessary postprocessing, 768 | // e.g. creating string_content from strings, setting the 'tight' 769 | // or 'loose' status of a list, and parsing the beginnings 770 | // of paragraphs for reference definitions. Reset the tip to the 771 | // parent of the closed block. 772 | var finalize = function(block, lineNumber) { 773 | var above = block._parent; 774 | block._open = false; 775 | block.sourcepos[1] = [lineNumber, this.lastLineLength]; 776 | 777 | this.blocks[block.type].finalize(this, block); 778 | 779 | this.tip = above; 780 | }; 781 | 782 | // Walk through a block & children recursively, parsing string content 783 | // into inline content where appropriate. 784 | var processInlines = function(block) { 785 | var node, event, t; 786 | var walker = block.walker(); 787 | this.inlineParser.refmap = this.refmap; 788 | this.inlineParser.options = this.options; 789 | while ((event = walker.next())) { 790 | node = event.node; 791 | t = node.type; 792 | if (!event.entering && (t === 'paragraph' || t === 'heading')) { 793 | this.inlineParser.parse(node); 794 | } 795 | } 796 | }; 797 | 798 | var Document = function() { 799 | var doc = new Node('document', [[1, 1], [0, 0]]); 800 | return doc; 801 | }; 802 | 803 | // The main parsing function. Returns a parsed document AST. 804 | var parse = function(input) { 805 | this.doc = new Document(); 806 | this.tip = this.doc; 807 | this.refmap = {}; 808 | this.lineNumber = 0; 809 | this.lastLineLength = 0; 810 | this.offset = 0; 811 | this.column = 0; 812 | this.lastMatchedContainer = this.doc; 813 | this.currentLine = ""; 814 | if (this.options.time) { console.time("preparing input"); } 815 | var lines = input.split(reLineEnding); 816 | var len = lines.length; 817 | if (input.charCodeAt(input.length - 1) === C_NEWLINE) { 818 | // ignore last blank line created by final newline 819 | len -= 1; 820 | } 821 | if (this.options.time) { console.timeEnd("preparing input"); } 822 | if (this.options.time) { console.time("block parsing"); } 823 | for (var i = 0; i < len; i++) { 824 | this.incorporateLine(lines[i]); 825 | } 826 | while (this.tip) { 827 | this.finalize(this.tip, len); 828 | } 829 | if (this.options.time) { console.timeEnd("block parsing"); } 830 | if (this.options.time) { console.time("inline parsing"); } 831 | this.processInlines(this.doc); 832 | if (this.options.time) { console.timeEnd("inline parsing"); } 833 | return this.doc; 834 | }; 835 | 836 | 837 | // The Parser object. 838 | function Parser(options){ 839 | return { 840 | doc: new Document(), 841 | blocks: blocks, 842 | blockStarts: blockStarts, 843 | tip: this.doc, 844 | oldtip: this.doc, 845 | currentLine: "", 846 | lineNumber: 0, 847 | offset: 0, 848 | column: 0, 849 | nextNonspace: 0, 850 | nextNonspaceColumn: 0, 851 | indent: 0, 852 | indented: false, 853 | blank: false, 854 | partiallyConsumedTab: false, 855 | allClosed: true, 856 | lastMatchedContainer: this.doc, 857 | refmap: {}, 858 | lastLineLength: 0, 859 | inlineParser: new InlineParser(options), 860 | findNextNonspace: findNextNonspace, 861 | advanceOffset: advanceOffset, 862 | advanceNextNonspace: advanceNextNonspace, 863 | addLine: addLine, 864 | addChild: addChild, 865 | incorporateLine: incorporateLine, 866 | finalize: finalize, 867 | processInlines: processInlines, 868 | closeUnmatchedBlocks: closeUnmatchedBlocks, 869 | parse: parse, 870 | options: options || {} 871 | }; 872 | } 873 | 874 | module.exports = Parser; 875 | 876 | },{"./common":2,"./inlines":5,"./node":6}],2:[function(require,module,exports){ 877 | "use strict"; 878 | 879 | var encode = require('mdurl/encode'); 880 | var decode = require('mdurl/decode'); 881 | 882 | var C_BACKSLASH = 92; 883 | 884 | var decodeHTML = require('entities').decodeHTML; 885 | 886 | var ENTITY = "&(?:#x[a-f0-9]{1,8}|#[0-9]{1,8}|[a-z][a-z0-9]{1,31});"; 887 | 888 | var TAGNAME = '[A-Za-z][A-Za-z0-9-]*'; 889 | var ATTRIBUTENAME = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; 890 | var UNQUOTEDVALUE = "[^\"'=<>`\\x00-\\x20]+"; 891 | var SINGLEQUOTEDVALUE = "'[^']*'"; 892 | var DOUBLEQUOTEDVALUE = '"[^"]*"'; 893 | var ATTRIBUTEVALUE = "(?:" + UNQUOTEDVALUE + "|" + SINGLEQUOTEDVALUE + "|" + DOUBLEQUOTEDVALUE + ")"; 894 | var ATTRIBUTEVALUESPEC = "(?:" + "\\s*=" + "\\s*" + ATTRIBUTEVALUE + ")"; 895 | var ATTRIBUTE = "(?:" + "\\s+" + ATTRIBUTENAME + ATTRIBUTEVALUESPEC + "?)"; 896 | var OPENTAG = "<" + TAGNAME + ATTRIBUTE + "*" + "\\s*/?>"; 897 | var CLOSETAG = "]"; 898 | var HTMLCOMMENT = "|"; 899 | var PROCESSINGINSTRUCTION = "[<][?].*?[?][>]"; 900 | var DECLARATION = "]*>"; 901 | var CDATA = ""; 902 | var HTMLTAG = "(?:" + OPENTAG + "|" + CLOSETAG + "|" + HTMLCOMMENT + "|" + 903 | PROCESSINGINSTRUCTION + "|" + DECLARATION + "|" + CDATA + ")"; 904 | var reHtmlTag = new RegExp('^' + HTMLTAG, 'i'); 905 | 906 | var reBackslashOrAmp = /[\\&]/; 907 | 908 | var ESCAPABLE = '[!"#$%&\'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]'; 909 | 910 | var reEntityOrEscapedChar = new RegExp('\\\\' + ESCAPABLE + '|' + ENTITY, 'gi'); 911 | 912 | var XMLSPECIAL = '[&<>"]'; 913 | 914 | var reXmlSpecial = new RegExp(XMLSPECIAL, 'g'); 915 | 916 | var reXmlSpecialOrEntity = new RegExp(ENTITY + '|' + XMLSPECIAL, 'gi'); 917 | 918 | var unescapeChar = function(s) { 919 | if (s.charCodeAt(0) === C_BACKSLASH) { 920 | return s.charAt(1); 921 | } else { 922 | return decodeHTML(s); 923 | } 924 | }; 925 | 926 | // Replace entities and backslash escapes with literal characters. 927 | var unescapeString = function(s) { 928 | if (reBackslashOrAmp.test(s)) { 929 | return s.replace(reEntityOrEscapedChar, unescapeChar); 930 | } else { 931 | return s; 932 | } 933 | }; 934 | 935 | var normalizeURI = function(uri) { 936 | try { 937 | return encode(decode(uri)); 938 | } 939 | catch(err) { 940 | return uri; 941 | } 942 | }; 943 | 944 | var replaceUnsafeChar = function(s) { 945 | switch (s) { 946 | case '&': 947 | return '&'; 948 | case '<': 949 | return '<'; 950 | case '>': 951 | return '>'; 952 | case '"': 953 | return '"'; 954 | default: 955 | return s; 956 | } 957 | }; 958 | 959 | var escapeXml = function(s, preserve_entities) { 960 | if (reXmlSpecial.test(s)) { 961 | if (preserve_entities) { 962 | return s.replace(reXmlSpecialOrEntity, replaceUnsafeChar); 963 | } else { 964 | return s.replace(reXmlSpecial, replaceUnsafeChar); 965 | } 966 | } else { 967 | return s; 968 | } 969 | }; 970 | 971 | module.exports = { unescapeString: unescapeString, 972 | normalizeURI: normalizeURI, 973 | escapeXml: escapeXml, 974 | reHtmlTag: reHtmlTag, 975 | OPENTAG: OPENTAG, 976 | CLOSETAG: CLOSETAG, 977 | ENTITY: ENTITY, 978 | ESCAPABLE: ESCAPABLE 979 | }; 980 | 981 | },{"entities":11,"mdurl/decode":19,"mdurl/encode":20}],3:[function(require,module,exports){ 982 | "use strict"; 983 | 984 | // derived from https://github.com/mathiasbynens/String.fromCodePoint 985 | /*! http://mths.be/fromcodepoint v0.2.1 by @mathias */ 986 | if (String.fromCodePoint) { 987 | module.exports = function (_) { 988 | try { 989 | return String.fromCodePoint(_); 990 | } catch (e) { 991 | if (e instanceof RangeError) { 992 | return String.fromCharCode(0xFFFD); 993 | } 994 | throw e; 995 | } 996 | }; 997 | 998 | } else { 999 | 1000 | var stringFromCharCode = String.fromCharCode; 1001 | var floor = Math.floor; 1002 | var fromCodePoint = function() { 1003 | var MAX_SIZE = 0x4000; 1004 | var codeUnits = []; 1005 | var highSurrogate; 1006 | var lowSurrogate; 1007 | var index = -1; 1008 | var length = arguments.length; 1009 | if (!length) { 1010 | return ''; 1011 | } 1012 | var result = ''; 1013 | while (++index < length) { 1014 | var codePoint = Number(arguments[index]); 1015 | if ( 1016 | !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity` 1017 | codePoint < 0 || // not a valid Unicode code point 1018 | codePoint > 0x10FFFF || // not a valid Unicode code point 1019 | floor(codePoint) !== codePoint // not an integer 1020 | ) { 1021 | return String.fromCharCode(0xFFFD); 1022 | } 1023 | if (codePoint <= 0xFFFF) { // BMP code point 1024 | codeUnits.push(codePoint); 1025 | } else { // Astral code point; split in surrogate halves 1026 | // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae 1027 | codePoint -= 0x10000; 1028 | highSurrogate = (codePoint >> 10) + 0xD800; 1029 | lowSurrogate = (codePoint % 0x400) + 0xDC00; 1030 | codeUnits.push(highSurrogate, lowSurrogate); 1031 | } 1032 | if (index + 1 === length || codeUnits.length > MAX_SIZE) { 1033 | result += stringFromCharCode.apply(null, codeUnits); 1034 | codeUnits.length = 0; 1035 | } 1036 | } 1037 | return result; 1038 | }; 1039 | module.exports = fromCodePoint; 1040 | } 1041 | 1042 | },{}],4:[function(require,module,exports){ 1043 | "use strict"; 1044 | 1045 | // commonmark.js - CommomMark in JavaScript 1046 | // Copyright (C) 2014 John MacFarlane 1047 | // License: BSD3. 1048 | 1049 | // Basic usage: 1050 | // 1051 | // var commonmark = require('commonmark'); 1052 | // var parser = new commonmark.Parser(); 1053 | // var renderer = new commonmark.HtmlRenderer(); 1054 | // console.log(renderer.render(parser.parse('Hello *world*'))); 1055 | 1056 | module.exports.Node = require('./node'); 1057 | module.exports.Parser = require('./blocks'); 1058 | module.exports.HtmlRenderer = require('./render/html'); 1059 | module.exports.XmlRenderer = require('./render/xml'); 1060 | 1061 | },{"./blocks":1,"./node":6,"./render/html":8,"./render/xml":10}],5:[function(require,module,exports){ 1062 | "use strict"; 1063 | 1064 | var Node = require('./node'); 1065 | var common = require('./common'); 1066 | var normalizeReference = require('./normalize-reference'); 1067 | 1068 | var normalizeURI = common.normalizeURI; 1069 | var unescapeString = common.unescapeString; 1070 | var fromCodePoint = require('./from-code-point.js'); 1071 | var decodeHTML = require('entities').decodeHTML; 1072 | require('string.prototype.repeat'); // Polyfill for String.prototype.repeat 1073 | 1074 | // Constants for character codes: 1075 | 1076 | var C_NEWLINE = 10; 1077 | var C_ASTERISK = 42; 1078 | var C_UNDERSCORE = 95; 1079 | var C_BACKTICK = 96; 1080 | var C_OPEN_BRACKET = 91; 1081 | var C_CLOSE_BRACKET = 93; 1082 | var C_LESSTHAN = 60; 1083 | var C_BANG = 33; 1084 | var C_BACKSLASH = 92; 1085 | var C_AMPERSAND = 38; 1086 | var C_OPEN_PAREN = 40; 1087 | var C_CLOSE_PAREN = 41; 1088 | var C_COLON = 58; 1089 | var C_SINGLEQUOTE = 39; 1090 | var C_DOUBLEQUOTE = 34; 1091 | 1092 | // Some regexps used in inline parser: 1093 | 1094 | var ESCAPABLE = common.ESCAPABLE; 1095 | var ESCAPED_CHAR = '\\\\' + ESCAPABLE; 1096 | 1097 | var ENTITY = common.ENTITY; 1098 | var reHtmlTag = common.reHtmlTag; 1099 | 1100 | var rePunctuation = new RegExp(/[!"#$%&'()*+,\-./:;<=>?@\[\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/); 1101 | 1102 | var reLinkTitle = new RegExp( 1103 | '^(?:"(' + ESCAPED_CHAR + '|[^"\\x00])*"' + 1104 | '|' + 1105 | '\'(' + ESCAPED_CHAR + '|[^\'\\x00])*\'' + 1106 | '|' + 1107 | '\\((' + ESCAPED_CHAR + '|[^)\\x00])*\\))'); 1108 | 1109 | var reLinkDestinationBraces = new RegExp( 1110 | '^(?:[<](?:[^ <>\\t\\n\\\\\\x00]' + '|' + ESCAPED_CHAR + '|' + '\\\\)*[>])'); 1111 | 1112 | var reEscapable = new RegExp('^' + ESCAPABLE); 1113 | 1114 | var reEntityHere = new RegExp('^' + ENTITY, 'i'); 1115 | 1116 | var reTicks = /`+/; 1117 | 1118 | var reTicksHere = /^`+/; 1119 | 1120 | var reEllipses = /\.\.\./g; 1121 | 1122 | var reDash = /--+/g; 1123 | 1124 | var reEmailAutolink = /^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/; 1125 | 1126 | var reAutolink = /^<[A-Za-z][A-Za-z0-9.+-]{1,31}:[^<>\x00-\x20]*>/i; 1127 | 1128 | var reSpnl = /^ *(?:\n *)?/; 1129 | 1130 | var reWhitespaceChar = /^[ \t\n\x0b\x0c\x0d]/; 1131 | 1132 | var reWhitespace = /[ \t\n\x0b\x0c\x0d]+/g; 1133 | 1134 | var reUnicodeWhitespaceChar = /^\s/; 1135 | 1136 | var reFinalSpace = / *$/; 1137 | 1138 | var reInitialSpace = /^ */; 1139 | 1140 | var reSpaceAtEndOfLine = /^ *(?:\n|$)/; 1141 | 1142 | var reLinkLabel = new RegExp('^\\[(?:[^\\\\\\[\\]]|' + ESCAPED_CHAR + 1143 | '|\\\\){0,1000}\\]'); 1144 | 1145 | // Matches a string of non-special characters. 1146 | var reMain = /^[^\n`\[\]\\!<&*_'"]+/m; 1147 | 1148 | var text = function(s) { 1149 | var node = new Node('text'); 1150 | node._literal = s; 1151 | return node; 1152 | }; 1153 | 1154 | // INLINE PARSER 1155 | 1156 | // These are methods of an InlineParser object, defined below. 1157 | // An InlineParser keeps track of a subject (a string to be 1158 | // parsed) and a position in that subject. 1159 | 1160 | // If re matches at current position in the subject, advance 1161 | // position in subject and return the match; otherwise return null. 1162 | var match = function(re) { 1163 | var m = re.exec(this.subject.slice(this.pos)); 1164 | if (m === null) { 1165 | return null; 1166 | } else { 1167 | this.pos += m.index + m[0].length; 1168 | return m[0]; 1169 | } 1170 | }; 1171 | 1172 | // Returns the code for the character at the current subject position, or -1 1173 | // there are no more characters. 1174 | var peek = function() { 1175 | if (this.pos < this.subject.length) { 1176 | return this.subject.charCodeAt(this.pos); 1177 | } else { 1178 | return -1; 1179 | } 1180 | }; 1181 | 1182 | // Parse zero or more space characters, including at most one newline 1183 | var spnl = function() { 1184 | this.match(reSpnl); 1185 | return true; 1186 | }; 1187 | 1188 | // All of the parsers below try to match something at the current position 1189 | // in the subject. If they succeed in matching anything, they 1190 | // return the inline matched, advancing the subject. 1191 | 1192 | // Attempt to parse backticks, adding either a backtick code span or a 1193 | // literal sequence of backticks. 1194 | var parseBackticks = function(block) { 1195 | var ticks = this.match(reTicksHere); 1196 | if (ticks === null) { 1197 | return false; 1198 | } 1199 | var afterOpenTicks = this.pos; 1200 | var matched; 1201 | var node; 1202 | while ((matched = this.match(reTicks)) !== null) { 1203 | if (matched === ticks) { 1204 | node = new Node('code'); 1205 | node._literal = this.subject.slice(afterOpenTicks, 1206 | this.pos - ticks.length) 1207 | .trim().replace(reWhitespace, ' '); 1208 | block.appendChild(node); 1209 | return true; 1210 | } 1211 | } 1212 | // If we got here, we didn't match a closing backtick sequence. 1213 | this.pos = afterOpenTicks; 1214 | block.appendChild(text(ticks)); 1215 | return true; 1216 | }; 1217 | 1218 | // Parse a backslash-escaped special character, adding either the escaped 1219 | // character, a hard line break (if the backslash is followed by a newline), 1220 | // or a literal backslash to the block's children. Assumes current character 1221 | // is a backslash. 1222 | var parseBackslash = function(block) { 1223 | var subj = this.subject; 1224 | var node; 1225 | this.pos += 1; 1226 | if (this.peek() === C_NEWLINE) { 1227 | this.pos += 1; 1228 | node = new Node('linebreak'); 1229 | block.appendChild(node); 1230 | } else if (reEscapable.test(subj.charAt(this.pos))) { 1231 | block.appendChild(text(subj.charAt(this.pos))); 1232 | this.pos += 1; 1233 | } else { 1234 | block.appendChild(text('\\')); 1235 | } 1236 | return true; 1237 | }; 1238 | 1239 | // Attempt to parse an autolink (URL or email in pointy brackets). 1240 | var parseAutolink = function(block) { 1241 | var m; 1242 | var dest; 1243 | var node; 1244 | if ((m = this.match(reEmailAutolink))) { 1245 | dest = m.slice(1, m.length - 1); 1246 | node = new Node('link'); 1247 | node._destination = normalizeURI('mailto:' + dest); 1248 | node._title = ''; 1249 | node.appendChild(text(dest)); 1250 | block.appendChild(node); 1251 | return true; 1252 | } else if ((m = this.match(reAutolink))) { 1253 | dest = m.slice(1, m.length - 1); 1254 | node = new Node('link'); 1255 | node._destination = normalizeURI(dest); 1256 | node._title = ''; 1257 | node.appendChild(text(dest)); 1258 | block.appendChild(node); 1259 | return true; 1260 | } else { 1261 | return false; 1262 | } 1263 | }; 1264 | 1265 | // Attempt to parse a raw HTML tag. 1266 | var parseHtmlTag = function(block) { 1267 | var m = this.match(reHtmlTag); 1268 | if (m === null) { 1269 | return false; 1270 | } else { 1271 | var node = new Node('html_inline'); 1272 | node._literal = m; 1273 | block.appendChild(node); 1274 | return true; 1275 | } 1276 | }; 1277 | 1278 | // Scan a sequence of characters with code cc, and return information about 1279 | // the number of delimiters and whether they are positioned such that 1280 | // they can open and/or close emphasis or strong emphasis. A utility 1281 | // function for strong/emph parsing. 1282 | var scanDelims = function(cc) { 1283 | var numdelims = 0; 1284 | var char_before, char_after, cc_after; 1285 | var startpos = this.pos; 1286 | var left_flanking, right_flanking, can_open, can_close; 1287 | var after_is_whitespace, after_is_punctuation, before_is_whitespace, before_is_punctuation; 1288 | 1289 | if (cc === C_SINGLEQUOTE || cc === C_DOUBLEQUOTE) { 1290 | numdelims++; 1291 | this.pos++; 1292 | } else { 1293 | while (this.peek() === cc) { 1294 | numdelims++; 1295 | this.pos++; 1296 | } 1297 | } 1298 | 1299 | if (numdelims === 0) { 1300 | return null; 1301 | } 1302 | 1303 | char_before = startpos === 0 ? '\n' : this.subject.charAt(startpos - 1); 1304 | 1305 | cc_after = this.peek(); 1306 | if (cc_after === -1) { 1307 | char_after = '\n'; 1308 | } else { 1309 | char_after = fromCodePoint(cc_after); 1310 | } 1311 | 1312 | after_is_whitespace = reUnicodeWhitespaceChar.test(char_after); 1313 | after_is_punctuation = rePunctuation.test(char_after); 1314 | before_is_whitespace = reUnicodeWhitespaceChar.test(char_before); 1315 | before_is_punctuation = rePunctuation.test(char_before); 1316 | 1317 | left_flanking = !after_is_whitespace && 1318 | (!after_is_punctuation || before_is_whitespace || before_is_punctuation); 1319 | right_flanking = !before_is_whitespace && 1320 | (!before_is_punctuation || after_is_whitespace || after_is_punctuation); 1321 | if (cc === C_UNDERSCORE) { 1322 | can_open = left_flanking && 1323 | (!right_flanking || before_is_punctuation); 1324 | can_close = right_flanking && 1325 | (!left_flanking || after_is_punctuation); 1326 | } else if (cc === C_SINGLEQUOTE || cc === C_DOUBLEQUOTE) { 1327 | can_open = left_flanking && !right_flanking; 1328 | can_close = right_flanking; 1329 | } else { 1330 | can_open = left_flanking; 1331 | can_close = right_flanking; 1332 | } 1333 | this.pos = startpos; 1334 | return { numdelims: numdelims, 1335 | can_open: can_open, 1336 | can_close: can_close }; 1337 | }; 1338 | 1339 | // Handle a delimiter marker for emphasis or a quote. 1340 | var handleDelim = function(cc, block) { 1341 | var res = this.scanDelims(cc); 1342 | if (!res) { 1343 | return false; 1344 | } 1345 | var numdelims = res.numdelims; 1346 | var startpos = this.pos; 1347 | var contents; 1348 | 1349 | this.pos += numdelims; 1350 | if (cc === C_SINGLEQUOTE) { 1351 | contents = "\u2019"; 1352 | } else if (cc === C_DOUBLEQUOTE) { 1353 | contents = "\u201C"; 1354 | } else { 1355 | contents = this.subject.slice(startpos, this.pos); 1356 | } 1357 | var node = text(contents); 1358 | block.appendChild(node); 1359 | 1360 | // Add entry to stack for this opener 1361 | this.delimiters = { cc: cc, 1362 | numdelims: numdelims, 1363 | origdelims: numdelims, 1364 | node: node, 1365 | previous: this.delimiters, 1366 | next: null, 1367 | can_open: res.can_open, 1368 | can_close: res.can_close }; 1369 | if (this.delimiters.previous !== null) { 1370 | this.delimiters.previous.next = this.delimiters; 1371 | } 1372 | 1373 | return true; 1374 | 1375 | }; 1376 | 1377 | var removeDelimiter = function(delim) { 1378 | if (delim.previous !== null) { 1379 | delim.previous.next = delim.next; 1380 | } 1381 | if (delim.next === null) { 1382 | // top of stack 1383 | this.delimiters = delim.previous; 1384 | } else { 1385 | delim.next.previous = delim.previous; 1386 | } 1387 | }; 1388 | 1389 | var removeDelimitersBetween = function(bottom, top) { 1390 | if (bottom.next !== top) { 1391 | bottom.next = top; 1392 | top.previous = bottom; 1393 | } 1394 | }; 1395 | 1396 | var processEmphasis = function(stack_bottom) { 1397 | var opener, closer, old_closer; 1398 | var opener_inl, closer_inl; 1399 | var tempstack; 1400 | var use_delims; 1401 | var tmp, next; 1402 | var opener_found; 1403 | var openers_bottom = []; 1404 | var odd_match = false; 1405 | 1406 | openers_bottom[C_UNDERSCORE] = stack_bottom; 1407 | openers_bottom[C_ASTERISK] = stack_bottom; 1408 | openers_bottom[C_SINGLEQUOTE] = stack_bottom; 1409 | openers_bottom[C_DOUBLEQUOTE] = stack_bottom; 1410 | 1411 | // find first closer above stack_bottom: 1412 | closer = this.delimiters; 1413 | while (closer !== null && closer.previous !== stack_bottom) { 1414 | closer = closer.previous; 1415 | } 1416 | // move forward, looking for closers, and handling each 1417 | while (closer !== null) { 1418 | var closercc = closer.cc; 1419 | if (!closer.can_close) { 1420 | closer = closer.next; 1421 | } else { 1422 | // found emphasis closer. now look back for first matching opener: 1423 | opener = closer.previous; 1424 | opener_found = false; 1425 | while (opener !== null && opener !== stack_bottom && 1426 | opener !== openers_bottom[closercc]) { 1427 | odd_match = (closer.can_open || opener.can_close) && 1428 | (opener.origdelims + closer.origdelims) % 3 === 0; 1429 | if (opener.cc === closer.cc && opener.can_open && !odd_match) { 1430 | opener_found = true; 1431 | break; 1432 | } 1433 | opener = opener.previous; 1434 | } 1435 | old_closer = closer; 1436 | 1437 | if (closercc === C_ASTERISK || closercc === C_UNDERSCORE) { 1438 | if (!opener_found) { 1439 | closer = closer.next; 1440 | } else { 1441 | // calculate actual number of delimiters used from closer 1442 | use_delims = 1443 | (closer.numdelims >= 2 && opener.numdelims >= 2) ? 2 : 1; 1444 | 1445 | opener_inl = opener.node; 1446 | closer_inl = closer.node; 1447 | 1448 | // remove used delimiters from stack elts and inlines 1449 | opener.numdelims -= use_delims; 1450 | closer.numdelims -= use_delims; 1451 | opener_inl._literal = 1452 | opener_inl._literal.slice(0, 1453 | opener_inl._literal.length - use_delims); 1454 | closer_inl._literal = 1455 | closer_inl._literal.slice(0, 1456 | closer_inl._literal.length - use_delims); 1457 | 1458 | // build contents for new emph element 1459 | var emph = new Node(use_delims === 1 ? 'emph' : 'strong'); 1460 | 1461 | tmp = opener_inl._next; 1462 | while (tmp && tmp !== closer_inl) { 1463 | next = tmp._next; 1464 | tmp.unlink(); 1465 | emph.appendChild(tmp); 1466 | tmp = next; 1467 | } 1468 | 1469 | opener_inl.insertAfter(emph); 1470 | 1471 | // remove elts between opener and closer in delimiters stack 1472 | removeDelimitersBetween(opener, closer); 1473 | 1474 | // if opener has 0 delims, remove it and the inline 1475 | if (opener.numdelims === 0) { 1476 | opener_inl.unlink(); 1477 | this.removeDelimiter(opener); 1478 | } 1479 | 1480 | if (closer.numdelims === 0) { 1481 | closer_inl.unlink(); 1482 | tempstack = closer.next; 1483 | this.removeDelimiter(closer); 1484 | closer = tempstack; 1485 | } 1486 | 1487 | } 1488 | 1489 | } else if (closercc === C_SINGLEQUOTE) { 1490 | closer.node._literal = "\u2019"; 1491 | if (opener_found) { 1492 | opener.node._literal = "\u2018"; 1493 | } 1494 | closer = closer.next; 1495 | 1496 | } else if (closercc === C_DOUBLEQUOTE) { 1497 | closer.node._literal = "\u201D"; 1498 | if (opener_found) { 1499 | opener.node.literal = "\u201C"; 1500 | } 1501 | closer = closer.next; 1502 | 1503 | } 1504 | if (!opener_found && !odd_match) { 1505 | // Set lower bound for future searches for openers: 1506 | // We don't do this with odd_match because a ** 1507 | // that doesn't match an earlier * might turn into 1508 | // an opener, and the * might be matched by something 1509 | // else. 1510 | openers_bottom[closercc] = old_closer.previous; 1511 | if (!old_closer.can_open) { 1512 | // We can remove a closer that can't be an opener, 1513 | // once we've seen there's no matching opener: 1514 | this.removeDelimiter(old_closer); 1515 | } 1516 | } 1517 | } 1518 | 1519 | } 1520 | 1521 | // remove all delimiters 1522 | while (this.delimiters !== null && this.delimiters !== stack_bottom) { 1523 | this.removeDelimiter(this.delimiters); 1524 | } 1525 | }; 1526 | 1527 | // Attempt to parse link title (sans quotes), returning the string 1528 | // or null if no match. 1529 | var parseLinkTitle = function() { 1530 | var title = this.match(reLinkTitle); 1531 | if (title === null) { 1532 | return null; 1533 | } else { 1534 | // chop off quotes from title and unescape: 1535 | return unescapeString(title.substr(1, title.length - 2)); 1536 | } 1537 | }; 1538 | 1539 | // Attempt to parse link destination, returning the string or 1540 | // null if no match. 1541 | var parseLinkDestination = function() { 1542 | var res = this.match(reLinkDestinationBraces); 1543 | if (res === null) { 1544 | // TODO handrolled parser; res should be null or the string 1545 | var savepos = this.pos; 1546 | var openparens = 0; 1547 | var c; 1548 | while ((c = this.peek()) !== -1) { 1549 | if (c === C_BACKSLASH) { 1550 | this.pos += 1; 1551 | if (this.peek() !== -1) { 1552 | this.pos += 1; 1553 | } 1554 | } else if (c === C_OPEN_PAREN) { 1555 | this.pos += 1; 1556 | openparens += 1; 1557 | } else if (c === C_CLOSE_PAREN) { 1558 | if (openparens < 1) { 1559 | break; 1560 | } else { 1561 | this.pos += 1; 1562 | openparens -= 1; 1563 | } 1564 | } else if (reWhitespaceChar.exec(fromCodePoint(c)) !== null) { 1565 | break; 1566 | } else { 1567 | this.pos += 1; 1568 | } 1569 | } 1570 | res = this.subject.substr(savepos, this.pos - savepos); 1571 | return normalizeURI(unescapeString(res)); 1572 | } else { // chop off surrounding <..>: 1573 | return normalizeURI(unescapeString(res.substr(1, res.length - 2))); 1574 | } 1575 | }; 1576 | 1577 | // Attempt to parse a link label, returning number of characters parsed. 1578 | var parseLinkLabel = function() { 1579 | var m = this.match(reLinkLabel); 1580 | // Note: our regex will allow something of form [..\]; 1581 | // we disallow it here rather than using lookahead in the regex: 1582 | if (m === null || m.length > 1001 || /[^\\]\\\]$/.exec(m)) { 1583 | return 0; 1584 | } else { 1585 | return m.length; 1586 | } 1587 | }; 1588 | 1589 | // Add open bracket to delimiter stack and add a text node to block's children. 1590 | var parseOpenBracket = function(block) { 1591 | var startpos = this.pos; 1592 | this.pos += 1; 1593 | 1594 | var node = text('['); 1595 | block.appendChild(node); 1596 | 1597 | // Add entry to stack for this opener 1598 | this.addBracket(node, startpos, false); 1599 | return true; 1600 | }; 1601 | 1602 | // IF next character is [, and ! delimiter to delimiter stack and 1603 | // add a text node to block's children. Otherwise just add a text node. 1604 | var parseBang = function(block) { 1605 | var startpos = this.pos; 1606 | this.pos += 1; 1607 | if (this.peek() === C_OPEN_BRACKET) { 1608 | this.pos += 1; 1609 | 1610 | var node = text('!['); 1611 | block.appendChild(node); 1612 | 1613 | // Add entry to stack for this opener 1614 | this.addBracket(node, startpos + 1, true); 1615 | } else { 1616 | block.appendChild(text('!')); 1617 | } 1618 | return true; 1619 | }; 1620 | 1621 | // Try to match close bracket against an opening in the delimiter 1622 | // stack. Add either a link or image, or a plain [ character, 1623 | // to block's children. If there is a matching delimiter, 1624 | // remove it from the delimiter stack. 1625 | var parseCloseBracket = function(block) { 1626 | var startpos; 1627 | var is_image; 1628 | var dest; 1629 | var title; 1630 | var matched = false; 1631 | var reflabel; 1632 | var opener; 1633 | 1634 | this.pos += 1; 1635 | startpos = this.pos; 1636 | 1637 | // get last [ or ![ 1638 | opener = this.brackets; 1639 | 1640 | if (opener === null) { 1641 | // no matched opener, just return a literal 1642 | block.appendChild(text(']')); 1643 | return true; 1644 | } 1645 | 1646 | if (!opener.active) { 1647 | // no matched opener, just return a literal 1648 | block.appendChild(text(']')); 1649 | // take opener off brackets stack 1650 | this.removeBracket(); 1651 | return true; 1652 | } 1653 | 1654 | // If we got here, open is a potential opener 1655 | is_image = opener.image; 1656 | 1657 | // Check to see if we have a link/image 1658 | 1659 | var savepos = this.pos; 1660 | 1661 | // Inline link? 1662 | if (this.peek() === C_OPEN_PAREN) { 1663 | this.pos++; 1664 | if (this.spnl() && 1665 | ((dest = this.parseLinkDestination()) !== null) && 1666 | this.spnl() && 1667 | // make sure there's a space before the title: 1668 | (reWhitespaceChar.test(this.subject.charAt(this.pos - 1)) && 1669 | (title = this.parseLinkTitle()) || true) && 1670 | this.spnl() && 1671 | this.peek() === C_CLOSE_PAREN) { 1672 | this.pos += 1; 1673 | matched = true; 1674 | } else { 1675 | this.pos = savepos; 1676 | } 1677 | } 1678 | 1679 | if (!matched) { 1680 | 1681 | // Next, see if there's a link label 1682 | var beforelabel = this.pos; 1683 | var n = this.parseLinkLabel(); 1684 | if (n > 2) { 1685 | reflabel = this.subject.slice(beforelabel, beforelabel + n); 1686 | } else if (!opener.bracketAfter) { 1687 | // Empty or missing second label means to use the first label as the reference. 1688 | // The reference must not contain a bracket. If we know there's a bracket, we don't even bother checking it. 1689 | reflabel = this.subject.slice(opener.index, startpos); 1690 | } 1691 | if (n === 0) { 1692 | // If shortcut reference link, rewind before spaces we skipped. 1693 | this.pos = savepos; 1694 | } 1695 | 1696 | if (reflabel) { 1697 | // lookup rawlabel in refmap 1698 | var link = this.refmap[normalizeReference(reflabel)]; 1699 | if (link) { 1700 | dest = link.destination; 1701 | title = link.title; 1702 | matched = true; 1703 | } 1704 | } 1705 | } 1706 | 1707 | if (matched) { 1708 | var node = new Node(is_image ? 'image' : 'link'); 1709 | node._destination = dest; 1710 | node._title = title || ''; 1711 | 1712 | var tmp, next; 1713 | tmp = opener.node._next; 1714 | while (tmp) { 1715 | next = tmp._next; 1716 | tmp.unlink(); 1717 | node.appendChild(tmp); 1718 | tmp = next; 1719 | } 1720 | block.appendChild(node); 1721 | this.processEmphasis(opener.previousDelimiter); 1722 | this.removeBracket(); 1723 | opener.node.unlink(); 1724 | 1725 | // We remove this bracket and processEmphasis will remove later delimiters. 1726 | // Now, for a link, we also deactivate earlier link openers. 1727 | // (no links in links) 1728 | if (!is_image) { 1729 | opener = this.brackets; 1730 | while (opener !== null) { 1731 | if (!opener.image) { 1732 | opener.active = false; // deactivate this opener 1733 | } 1734 | opener = opener.previous; 1735 | } 1736 | } 1737 | 1738 | return true; 1739 | 1740 | } else { // no match 1741 | 1742 | this.removeBracket(); // remove this opener from stack 1743 | this.pos = startpos; 1744 | block.appendChild(text(']')); 1745 | return true; 1746 | } 1747 | 1748 | }; 1749 | 1750 | var addBracket = function(node, index, image) { 1751 | if (this.brackets !== null) { 1752 | this.brackets.bracketAfter = true; 1753 | } 1754 | this.brackets = { node: node, 1755 | previous: this.brackets, 1756 | previousDelimiter: this.delimiters, 1757 | index: index, 1758 | image: image, 1759 | active: true }; 1760 | }; 1761 | 1762 | var removeBracket = function() { 1763 | this.brackets = this.brackets.previous; 1764 | }; 1765 | 1766 | // Attempt to parse an entity. 1767 | var parseEntity = function(block) { 1768 | var m; 1769 | if ((m = this.match(reEntityHere))) { 1770 | block.appendChild(text(decodeHTML(m))); 1771 | return true; 1772 | } else { 1773 | return false; 1774 | } 1775 | }; 1776 | 1777 | // Parse a run of ordinary characters, or a single character with 1778 | // a special meaning in markdown, as a plain string. 1779 | var parseString = function(block) { 1780 | var m; 1781 | if ((m = this.match(reMain))) { 1782 | if (this.options.smart) { 1783 | block.appendChild(text( 1784 | m.replace(reEllipses, "\u2026") 1785 | .replace(reDash, function(chars) { 1786 | var enCount = 0; 1787 | var emCount = 0; 1788 | if (chars.length % 3 === 0) { // If divisible by 3, use all em dashes 1789 | emCount = chars.length / 3; 1790 | } else if (chars.length % 2 === 0) { // If divisible by 2, use all en dashes 1791 | enCount = chars.length / 2; 1792 | } else if (chars.length % 3 === 2) { // If 2 extra dashes, use en dash for last 2; em dashes for rest 1793 | enCount = 1; 1794 | emCount = (chars.length - 2) / 3; 1795 | } else { // Use en dashes for last 4 hyphens; em dashes for rest 1796 | enCount = 2; 1797 | emCount = (chars.length - 4) / 3; 1798 | } 1799 | return "\u2014".repeat(emCount) + "\u2013".repeat(enCount); 1800 | }))); 1801 | } else { 1802 | block.appendChild(text(m)); 1803 | } 1804 | return true; 1805 | } else { 1806 | return false; 1807 | } 1808 | }; 1809 | 1810 | // Parse a newline. If it was preceded by two spaces, return a hard 1811 | // line break; otherwise a soft line break. 1812 | var parseNewline = function(block) { 1813 | this.pos += 1; // assume we're at a \n 1814 | // check previous node for trailing spaces 1815 | var lastc = block._lastChild; 1816 | if (lastc && lastc.type === 'text' && lastc._literal[lastc._literal.length - 1] === ' ') { 1817 | var hardbreak = lastc._literal[lastc._literal.length - 2] === ' '; 1818 | lastc._literal = lastc._literal.replace(reFinalSpace, ''); 1819 | block.appendChild(new Node(hardbreak ? 'linebreak' : 'softbreak')); 1820 | } else { 1821 | block.appendChild(new Node('softbreak')); 1822 | } 1823 | this.match(reInitialSpace); // gobble leading spaces in next line 1824 | return true; 1825 | }; 1826 | 1827 | // Attempt to parse a link reference, modifying refmap. 1828 | var parseReference = function(s, refmap) { 1829 | this.subject = s; 1830 | this.pos = 0; 1831 | var rawlabel; 1832 | var dest; 1833 | var title; 1834 | var matchChars; 1835 | var startpos = this.pos; 1836 | 1837 | // label: 1838 | matchChars = this.parseLinkLabel(); 1839 | if (matchChars === 0) { 1840 | return 0; 1841 | } else { 1842 | rawlabel = this.subject.substr(0, matchChars); 1843 | } 1844 | 1845 | // colon: 1846 | if (this.peek() === C_COLON) { 1847 | this.pos++; 1848 | } else { 1849 | this.pos = startpos; 1850 | return 0; 1851 | } 1852 | 1853 | // link url 1854 | this.spnl(); 1855 | 1856 | dest = this.parseLinkDestination(); 1857 | if (dest === null || dest.length === 0) { 1858 | this.pos = startpos; 1859 | return 0; 1860 | } 1861 | 1862 | var beforetitle = this.pos; 1863 | this.spnl(); 1864 | title = this.parseLinkTitle(); 1865 | if (title === null) { 1866 | title = ''; 1867 | // rewind before spaces 1868 | this.pos = beforetitle; 1869 | } 1870 | 1871 | // make sure we're at line end: 1872 | var atLineEnd = true; 1873 | if (this.match(reSpaceAtEndOfLine) === null) { 1874 | if (title === '') { 1875 | atLineEnd = false; 1876 | } else { 1877 | // the potential title we found is not at the line end, 1878 | // but it could still be a legal link reference if we 1879 | // discard the title 1880 | title = ''; 1881 | // rewind before spaces 1882 | this.pos = beforetitle; 1883 | // and instead check if the link URL is at the line end 1884 | atLineEnd = this.match(reSpaceAtEndOfLine) !== null; 1885 | } 1886 | } 1887 | 1888 | if (!atLineEnd) { 1889 | this.pos = startpos; 1890 | return 0; 1891 | } 1892 | 1893 | var normlabel = normalizeReference(rawlabel); 1894 | if (normlabel === '') { 1895 | // label must contain non-whitespace characters 1896 | this.pos = startpos; 1897 | return 0; 1898 | } 1899 | 1900 | if (!refmap[normlabel]) { 1901 | refmap[normlabel] = { destination: dest, title: title }; 1902 | } 1903 | return this.pos - startpos; 1904 | }; 1905 | 1906 | // Parse the next inline element in subject, advancing subject position. 1907 | // On success, add the result to block's children and return true. 1908 | // On failure, return false. 1909 | var parseInline = function(block) { 1910 | var res = false; 1911 | var c = this.peek(); 1912 | if (c === -1) { 1913 | return false; 1914 | } 1915 | switch(c) { 1916 | case C_NEWLINE: 1917 | res = this.parseNewline(block); 1918 | break; 1919 | case C_BACKSLASH: 1920 | res = this.parseBackslash(block); 1921 | break; 1922 | case C_BACKTICK: 1923 | res = this.parseBackticks(block); 1924 | break; 1925 | case C_ASTERISK: 1926 | case C_UNDERSCORE: 1927 | res = this.handleDelim(c, block); 1928 | break; 1929 | case C_SINGLEQUOTE: 1930 | case C_DOUBLEQUOTE: 1931 | res = this.options.smart && this.handleDelim(c, block); 1932 | break; 1933 | case C_OPEN_BRACKET: 1934 | res = this.parseOpenBracket(block); 1935 | break; 1936 | case C_BANG: 1937 | res = this.parseBang(block); 1938 | break; 1939 | case C_CLOSE_BRACKET: 1940 | res = this.parseCloseBracket(block); 1941 | break; 1942 | case C_LESSTHAN: 1943 | res = this.parseAutolink(block) || this.parseHtmlTag(block); 1944 | break; 1945 | case C_AMPERSAND: 1946 | res = this.parseEntity(block); 1947 | break; 1948 | default: 1949 | res = this.parseString(block); 1950 | break; 1951 | } 1952 | if (!res) { 1953 | this.pos += 1; 1954 | block.appendChild(text(fromCodePoint(c))); 1955 | } 1956 | 1957 | return true; 1958 | }; 1959 | 1960 | // Parse string content in block into inline children, 1961 | // using refmap to resolve references. 1962 | var parseInlines = function(block) { 1963 | this.subject = block._string_content.trim(); 1964 | this.pos = 0; 1965 | this.delimiters = null; 1966 | this.brackets = null; 1967 | while (this.parseInline(block)) { 1968 | } 1969 | block._string_content = null; // allow raw string to be garbage collected 1970 | this.processEmphasis(null); 1971 | }; 1972 | 1973 | // The InlineParser object. 1974 | function InlineParser(options){ 1975 | return { 1976 | subject: '', 1977 | delimiters: null, // used by handleDelim method 1978 | brackets: null, 1979 | pos: 0, 1980 | refmap: {}, 1981 | match: match, 1982 | peek: peek, 1983 | spnl: spnl, 1984 | parseBackticks: parseBackticks, 1985 | parseBackslash: parseBackslash, 1986 | parseAutolink: parseAutolink, 1987 | parseHtmlTag: parseHtmlTag, 1988 | scanDelims: scanDelims, 1989 | handleDelim: handleDelim, 1990 | parseLinkTitle: parseLinkTitle, 1991 | parseLinkDestination: parseLinkDestination, 1992 | parseLinkLabel: parseLinkLabel, 1993 | parseOpenBracket: parseOpenBracket, 1994 | parseBang: parseBang, 1995 | parseCloseBracket: parseCloseBracket, 1996 | addBracket: addBracket, 1997 | removeBracket: removeBracket, 1998 | parseEntity: parseEntity, 1999 | parseString: parseString, 2000 | parseNewline: parseNewline, 2001 | parseReference: parseReference, 2002 | parseInline: parseInline, 2003 | processEmphasis: processEmphasis, 2004 | removeDelimiter: removeDelimiter, 2005 | options: options || {}, 2006 | parse: parseInlines 2007 | }; 2008 | } 2009 | 2010 | module.exports = InlineParser; 2011 | 2012 | },{"./common":2,"./from-code-point.js":3,"./node":6,"./normalize-reference":7,"entities":11,"string.prototype.repeat":21}],6:[function(require,module,exports){ 2013 | "use strict"; 2014 | 2015 | function isContainer(node) { 2016 | switch (node._type) { 2017 | case 'document': 2018 | case 'block_quote': 2019 | case 'list': 2020 | case 'item': 2021 | case 'paragraph': 2022 | case 'heading': 2023 | case 'emph': 2024 | case 'strong': 2025 | case 'link': 2026 | case 'image': 2027 | case 'custom_inline': 2028 | case 'custom_block': 2029 | return true; 2030 | default: 2031 | return false; 2032 | } 2033 | } 2034 | 2035 | var resumeAt = function(node, entering) { 2036 | this.current = node; 2037 | this.entering = (entering === true); 2038 | }; 2039 | 2040 | var next = function(){ 2041 | var cur = this.current; 2042 | var entering = this.entering; 2043 | 2044 | if (cur === null) { 2045 | return null; 2046 | } 2047 | 2048 | var container = isContainer(cur); 2049 | 2050 | if (entering && container) { 2051 | if (cur._firstChild) { 2052 | this.current = cur._firstChild; 2053 | this.entering = true; 2054 | } else { 2055 | // stay on node but exit 2056 | this.entering = false; 2057 | } 2058 | 2059 | } else if (cur === this.root) { 2060 | this.current = null; 2061 | 2062 | } else if (cur._next === null) { 2063 | this.current = cur._parent; 2064 | this.entering = false; 2065 | 2066 | } else { 2067 | this.current = cur._next; 2068 | this.entering = true; 2069 | } 2070 | 2071 | return {entering: entering, node: cur}; 2072 | }; 2073 | 2074 | var NodeWalker = function(root) { 2075 | return { current: root, 2076 | root: root, 2077 | entering: true, 2078 | next: next, 2079 | resumeAt: resumeAt }; 2080 | }; 2081 | 2082 | var Node = function(nodeType, sourcepos) { 2083 | this._type = nodeType; 2084 | this._parent = null; 2085 | this._firstChild = null; 2086 | this._lastChild = null; 2087 | this._prev = null; 2088 | this._next = null; 2089 | this._sourcepos = sourcepos; 2090 | this._lastLineBlank = false; 2091 | this._open = true; 2092 | this._string_content = null; 2093 | this._literal = null; 2094 | this._listData = {}; 2095 | this._info = null; 2096 | this._destination = null; 2097 | this._title = null; 2098 | this._isFenced = false; 2099 | this._fenceChar = null; 2100 | this._fenceLength = 0; 2101 | this._fenceOffset = null; 2102 | this._level = null; 2103 | this._onEnter = null; 2104 | this._onExit = null; 2105 | }; 2106 | 2107 | var proto = Node.prototype; 2108 | 2109 | Object.defineProperty(proto, 'isContainer', { 2110 | get: function () { return isContainer(this); } 2111 | }); 2112 | 2113 | Object.defineProperty(proto, 'type', { 2114 | get: function() { return this._type; } 2115 | }); 2116 | 2117 | Object.defineProperty(proto, 'firstChild', { 2118 | get: function() { return this._firstChild; } 2119 | }); 2120 | 2121 | Object.defineProperty(proto, 'lastChild', { 2122 | get: function() { return this._lastChild; } 2123 | }); 2124 | 2125 | Object.defineProperty(proto, 'next', { 2126 | get: function() { return this._next; } 2127 | }); 2128 | 2129 | Object.defineProperty(proto, 'prev', { 2130 | get: function() { return this._prev; } 2131 | }); 2132 | 2133 | Object.defineProperty(proto, 'parent', { 2134 | get: function() { return this._parent; } 2135 | }); 2136 | 2137 | Object.defineProperty(proto, 'sourcepos', { 2138 | get: function() { return this._sourcepos; } 2139 | }); 2140 | 2141 | Object.defineProperty(proto, 'literal', { 2142 | get: function() { return this._literal; }, 2143 | set: function(s) { this._literal = s; } 2144 | }); 2145 | 2146 | Object.defineProperty(proto, 'destination', { 2147 | get: function() { return this._destination; }, 2148 | set: function(s) { this._destination = s; } 2149 | }); 2150 | 2151 | Object.defineProperty(proto, 'title', { 2152 | get: function() { return this._title; }, 2153 | set: function(s) { this._title = s; } 2154 | }); 2155 | 2156 | Object.defineProperty(proto, 'info', { 2157 | get: function() { return this._info; }, 2158 | set: function(s) { this._info = s; } 2159 | }); 2160 | 2161 | Object.defineProperty(proto, 'level', { 2162 | get: function() { return this._level; }, 2163 | set: function(s) { this._level = s; } 2164 | }); 2165 | 2166 | Object.defineProperty(proto, 'listType', { 2167 | get: function() { return this._listData.type; }, 2168 | set: function(t) { this._listData.type = t; } 2169 | }); 2170 | 2171 | Object.defineProperty(proto, 'listTight', { 2172 | get: function() { return this._listData.tight; }, 2173 | set: function(t) { this._listData.tight = t; } 2174 | }); 2175 | 2176 | Object.defineProperty(proto, 'listStart', { 2177 | get: function() { return this._listData.start; }, 2178 | set: function(n) { this._listData.start = n; } 2179 | }); 2180 | 2181 | Object.defineProperty(proto, 'listDelimiter', { 2182 | get: function() { return this._listData.delimiter; }, 2183 | set: function(delim) { this._listData.delimiter = delim; } 2184 | }); 2185 | 2186 | Object.defineProperty(proto, 'onEnter', { 2187 | get: function() { return this._onEnter; }, 2188 | set: function(s) { this._onEnter = s; } 2189 | }); 2190 | 2191 | Object.defineProperty(proto, 'onExit', { 2192 | get: function() { return this._onExit; }, 2193 | set: function(s) { this._onExit = s; } 2194 | }); 2195 | 2196 | Node.prototype.appendChild = function(child) { 2197 | child.unlink(); 2198 | child._parent = this; 2199 | if (this._lastChild) { 2200 | this._lastChild._next = child; 2201 | child._prev = this._lastChild; 2202 | this._lastChild = child; 2203 | } else { 2204 | this._firstChild = child; 2205 | this._lastChild = child; 2206 | } 2207 | }; 2208 | 2209 | Node.prototype.prependChild = function(child) { 2210 | child.unlink(); 2211 | child._parent = this; 2212 | if (this._firstChild) { 2213 | this._firstChild._prev = child; 2214 | child._next = this._firstChild; 2215 | this._firstChild = child; 2216 | } else { 2217 | this._firstChild = child; 2218 | this._lastChild = child; 2219 | } 2220 | }; 2221 | 2222 | Node.prototype.unlink = function() { 2223 | if (this._prev) { 2224 | this._prev._next = this._next; 2225 | } else if (this._parent) { 2226 | this._parent._firstChild = this._next; 2227 | } 2228 | if (this._next) { 2229 | this._next._prev = this._prev; 2230 | } else if (this._parent) { 2231 | this._parent._lastChild = this._prev; 2232 | } 2233 | this._parent = null; 2234 | this._next = null; 2235 | this._prev = null; 2236 | }; 2237 | 2238 | Node.prototype.insertAfter = function(sibling) { 2239 | sibling.unlink(); 2240 | sibling._next = this._next; 2241 | if (sibling._next) { 2242 | sibling._next._prev = sibling; 2243 | } 2244 | sibling._prev = this; 2245 | this._next = sibling; 2246 | sibling._parent = this._parent; 2247 | if (!sibling._next) { 2248 | sibling._parent._lastChild = sibling; 2249 | } 2250 | }; 2251 | 2252 | Node.prototype.insertBefore = function(sibling) { 2253 | sibling.unlink(); 2254 | sibling._prev = this._prev; 2255 | if (sibling._prev) { 2256 | sibling._prev._next = sibling; 2257 | } 2258 | sibling._next = this; 2259 | this._prev = sibling; 2260 | sibling._parent = this._parent; 2261 | if (!sibling._prev) { 2262 | sibling._parent._firstChild = sibling; 2263 | } 2264 | }; 2265 | 2266 | Node.prototype.walker = function() { 2267 | var walker = new NodeWalker(this); 2268 | return walker; 2269 | }; 2270 | 2271 | module.exports = Node; 2272 | 2273 | 2274 | /* Example of use of walker: 2275 | 2276 | var walker = w.walker(); 2277 | var event; 2278 | 2279 | while (event = walker.next()) { 2280 | console.log(event.entering, event.node.type); 2281 | } 2282 | 2283 | */ 2284 | 2285 | },{}],7:[function(require,module,exports){ 2286 | "use strict"; 2287 | 2288 | /* The bulk of this code derives from https://github.com/dmoscrop/fold-case 2289 | But in addition to case-folding, we also normalize whitespace. 2290 | 2291 | fold-case is Copyright Mathias Bynens 2292 | 2293 | Permission is hereby granted, free of charge, to any person obtaining 2294 | a copy of this software and associated documentation files (the 2295 | "Software"), to deal in the Software without restriction, including 2296 | without limitation the rights to use, copy, modify, merge, publish, 2297 | distribute, sublicense, and/or sell copies of the Software, and to 2298 | permit persons to whom the Software is furnished to do so, subject to 2299 | the following conditions: 2300 | 2301 | The above copyright notice and this permission notice shall be 2302 | included in all copies or substantial portions of the Software. 2303 | 2304 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 2305 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2306 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 2307 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 2308 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 2309 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 2310 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2311 | */ 2312 | 2313 | /*eslint-disable key-spacing, comma-spacing */ 2314 | 2315 | var regex = /[ \t\r\n]+|[A-Z\xB5\xC0-\xD6\xD8-\xDF\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u0149\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u017F\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C5\u01C7\u01C8\u01CA\u01CB\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F0-\u01F2\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0345\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03AB\u03B0\u03C2\u03CF-\u03D1\u03D5\u03D6\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F0\u03F1\u03F4\u03F5\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u0587\u10A0-\u10C5\u10C7\u10CD\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E96-\u1E9B\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F50\u1F52\u1F54\u1F56\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1F80-\u1FAF\u1FB2-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD2\u1FD3\u1FD6-\u1FDB\u1FE2-\u1FE4\u1FE6-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A\u212B\u2132\u2160-\u216F\u2183\u24B6-\u24CF\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AD\uA7B0\uA7B1\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A]|\uD801[\uDC00-\uDC27]|\uD806[\uDCA0-\uDCBF]/g; 2316 | 2317 | var map = {'A':'a','B':'b','C':'c','D':'d','E':'e','F':'f','G':'g','H':'h','I':'i','J':'j','K':'k','L':'l','M':'m','N':'n','O':'o','P':'p','Q':'q','R':'r','S':'s','T':'t','U':'u','V':'v','W':'w','X':'x','Y':'y','Z':'z','\xB5':'\u03BC','\xC0':'\xE0','\xC1':'\xE1','\xC2':'\xE2','\xC3':'\xE3','\xC4':'\xE4','\xC5':'\xE5','\xC6':'\xE6','\xC7':'\xE7','\xC8':'\xE8','\xC9':'\xE9','\xCA':'\xEA','\xCB':'\xEB','\xCC':'\xEC','\xCD':'\xED','\xCE':'\xEE','\xCF':'\xEF','\xD0':'\xF0','\xD1':'\xF1','\xD2':'\xF2','\xD3':'\xF3','\xD4':'\xF4','\xD5':'\xF5','\xD6':'\xF6','\xD8':'\xF8','\xD9':'\xF9','\xDA':'\xFA','\xDB':'\xFB','\xDC':'\xFC','\xDD':'\xFD','\xDE':'\xFE','\u0100':'\u0101','\u0102':'\u0103','\u0104':'\u0105','\u0106':'\u0107','\u0108':'\u0109','\u010A':'\u010B','\u010C':'\u010D','\u010E':'\u010F','\u0110':'\u0111','\u0112':'\u0113','\u0114':'\u0115','\u0116':'\u0117','\u0118':'\u0119','\u011A':'\u011B','\u011C':'\u011D','\u011E':'\u011F','\u0120':'\u0121','\u0122':'\u0123','\u0124':'\u0125','\u0126':'\u0127','\u0128':'\u0129','\u012A':'\u012B','\u012C':'\u012D','\u012E':'\u012F','\u0132':'\u0133','\u0134':'\u0135','\u0136':'\u0137','\u0139':'\u013A','\u013B':'\u013C','\u013D':'\u013E','\u013F':'\u0140','\u0141':'\u0142','\u0143':'\u0144','\u0145':'\u0146','\u0147':'\u0148','\u014A':'\u014B','\u014C':'\u014D','\u014E':'\u014F','\u0150':'\u0151','\u0152':'\u0153','\u0154':'\u0155','\u0156':'\u0157','\u0158':'\u0159','\u015A':'\u015B','\u015C':'\u015D','\u015E':'\u015F','\u0160':'\u0161','\u0162':'\u0163','\u0164':'\u0165','\u0166':'\u0167','\u0168':'\u0169','\u016A':'\u016B','\u016C':'\u016D','\u016E':'\u016F','\u0170':'\u0171','\u0172':'\u0173','\u0174':'\u0175','\u0176':'\u0177','\u0178':'\xFF','\u0179':'\u017A','\u017B':'\u017C','\u017D':'\u017E','\u017F':'s','\u0181':'\u0253','\u0182':'\u0183','\u0184':'\u0185','\u0186':'\u0254','\u0187':'\u0188','\u0189':'\u0256','\u018A':'\u0257','\u018B':'\u018C','\u018E':'\u01DD','\u018F':'\u0259','\u0190':'\u025B','\u0191':'\u0192','\u0193':'\u0260','\u0194':'\u0263','\u0196':'\u0269','\u0197':'\u0268','\u0198':'\u0199','\u019C':'\u026F','\u019D':'\u0272','\u019F':'\u0275','\u01A0':'\u01A1','\u01A2':'\u01A3','\u01A4':'\u01A5','\u01A6':'\u0280','\u01A7':'\u01A8','\u01A9':'\u0283','\u01AC':'\u01AD','\u01AE':'\u0288','\u01AF':'\u01B0','\u01B1':'\u028A','\u01B2':'\u028B','\u01B3':'\u01B4','\u01B5':'\u01B6','\u01B7':'\u0292','\u01B8':'\u01B9','\u01BC':'\u01BD','\u01C4':'\u01C6','\u01C5':'\u01C6','\u01C7':'\u01C9','\u01C8':'\u01C9','\u01CA':'\u01CC','\u01CB':'\u01CC','\u01CD':'\u01CE','\u01CF':'\u01D0','\u01D1':'\u01D2','\u01D3':'\u01D4','\u01D5':'\u01D6','\u01D7':'\u01D8','\u01D9':'\u01DA','\u01DB':'\u01DC','\u01DE':'\u01DF','\u01E0':'\u01E1','\u01E2':'\u01E3','\u01E4':'\u01E5','\u01E6':'\u01E7','\u01E8':'\u01E9','\u01EA':'\u01EB','\u01EC':'\u01ED','\u01EE':'\u01EF','\u01F1':'\u01F3','\u01F2':'\u01F3','\u01F4':'\u01F5','\u01F6':'\u0195','\u01F7':'\u01BF','\u01F8':'\u01F9','\u01FA':'\u01FB','\u01FC':'\u01FD','\u01FE':'\u01FF','\u0200':'\u0201','\u0202':'\u0203','\u0204':'\u0205','\u0206':'\u0207','\u0208':'\u0209','\u020A':'\u020B','\u020C':'\u020D','\u020E':'\u020F','\u0210':'\u0211','\u0212':'\u0213','\u0214':'\u0215','\u0216':'\u0217','\u0218':'\u0219','\u021A':'\u021B','\u021C':'\u021D','\u021E':'\u021F','\u0220':'\u019E','\u0222':'\u0223','\u0224':'\u0225','\u0226':'\u0227','\u0228':'\u0229','\u022A':'\u022B','\u022C':'\u022D','\u022E':'\u022F','\u0230':'\u0231','\u0232':'\u0233','\u023A':'\u2C65','\u023B':'\u023C','\u023D':'\u019A','\u023E':'\u2C66','\u0241':'\u0242','\u0243':'\u0180','\u0244':'\u0289','\u0245':'\u028C','\u0246':'\u0247','\u0248':'\u0249','\u024A':'\u024B','\u024C':'\u024D','\u024E':'\u024F','\u0345':'\u03B9','\u0370':'\u0371','\u0372':'\u0373','\u0376':'\u0377','\u037F':'\u03F3','\u0386':'\u03AC','\u0388':'\u03AD','\u0389':'\u03AE','\u038A':'\u03AF','\u038C':'\u03CC','\u038E':'\u03CD','\u038F':'\u03CE','\u0391':'\u03B1','\u0392':'\u03B2','\u0393':'\u03B3','\u0394':'\u03B4','\u0395':'\u03B5','\u0396':'\u03B6','\u0397':'\u03B7','\u0398':'\u03B8','\u0399':'\u03B9','\u039A':'\u03BA','\u039B':'\u03BB','\u039C':'\u03BC','\u039D':'\u03BD','\u039E':'\u03BE','\u039F':'\u03BF','\u03A0':'\u03C0','\u03A1':'\u03C1','\u03A3':'\u03C3','\u03A4':'\u03C4','\u03A5':'\u03C5','\u03A6':'\u03C6','\u03A7':'\u03C7','\u03A8':'\u03C8','\u03A9':'\u03C9','\u03AA':'\u03CA','\u03AB':'\u03CB','\u03C2':'\u03C3','\u03CF':'\u03D7','\u03D0':'\u03B2','\u03D1':'\u03B8','\u03D5':'\u03C6','\u03D6':'\u03C0','\u03D8':'\u03D9','\u03DA':'\u03DB','\u03DC':'\u03DD','\u03DE':'\u03DF','\u03E0':'\u03E1','\u03E2':'\u03E3','\u03E4':'\u03E5','\u03E6':'\u03E7','\u03E8':'\u03E9','\u03EA':'\u03EB','\u03EC':'\u03ED','\u03EE':'\u03EF','\u03F0':'\u03BA','\u03F1':'\u03C1','\u03F4':'\u03B8','\u03F5':'\u03B5','\u03F7':'\u03F8','\u03F9':'\u03F2','\u03FA':'\u03FB','\u03FD':'\u037B','\u03FE':'\u037C','\u03FF':'\u037D','\u0400':'\u0450','\u0401':'\u0451','\u0402':'\u0452','\u0403':'\u0453','\u0404':'\u0454','\u0405':'\u0455','\u0406':'\u0456','\u0407':'\u0457','\u0408':'\u0458','\u0409':'\u0459','\u040A':'\u045A','\u040B':'\u045B','\u040C':'\u045C','\u040D':'\u045D','\u040E':'\u045E','\u040F':'\u045F','\u0410':'\u0430','\u0411':'\u0431','\u0412':'\u0432','\u0413':'\u0433','\u0414':'\u0434','\u0415':'\u0435','\u0416':'\u0436','\u0417':'\u0437','\u0418':'\u0438','\u0419':'\u0439','\u041A':'\u043A','\u041B':'\u043B','\u041C':'\u043C','\u041D':'\u043D','\u041E':'\u043E','\u041F':'\u043F','\u0420':'\u0440','\u0421':'\u0441','\u0422':'\u0442','\u0423':'\u0443','\u0424':'\u0444','\u0425':'\u0445','\u0426':'\u0446','\u0427':'\u0447','\u0428':'\u0448','\u0429':'\u0449','\u042A':'\u044A','\u042B':'\u044B','\u042C':'\u044C','\u042D':'\u044D','\u042E':'\u044E','\u042F':'\u044F','\u0460':'\u0461','\u0462':'\u0463','\u0464':'\u0465','\u0466':'\u0467','\u0468':'\u0469','\u046A':'\u046B','\u046C':'\u046D','\u046E':'\u046F','\u0470':'\u0471','\u0472':'\u0473','\u0474':'\u0475','\u0476':'\u0477','\u0478':'\u0479','\u047A':'\u047B','\u047C':'\u047D','\u047E':'\u047F','\u0480':'\u0481','\u048A':'\u048B','\u048C':'\u048D','\u048E':'\u048F','\u0490':'\u0491','\u0492':'\u0493','\u0494':'\u0495','\u0496':'\u0497','\u0498':'\u0499','\u049A':'\u049B','\u049C':'\u049D','\u049E':'\u049F','\u04A0':'\u04A1','\u04A2':'\u04A3','\u04A4':'\u04A5','\u04A6':'\u04A7','\u04A8':'\u04A9','\u04AA':'\u04AB','\u04AC':'\u04AD','\u04AE':'\u04AF','\u04B0':'\u04B1','\u04B2':'\u04B3','\u04B4':'\u04B5','\u04B6':'\u04B7','\u04B8':'\u04B9','\u04BA':'\u04BB','\u04BC':'\u04BD','\u04BE':'\u04BF','\u04C0':'\u04CF','\u04C1':'\u04C2','\u04C3':'\u04C4','\u04C5':'\u04C6','\u04C7':'\u04C8','\u04C9':'\u04CA','\u04CB':'\u04CC','\u04CD':'\u04CE','\u04D0':'\u04D1','\u04D2':'\u04D3','\u04D4':'\u04D5','\u04D6':'\u04D7','\u04D8':'\u04D9','\u04DA':'\u04DB','\u04DC':'\u04DD','\u04DE':'\u04DF','\u04E0':'\u04E1','\u04E2':'\u04E3','\u04E4':'\u04E5','\u04E6':'\u04E7','\u04E8':'\u04E9','\u04EA':'\u04EB','\u04EC':'\u04ED','\u04EE':'\u04EF','\u04F0':'\u04F1','\u04F2':'\u04F3','\u04F4':'\u04F5','\u04F6':'\u04F7','\u04F8':'\u04F9','\u04FA':'\u04FB','\u04FC':'\u04FD','\u04FE':'\u04FF','\u0500':'\u0501','\u0502':'\u0503','\u0504':'\u0505','\u0506':'\u0507','\u0508':'\u0509','\u050A':'\u050B','\u050C':'\u050D','\u050E':'\u050F','\u0510':'\u0511','\u0512':'\u0513','\u0514':'\u0515','\u0516':'\u0517','\u0518':'\u0519','\u051A':'\u051B','\u051C':'\u051D','\u051E':'\u051F','\u0520':'\u0521','\u0522':'\u0523','\u0524':'\u0525','\u0526':'\u0527','\u0528':'\u0529','\u052A':'\u052B','\u052C':'\u052D','\u052E':'\u052F','\u0531':'\u0561','\u0532':'\u0562','\u0533':'\u0563','\u0534':'\u0564','\u0535':'\u0565','\u0536':'\u0566','\u0537':'\u0567','\u0538':'\u0568','\u0539':'\u0569','\u053A':'\u056A','\u053B':'\u056B','\u053C':'\u056C','\u053D':'\u056D','\u053E':'\u056E','\u053F':'\u056F','\u0540':'\u0570','\u0541':'\u0571','\u0542':'\u0572','\u0543':'\u0573','\u0544':'\u0574','\u0545':'\u0575','\u0546':'\u0576','\u0547':'\u0577','\u0548':'\u0578','\u0549':'\u0579','\u054A':'\u057A','\u054B':'\u057B','\u054C':'\u057C','\u054D':'\u057D','\u054E':'\u057E','\u054F':'\u057F','\u0550':'\u0580','\u0551':'\u0581','\u0552':'\u0582','\u0553':'\u0583','\u0554':'\u0584','\u0555':'\u0585','\u0556':'\u0586','\u10A0':'\u2D00','\u10A1':'\u2D01','\u10A2':'\u2D02','\u10A3':'\u2D03','\u10A4':'\u2D04','\u10A5':'\u2D05','\u10A6':'\u2D06','\u10A7':'\u2D07','\u10A8':'\u2D08','\u10A9':'\u2D09','\u10AA':'\u2D0A','\u10AB':'\u2D0B','\u10AC':'\u2D0C','\u10AD':'\u2D0D','\u10AE':'\u2D0E','\u10AF':'\u2D0F','\u10B0':'\u2D10','\u10B1':'\u2D11','\u10B2':'\u2D12','\u10B3':'\u2D13','\u10B4':'\u2D14','\u10B5':'\u2D15','\u10B6':'\u2D16','\u10B7':'\u2D17','\u10B8':'\u2D18','\u10B9':'\u2D19','\u10BA':'\u2D1A','\u10BB':'\u2D1B','\u10BC':'\u2D1C','\u10BD':'\u2D1D','\u10BE':'\u2D1E','\u10BF':'\u2D1F','\u10C0':'\u2D20','\u10C1':'\u2D21','\u10C2':'\u2D22','\u10C3':'\u2D23','\u10C4':'\u2D24','\u10C5':'\u2D25','\u10C7':'\u2D27','\u10CD':'\u2D2D','\u1E00':'\u1E01','\u1E02':'\u1E03','\u1E04':'\u1E05','\u1E06':'\u1E07','\u1E08':'\u1E09','\u1E0A':'\u1E0B','\u1E0C':'\u1E0D','\u1E0E':'\u1E0F','\u1E10':'\u1E11','\u1E12':'\u1E13','\u1E14':'\u1E15','\u1E16':'\u1E17','\u1E18':'\u1E19','\u1E1A':'\u1E1B','\u1E1C':'\u1E1D','\u1E1E':'\u1E1F','\u1E20':'\u1E21','\u1E22':'\u1E23','\u1E24':'\u1E25','\u1E26':'\u1E27','\u1E28':'\u1E29','\u1E2A':'\u1E2B','\u1E2C':'\u1E2D','\u1E2E':'\u1E2F','\u1E30':'\u1E31','\u1E32':'\u1E33','\u1E34':'\u1E35','\u1E36':'\u1E37','\u1E38':'\u1E39','\u1E3A':'\u1E3B','\u1E3C':'\u1E3D','\u1E3E':'\u1E3F','\u1E40':'\u1E41','\u1E42':'\u1E43','\u1E44':'\u1E45','\u1E46':'\u1E47','\u1E48':'\u1E49','\u1E4A':'\u1E4B','\u1E4C':'\u1E4D','\u1E4E':'\u1E4F','\u1E50':'\u1E51','\u1E52':'\u1E53','\u1E54':'\u1E55','\u1E56':'\u1E57','\u1E58':'\u1E59','\u1E5A':'\u1E5B','\u1E5C':'\u1E5D','\u1E5E':'\u1E5F','\u1E60':'\u1E61','\u1E62':'\u1E63','\u1E64':'\u1E65','\u1E66':'\u1E67','\u1E68':'\u1E69','\u1E6A':'\u1E6B','\u1E6C':'\u1E6D','\u1E6E':'\u1E6F','\u1E70':'\u1E71','\u1E72':'\u1E73','\u1E74':'\u1E75','\u1E76':'\u1E77','\u1E78':'\u1E79','\u1E7A':'\u1E7B','\u1E7C':'\u1E7D','\u1E7E':'\u1E7F','\u1E80':'\u1E81','\u1E82':'\u1E83','\u1E84':'\u1E85','\u1E86':'\u1E87','\u1E88':'\u1E89','\u1E8A':'\u1E8B','\u1E8C':'\u1E8D','\u1E8E':'\u1E8F','\u1E90':'\u1E91','\u1E92':'\u1E93','\u1E94':'\u1E95','\u1E9B':'\u1E61','\u1EA0':'\u1EA1','\u1EA2':'\u1EA3','\u1EA4':'\u1EA5','\u1EA6':'\u1EA7','\u1EA8':'\u1EA9','\u1EAA':'\u1EAB','\u1EAC':'\u1EAD','\u1EAE':'\u1EAF','\u1EB0':'\u1EB1','\u1EB2':'\u1EB3','\u1EB4':'\u1EB5','\u1EB6':'\u1EB7','\u1EB8':'\u1EB9','\u1EBA':'\u1EBB','\u1EBC':'\u1EBD','\u1EBE':'\u1EBF','\u1EC0':'\u1EC1','\u1EC2':'\u1EC3','\u1EC4':'\u1EC5','\u1EC6':'\u1EC7','\u1EC8':'\u1EC9','\u1ECA':'\u1ECB','\u1ECC':'\u1ECD','\u1ECE':'\u1ECF','\u1ED0':'\u1ED1','\u1ED2':'\u1ED3','\u1ED4':'\u1ED5','\u1ED6':'\u1ED7','\u1ED8':'\u1ED9','\u1EDA':'\u1EDB','\u1EDC':'\u1EDD','\u1EDE':'\u1EDF','\u1EE0':'\u1EE1','\u1EE2':'\u1EE3','\u1EE4':'\u1EE5','\u1EE6':'\u1EE7','\u1EE8':'\u1EE9','\u1EEA':'\u1EEB','\u1EEC':'\u1EED','\u1EEE':'\u1EEF','\u1EF0':'\u1EF1','\u1EF2':'\u1EF3','\u1EF4':'\u1EF5','\u1EF6':'\u1EF7','\u1EF8':'\u1EF9','\u1EFA':'\u1EFB','\u1EFC':'\u1EFD','\u1EFE':'\u1EFF','\u1F08':'\u1F00','\u1F09':'\u1F01','\u1F0A':'\u1F02','\u1F0B':'\u1F03','\u1F0C':'\u1F04','\u1F0D':'\u1F05','\u1F0E':'\u1F06','\u1F0F':'\u1F07','\u1F18':'\u1F10','\u1F19':'\u1F11','\u1F1A':'\u1F12','\u1F1B':'\u1F13','\u1F1C':'\u1F14','\u1F1D':'\u1F15','\u1F28':'\u1F20','\u1F29':'\u1F21','\u1F2A':'\u1F22','\u1F2B':'\u1F23','\u1F2C':'\u1F24','\u1F2D':'\u1F25','\u1F2E':'\u1F26','\u1F2F':'\u1F27','\u1F38':'\u1F30','\u1F39':'\u1F31','\u1F3A':'\u1F32','\u1F3B':'\u1F33','\u1F3C':'\u1F34','\u1F3D':'\u1F35','\u1F3E':'\u1F36','\u1F3F':'\u1F37','\u1F48':'\u1F40','\u1F49':'\u1F41','\u1F4A':'\u1F42','\u1F4B':'\u1F43','\u1F4C':'\u1F44','\u1F4D':'\u1F45','\u1F59':'\u1F51','\u1F5B':'\u1F53','\u1F5D':'\u1F55','\u1F5F':'\u1F57','\u1F68':'\u1F60','\u1F69':'\u1F61','\u1F6A':'\u1F62','\u1F6B':'\u1F63','\u1F6C':'\u1F64','\u1F6D':'\u1F65','\u1F6E':'\u1F66','\u1F6F':'\u1F67','\u1FB8':'\u1FB0','\u1FB9':'\u1FB1','\u1FBA':'\u1F70','\u1FBB':'\u1F71','\u1FBE':'\u03B9','\u1FC8':'\u1F72','\u1FC9':'\u1F73','\u1FCA':'\u1F74','\u1FCB':'\u1F75','\u1FD8':'\u1FD0','\u1FD9':'\u1FD1','\u1FDA':'\u1F76','\u1FDB':'\u1F77','\u1FE8':'\u1FE0','\u1FE9':'\u1FE1','\u1FEA':'\u1F7A','\u1FEB':'\u1F7B','\u1FEC':'\u1FE5','\u1FF8':'\u1F78','\u1FF9':'\u1F79','\u1FFA':'\u1F7C','\u1FFB':'\u1F7D','\u2126':'\u03C9','\u212A':'k','\u212B':'\xE5','\u2132':'\u214E','\u2160':'\u2170','\u2161':'\u2171','\u2162':'\u2172','\u2163':'\u2173','\u2164':'\u2174','\u2165':'\u2175','\u2166':'\u2176','\u2167':'\u2177','\u2168':'\u2178','\u2169':'\u2179','\u216A':'\u217A','\u216B':'\u217B','\u216C':'\u217C','\u216D':'\u217D','\u216E':'\u217E','\u216F':'\u217F','\u2183':'\u2184','\u24B6':'\u24D0','\u24B7':'\u24D1','\u24B8':'\u24D2','\u24B9':'\u24D3','\u24BA':'\u24D4','\u24BB':'\u24D5','\u24BC':'\u24D6','\u24BD':'\u24D7','\u24BE':'\u24D8','\u24BF':'\u24D9','\u24C0':'\u24DA','\u24C1':'\u24DB','\u24C2':'\u24DC','\u24C3':'\u24DD','\u24C4':'\u24DE','\u24C5':'\u24DF','\u24C6':'\u24E0','\u24C7':'\u24E1','\u24C8':'\u24E2','\u24C9':'\u24E3','\u24CA':'\u24E4','\u24CB':'\u24E5','\u24CC':'\u24E6','\u24CD':'\u24E7','\u24CE':'\u24E8','\u24CF':'\u24E9','\u2C00':'\u2C30','\u2C01':'\u2C31','\u2C02':'\u2C32','\u2C03':'\u2C33','\u2C04':'\u2C34','\u2C05':'\u2C35','\u2C06':'\u2C36','\u2C07':'\u2C37','\u2C08':'\u2C38','\u2C09':'\u2C39','\u2C0A':'\u2C3A','\u2C0B':'\u2C3B','\u2C0C':'\u2C3C','\u2C0D':'\u2C3D','\u2C0E':'\u2C3E','\u2C0F':'\u2C3F','\u2C10':'\u2C40','\u2C11':'\u2C41','\u2C12':'\u2C42','\u2C13':'\u2C43','\u2C14':'\u2C44','\u2C15':'\u2C45','\u2C16':'\u2C46','\u2C17':'\u2C47','\u2C18':'\u2C48','\u2C19':'\u2C49','\u2C1A':'\u2C4A','\u2C1B':'\u2C4B','\u2C1C':'\u2C4C','\u2C1D':'\u2C4D','\u2C1E':'\u2C4E','\u2C1F':'\u2C4F','\u2C20':'\u2C50','\u2C21':'\u2C51','\u2C22':'\u2C52','\u2C23':'\u2C53','\u2C24':'\u2C54','\u2C25':'\u2C55','\u2C26':'\u2C56','\u2C27':'\u2C57','\u2C28':'\u2C58','\u2C29':'\u2C59','\u2C2A':'\u2C5A','\u2C2B':'\u2C5B','\u2C2C':'\u2C5C','\u2C2D':'\u2C5D','\u2C2E':'\u2C5E','\u2C60':'\u2C61','\u2C62':'\u026B','\u2C63':'\u1D7D','\u2C64':'\u027D','\u2C67':'\u2C68','\u2C69':'\u2C6A','\u2C6B':'\u2C6C','\u2C6D':'\u0251','\u2C6E':'\u0271','\u2C6F':'\u0250','\u2C70':'\u0252','\u2C72':'\u2C73','\u2C75':'\u2C76','\u2C7E':'\u023F','\u2C7F':'\u0240','\u2C80':'\u2C81','\u2C82':'\u2C83','\u2C84':'\u2C85','\u2C86':'\u2C87','\u2C88':'\u2C89','\u2C8A':'\u2C8B','\u2C8C':'\u2C8D','\u2C8E':'\u2C8F','\u2C90':'\u2C91','\u2C92':'\u2C93','\u2C94':'\u2C95','\u2C96':'\u2C97','\u2C98':'\u2C99','\u2C9A':'\u2C9B','\u2C9C':'\u2C9D','\u2C9E':'\u2C9F','\u2CA0':'\u2CA1','\u2CA2':'\u2CA3','\u2CA4':'\u2CA5','\u2CA6':'\u2CA7','\u2CA8':'\u2CA9','\u2CAA':'\u2CAB','\u2CAC':'\u2CAD','\u2CAE':'\u2CAF','\u2CB0':'\u2CB1','\u2CB2':'\u2CB3','\u2CB4':'\u2CB5','\u2CB6':'\u2CB7','\u2CB8':'\u2CB9','\u2CBA':'\u2CBB','\u2CBC':'\u2CBD','\u2CBE':'\u2CBF','\u2CC0':'\u2CC1','\u2CC2':'\u2CC3','\u2CC4':'\u2CC5','\u2CC6':'\u2CC7','\u2CC8':'\u2CC9','\u2CCA':'\u2CCB','\u2CCC':'\u2CCD','\u2CCE':'\u2CCF','\u2CD0':'\u2CD1','\u2CD2':'\u2CD3','\u2CD4':'\u2CD5','\u2CD6':'\u2CD7','\u2CD8':'\u2CD9','\u2CDA':'\u2CDB','\u2CDC':'\u2CDD','\u2CDE':'\u2CDF','\u2CE0':'\u2CE1','\u2CE2':'\u2CE3','\u2CEB':'\u2CEC','\u2CED':'\u2CEE','\u2CF2':'\u2CF3','\uA640':'\uA641','\uA642':'\uA643','\uA644':'\uA645','\uA646':'\uA647','\uA648':'\uA649','\uA64A':'\uA64B','\uA64C':'\uA64D','\uA64E':'\uA64F','\uA650':'\uA651','\uA652':'\uA653','\uA654':'\uA655','\uA656':'\uA657','\uA658':'\uA659','\uA65A':'\uA65B','\uA65C':'\uA65D','\uA65E':'\uA65F','\uA660':'\uA661','\uA662':'\uA663','\uA664':'\uA665','\uA666':'\uA667','\uA668':'\uA669','\uA66A':'\uA66B','\uA66C':'\uA66D','\uA680':'\uA681','\uA682':'\uA683','\uA684':'\uA685','\uA686':'\uA687','\uA688':'\uA689','\uA68A':'\uA68B','\uA68C':'\uA68D','\uA68E':'\uA68F','\uA690':'\uA691','\uA692':'\uA693','\uA694':'\uA695','\uA696':'\uA697','\uA698':'\uA699','\uA69A':'\uA69B','\uA722':'\uA723','\uA724':'\uA725','\uA726':'\uA727','\uA728':'\uA729','\uA72A':'\uA72B','\uA72C':'\uA72D','\uA72E':'\uA72F','\uA732':'\uA733','\uA734':'\uA735','\uA736':'\uA737','\uA738':'\uA739','\uA73A':'\uA73B','\uA73C':'\uA73D','\uA73E':'\uA73F','\uA740':'\uA741','\uA742':'\uA743','\uA744':'\uA745','\uA746':'\uA747','\uA748':'\uA749','\uA74A':'\uA74B','\uA74C':'\uA74D','\uA74E':'\uA74F','\uA750':'\uA751','\uA752':'\uA753','\uA754':'\uA755','\uA756':'\uA757','\uA758':'\uA759','\uA75A':'\uA75B','\uA75C':'\uA75D','\uA75E':'\uA75F','\uA760':'\uA761','\uA762':'\uA763','\uA764':'\uA765','\uA766':'\uA767','\uA768':'\uA769','\uA76A':'\uA76B','\uA76C':'\uA76D','\uA76E':'\uA76F','\uA779':'\uA77A','\uA77B':'\uA77C','\uA77D':'\u1D79','\uA77E':'\uA77F','\uA780':'\uA781','\uA782':'\uA783','\uA784':'\uA785','\uA786':'\uA787','\uA78B':'\uA78C','\uA78D':'\u0265','\uA790':'\uA791','\uA792':'\uA793','\uA796':'\uA797','\uA798':'\uA799','\uA79A':'\uA79B','\uA79C':'\uA79D','\uA79E':'\uA79F','\uA7A0':'\uA7A1','\uA7A2':'\uA7A3','\uA7A4':'\uA7A5','\uA7A6':'\uA7A7','\uA7A8':'\uA7A9','\uA7AA':'\u0266','\uA7AB':'\u025C','\uA7AC':'\u0261','\uA7AD':'\u026C','\uA7B0':'\u029E','\uA7B1':'\u0287','\uFF21':'\uFF41','\uFF22':'\uFF42','\uFF23':'\uFF43','\uFF24':'\uFF44','\uFF25':'\uFF45','\uFF26':'\uFF46','\uFF27':'\uFF47','\uFF28':'\uFF48','\uFF29':'\uFF49','\uFF2A':'\uFF4A','\uFF2B':'\uFF4B','\uFF2C':'\uFF4C','\uFF2D':'\uFF4D','\uFF2E':'\uFF4E','\uFF2F':'\uFF4F','\uFF30':'\uFF50','\uFF31':'\uFF51','\uFF32':'\uFF52','\uFF33':'\uFF53','\uFF34':'\uFF54','\uFF35':'\uFF55','\uFF36':'\uFF56','\uFF37':'\uFF57','\uFF38':'\uFF58','\uFF39':'\uFF59','\uFF3A':'\uFF5A','\uD801\uDC00':'\uD801\uDC28','\uD801\uDC01':'\uD801\uDC29','\uD801\uDC02':'\uD801\uDC2A','\uD801\uDC03':'\uD801\uDC2B','\uD801\uDC04':'\uD801\uDC2C','\uD801\uDC05':'\uD801\uDC2D','\uD801\uDC06':'\uD801\uDC2E','\uD801\uDC07':'\uD801\uDC2F','\uD801\uDC08':'\uD801\uDC30','\uD801\uDC09':'\uD801\uDC31','\uD801\uDC0A':'\uD801\uDC32','\uD801\uDC0B':'\uD801\uDC33','\uD801\uDC0C':'\uD801\uDC34','\uD801\uDC0D':'\uD801\uDC35','\uD801\uDC0E':'\uD801\uDC36','\uD801\uDC0F':'\uD801\uDC37','\uD801\uDC10':'\uD801\uDC38','\uD801\uDC11':'\uD801\uDC39','\uD801\uDC12':'\uD801\uDC3A','\uD801\uDC13':'\uD801\uDC3B','\uD801\uDC14':'\uD801\uDC3C','\uD801\uDC15':'\uD801\uDC3D','\uD801\uDC16':'\uD801\uDC3E','\uD801\uDC17':'\uD801\uDC3F','\uD801\uDC18':'\uD801\uDC40','\uD801\uDC19':'\uD801\uDC41','\uD801\uDC1A':'\uD801\uDC42','\uD801\uDC1B':'\uD801\uDC43','\uD801\uDC1C':'\uD801\uDC44','\uD801\uDC1D':'\uD801\uDC45','\uD801\uDC1E':'\uD801\uDC46','\uD801\uDC1F':'\uD801\uDC47','\uD801\uDC20':'\uD801\uDC48','\uD801\uDC21':'\uD801\uDC49','\uD801\uDC22':'\uD801\uDC4A','\uD801\uDC23':'\uD801\uDC4B','\uD801\uDC24':'\uD801\uDC4C','\uD801\uDC25':'\uD801\uDC4D','\uD801\uDC26':'\uD801\uDC4E','\uD801\uDC27':'\uD801\uDC4F','\uD806\uDCA0':'\uD806\uDCC0','\uD806\uDCA1':'\uD806\uDCC1','\uD806\uDCA2':'\uD806\uDCC2','\uD806\uDCA3':'\uD806\uDCC3','\uD806\uDCA4':'\uD806\uDCC4','\uD806\uDCA5':'\uD806\uDCC5','\uD806\uDCA6':'\uD806\uDCC6','\uD806\uDCA7':'\uD806\uDCC7','\uD806\uDCA8':'\uD806\uDCC8','\uD806\uDCA9':'\uD806\uDCC9','\uD806\uDCAA':'\uD806\uDCCA','\uD806\uDCAB':'\uD806\uDCCB','\uD806\uDCAC':'\uD806\uDCCC','\uD806\uDCAD':'\uD806\uDCCD','\uD806\uDCAE':'\uD806\uDCCE','\uD806\uDCAF':'\uD806\uDCCF','\uD806\uDCB0':'\uD806\uDCD0','\uD806\uDCB1':'\uD806\uDCD1','\uD806\uDCB2':'\uD806\uDCD2','\uD806\uDCB3':'\uD806\uDCD3','\uD806\uDCB4':'\uD806\uDCD4','\uD806\uDCB5':'\uD806\uDCD5','\uD806\uDCB6':'\uD806\uDCD6','\uD806\uDCB7':'\uD806\uDCD7','\uD806\uDCB8':'\uD806\uDCD8','\uD806\uDCB9':'\uD806\uDCD9','\uD806\uDCBA':'\uD806\uDCDA','\uD806\uDCBB':'\uD806\uDCDB','\uD806\uDCBC':'\uD806\uDCDC','\uD806\uDCBD':'\uD806\uDCDD','\uD806\uDCBE':'\uD806\uDCDE','\uD806\uDCBF':'\uD806\uDCDF','\xDF':'ss','\u0130':'i\u0307','\u0149':'\u02BCn','\u01F0':'j\u030C','\u0390':'\u03B9\u0308\u0301','\u03B0':'\u03C5\u0308\u0301','\u0587':'\u0565\u0582','\u1E96':'h\u0331','\u1E97':'t\u0308','\u1E98':'w\u030A','\u1E99':'y\u030A','\u1E9A':'a\u02BE','\u1E9E':'ss','\u1F50':'\u03C5\u0313','\u1F52':'\u03C5\u0313\u0300','\u1F54':'\u03C5\u0313\u0301','\u1F56':'\u03C5\u0313\u0342','\u1F80':'\u1F00\u03B9','\u1F81':'\u1F01\u03B9','\u1F82':'\u1F02\u03B9','\u1F83':'\u1F03\u03B9','\u1F84':'\u1F04\u03B9','\u1F85':'\u1F05\u03B9','\u1F86':'\u1F06\u03B9','\u1F87':'\u1F07\u03B9','\u1F88':'\u1F00\u03B9','\u1F89':'\u1F01\u03B9','\u1F8A':'\u1F02\u03B9','\u1F8B':'\u1F03\u03B9','\u1F8C':'\u1F04\u03B9','\u1F8D':'\u1F05\u03B9','\u1F8E':'\u1F06\u03B9','\u1F8F':'\u1F07\u03B9','\u1F90':'\u1F20\u03B9','\u1F91':'\u1F21\u03B9','\u1F92':'\u1F22\u03B9','\u1F93':'\u1F23\u03B9','\u1F94':'\u1F24\u03B9','\u1F95':'\u1F25\u03B9','\u1F96':'\u1F26\u03B9','\u1F97':'\u1F27\u03B9','\u1F98':'\u1F20\u03B9','\u1F99':'\u1F21\u03B9','\u1F9A':'\u1F22\u03B9','\u1F9B':'\u1F23\u03B9','\u1F9C':'\u1F24\u03B9','\u1F9D':'\u1F25\u03B9','\u1F9E':'\u1F26\u03B9','\u1F9F':'\u1F27\u03B9','\u1FA0':'\u1F60\u03B9','\u1FA1':'\u1F61\u03B9','\u1FA2':'\u1F62\u03B9','\u1FA3':'\u1F63\u03B9','\u1FA4':'\u1F64\u03B9','\u1FA5':'\u1F65\u03B9','\u1FA6':'\u1F66\u03B9','\u1FA7':'\u1F67\u03B9','\u1FA8':'\u1F60\u03B9','\u1FA9':'\u1F61\u03B9','\u1FAA':'\u1F62\u03B9','\u1FAB':'\u1F63\u03B9','\u1FAC':'\u1F64\u03B9','\u1FAD':'\u1F65\u03B9','\u1FAE':'\u1F66\u03B9','\u1FAF':'\u1F67\u03B9','\u1FB2':'\u1F70\u03B9','\u1FB3':'\u03B1\u03B9','\u1FB4':'\u03AC\u03B9','\u1FB6':'\u03B1\u0342','\u1FB7':'\u03B1\u0342\u03B9','\u1FBC':'\u03B1\u03B9','\u1FC2':'\u1F74\u03B9','\u1FC3':'\u03B7\u03B9','\u1FC4':'\u03AE\u03B9','\u1FC6':'\u03B7\u0342','\u1FC7':'\u03B7\u0342\u03B9','\u1FCC':'\u03B7\u03B9','\u1FD2':'\u03B9\u0308\u0300','\u1FD3':'\u03B9\u0308\u0301','\u1FD6':'\u03B9\u0342','\u1FD7':'\u03B9\u0308\u0342','\u1FE2':'\u03C5\u0308\u0300','\u1FE3':'\u03C5\u0308\u0301','\u1FE4':'\u03C1\u0313','\u1FE6':'\u03C5\u0342','\u1FE7':'\u03C5\u0308\u0342','\u1FF2':'\u1F7C\u03B9','\u1FF3':'\u03C9\u03B9','\u1FF4':'\u03CE\u03B9','\u1FF6':'\u03C9\u0342','\u1FF7':'\u03C9\u0342\u03B9','\u1FFC':'\u03C9\u03B9','\uFB00':'ff','\uFB01':'fi','\uFB02':'fl','\uFB03':'ffi','\uFB04':'ffl','\uFB05':'st','\uFB06':'st','\uFB13':'\u0574\u0576','\uFB14':'\u0574\u0565','\uFB15':'\u0574\u056B','\uFB16':'\u057E\u0576','\uFB17':'\u0574\u056D'}; 2318 | 2319 | // Normalize reference label: collapse internal whitespace 2320 | // to single space, remove leading/trailing whitespace, case fold. 2321 | module.exports = function(string) { 2322 | return string.slice(1, string.length - 1).trim().replace(regex, function($0) { 2323 | // Note: there is no need to check `hasOwnProperty($0)` here. 2324 | // If character not found in lookup table, it must be whitespace. 2325 | return map[$0] || ' '; 2326 | }); 2327 | }; 2328 | 2329 | },{}],8:[function(require,module,exports){ 2330 | "use strict"; 2331 | 2332 | var Renderer = require('./renderer'); 2333 | 2334 | var reUnsafeProtocol = /^javascript:|vbscript:|file:|data:/i; 2335 | var reSafeDataProtocol = /^data:image\/(?:png|gif|jpeg|webp)/i; 2336 | 2337 | var potentiallyUnsafe = function(url) { 2338 | return reUnsafeProtocol.test(url) && 2339 | !reSafeDataProtocol.test(url); 2340 | }; 2341 | 2342 | // Helper function to produce an HTML tag. 2343 | function tag(name, attrs, selfclosing) { 2344 | if (this.disableTags > 0) { 2345 | return; 2346 | } 2347 | this.buffer += ('<' + name); 2348 | if (attrs && attrs.length > 0) { 2349 | var i = 0; 2350 | var attrib; 2351 | while ((attrib = attrs[i]) !== undefined) { 2352 | this.buffer += (' ' + attrib[0] + '="' + attrib[1] + '"'); 2353 | i++; 2354 | } 2355 | } 2356 | if (selfclosing) { 2357 | this.buffer += ' /'; 2358 | } 2359 | this.buffer += '>'; 2360 | this.lastOut = '>'; 2361 | } 2362 | 2363 | function HtmlRenderer(options) { 2364 | options = options || {}; 2365 | // by default, soft breaks are rendered as newlines in HTML 2366 | options.softbreak = options.softbreak || '\n'; 2367 | // set to "
" to make them hard breaks 2368 | // set to " " if you want to ignore line wrapping in source 2369 | 2370 | this.disableTags = 0; 2371 | this.lastOut = "\n"; 2372 | this.options = options; 2373 | } 2374 | 2375 | /* Node methods */ 2376 | 2377 | function text(node) { 2378 | this.out(node.literal); 2379 | } 2380 | 2381 | function softbreak() { 2382 | this.lit(this.options.softbreak); 2383 | } 2384 | 2385 | function linebreak() { 2386 | this.tag('br', [], true); 2387 | this.cr(); 2388 | } 2389 | 2390 | function link(node, entering) { 2391 | var attrs = this.attrs(node); 2392 | if (entering) { 2393 | if (!(this.options.safe && potentiallyUnsafe(node.destination))) { 2394 | attrs.push(['href', this.esc(node.destination, true)]); 2395 | } 2396 | if (node.title) { 2397 | attrs.push(['title', this.esc(node.title, true)]); 2398 | } 2399 | this.tag('a', attrs); 2400 | } else { 2401 | this.tag('/a'); 2402 | } 2403 | } 2404 | 2405 | function image(node, entering) { 2406 | if (entering) { 2407 | if (this.disableTags === 0) { 2408 | if (this.options.safe && potentiallyUnsafe(node.destination)) { 2409 | this.lit('');
2410 |         } else {
2411 |           this.lit('<img src='); 2423 | } 2424 | } 2425 | } 2426 | 2427 | function emph(node, entering) { 2428 | this.tag(entering ? 'em' : '/em'); 2429 | } 2430 | 2431 | function strong(node, entering) { 2432 | this.tag(entering ? 'strong' : '/strong'); 2433 | } 2434 | 2435 | function paragraph(node, entering) { 2436 | var grandparent = node.parent.parent 2437 | , attrs = this.attrs(node); 2438 | if (grandparent !== null && 2439 | grandparent.type === 'list') { 2440 | if (grandparent.listTight) { 2441 | return; 2442 | } 2443 | } 2444 | if (entering) { 2445 | this.cr(); 2446 | this.tag('p', attrs); 2447 | } else { 2448 | this.tag('/p'); 2449 | this.cr(); 2450 | } 2451 | } 2452 | 2453 | function heading(node, entering) { 2454 | var tagname = 'h' + node.level 2455 | , attrs = this.attrs(node); 2456 | if (entering) { 2457 | this.cr(); 2458 | this.tag(tagname, attrs); 2459 | } else { 2460 | this.tag('/' + tagname); 2461 | this.cr(); 2462 | } 2463 | } 2464 | 2465 | function code(node) { 2466 | this.tag('code'); 2467 | this.out(node.literal); 2468 | this.tag('/code'); 2469 | } 2470 | 2471 | function code_block(node) { 2472 | var info_words = node.info ? node.info.split(/\s+/) : [] 2473 | , attrs = this.attrs(node); 2474 | if (info_words.length > 0 && info_words[0].length > 0) { 2475 | attrs.push(['class', 'language-' + this.esc(info_words[0], true)]); 2476 | } 2477 | this.cr(); 2478 | this.tag('pre'); 2479 | this.tag('code', attrs); 2480 | this.out(node.literal); 2481 | this.tag('/code'); 2482 | this.tag('/pre'); 2483 | this.cr(); 2484 | } 2485 | 2486 | function thematic_break(node) { 2487 | var attrs = this.attrs(node); 2488 | this.cr(); 2489 | this.tag('hr', attrs, true); 2490 | this.cr(); 2491 | } 2492 | 2493 | function block_quote(node, entering) { 2494 | var attrs = this.attrs(node); 2495 | if (entering) { 2496 | this.cr(); 2497 | this.tag('blockquote', attrs); 2498 | this.cr(); 2499 | } else { 2500 | this.cr(); 2501 | this.tag('/blockquote'); 2502 | this.cr(); 2503 | } 2504 | } 2505 | 2506 | function list(node, entering) { 2507 | var tagname = node.listType === 'bullet' ? 'ul' : 'ol' 2508 | , attrs = this.attrs(node); 2509 | 2510 | if (entering) { 2511 | var start = node.listStart; 2512 | if (start !== null && start !== 1) { 2513 | attrs.push(['start', start.toString()]); 2514 | } 2515 | this.cr(); 2516 | this.tag(tagname, attrs); 2517 | this.cr(); 2518 | } else { 2519 | this.cr(); 2520 | this.tag('/' + tagname); 2521 | this.cr(); 2522 | } 2523 | } 2524 | 2525 | function item(node, entering) { 2526 | var attrs = this.attrs(node); 2527 | if (entering) { 2528 | this.tag('li', attrs); 2529 | } else { 2530 | this.tag('/li'); 2531 | this.cr(); 2532 | } 2533 | } 2534 | 2535 | function html_inline(node) { 2536 | if (this.options.safe) { 2537 | this.lit(''); 2538 | } else { 2539 | this.lit(node.literal); 2540 | } 2541 | } 2542 | 2543 | function html_block(node) { 2544 | this.cr(); 2545 | if (this.options.safe) { 2546 | this.lit(''); 2547 | } else { 2548 | this.lit(node.literal); 2549 | } 2550 | this.cr(); 2551 | } 2552 | 2553 | function custom_inline(node, entering) { 2554 | if (entering && node.onEnter) { 2555 | this.lit(node.onEnter); 2556 | } else if (!entering && node.onExit) { 2557 | this.lit(node.onExit); 2558 | } 2559 | } 2560 | 2561 | function custom_block(node, entering) { 2562 | this.cr(); 2563 | if (entering && node.onEnter) { 2564 | this.lit(node.onEnter); 2565 | } else if (!entering && node.onExit) { 2566 | this.lit(node.onExit); 2567 | } 2568 | this.cr(); 2569 | } 2570 | 2571 | /* Helper methods */ 2572 | 2573 | function out(s) { 2574 | this.lit(this.esc(s, false)); 2575 | } 2576 | 2577 | function attrs (node) { 2578 | var att = []; 2579 | if (this.options.sourcepos) { 2580 | var pos = node.sourcepos; 2581 | if (pos) { 2582 | att.push(['data-sourcepos', String(pos[0][0]) + ':' + 2583 | String(pos[0][1]) + '-' + String(pos[1][0]) + ':' + 2584 | String(pos[1][1])]); 2585 | } 2586 | } 2587 | return att; 2588 | } 2589 | 2590 | // quick browser-compatible inheritance 2591 | HtmlRenderer.prototype = Object.create(Renderer.prototype); 2592 | 2593 | HtmlRenderer.prototype.text = text; 2594 | HtmlRenderer.prototype.html_inline = html_inline; 2595 | HtmlRenderer.prototype.html_block = html_block; 2596 | HtmlRenderer.prototype.softbreak = softbreak; 2597 | HtmlRenderer.prototype.linebreak = linebreak; 2598 | HtmlRenderer.prototype.link = link; 2599 | HtmlRenderer.prototype.image = image; 2600 | HtmlRenderer.prototype.emph = emph; 2601 | HtmlRenderer.prototype.strong = strong; 2602 | HtmlRenderer.prototype.paragraph = paragraph; 2603 | HtmlRenderer.prototype.heading = heading; 2604 | HtmlRenderer.prototype.code = code; 2605 | HtmlRenderer.prototype.code_block = code_block; 2606 | HtmlRenderer.prototype.thematic_break = thematic_break; 2607 | HtmlRenderer.prototype.block_quote = block_quote; 2608 | HtmlRenderer.prototype.list = list; 2609 | HtmlRenderer.prototype.item = item; 2610 | HtmlRenderer.prototype.custom_inline = custom_inline; 2611 | HtmlRenderer.prototype.custom_block = custom_block; 2612 | 2613 | HtmlRenderer.prototype.esc = require('../common').escapeXml; 2614 | 2615 | HtmlRenderer.prototype.out = out; 2616 | HtmlRenderer.prototype.tag = tag; 2617 | HtmlRenderer.prototype.attrs = attrs; 2618 | 2619 | module.exports = HtmlRenderer; 2620 | 2621 | },{"../common":2,"./renderer":9}],9:[function(require,module,exports){ 2622 | "use strict"; 2623 | 2624 | function Renderer() {} 2625 | 2626 | /** 2627 | * Walks the AST and calls member methods for each Node type. 2628 | * 2629 | * @param ast {Node} The root of the abstract syntax tree. 2630 | */ 2631 | function render(ast) { 2632 | var walker = ast.walker() 2633 | , event 2634 | , type; 2635 | 2636 | this.buffer = ''; 2637 | this.lastOut = '\n'; 2638 | 2639 | while((event = walker.next())) { 2640 | type = event.node.type; 2641 | if (this[type]) { 2642 | this[type](event.node, event.entering); 2643 | } 2644 | } 2645 | return this.buffer; 2646 | } 2647 | 2648 | /** 2649 | * Concatenate a literal string to the buffer. 2650 | * 2651 | * @param str {String} The string to concatenate. 2652 | */ 2653 | function lit(str) { 2654 | this.buffer += str; 2655 | this.lastOut = str; 2656 | } 2657 | 2658 | /** 2659 | * Output a newline to the buffer. 2660 | */ 2661 | function cr() { 2662 | if (this.lastOut !== '\n') { 2663 | this.lit('\n'); 2664 | } 2665 | } 2666 | 2667 | /** 2668 | * Concatenate a string to the buffer possibly escaping the content. 2669 | * 2670 | * Concrete renderer implementations should override this method. 2671 | * 2672 | * @param str {String} The string to concatenate. 2673 | */ 2674 | function out(str) { 2675 | this.lit(str); 2676 | } 2677 | 2678 | /** 2679 | * Escape a string for the target renderer. 2680 | * 2681 | * Abstract function that should be implemented by concrete 2682 | * renderer implementations. 2683 | * 2684 | * @param str {String} The string to escape. 2685 | */ 2686 | function esc(str) { 2687 | return str; 2688 | } 2689 | 2690 | Renderer.prototype.render = render; 2691 | Renderer.prototype.out = out; 2692 | Renderer.prototype.lit = lit; 2693 | Renderer.prototype.cr = cr; 2694 | Renderer.prototype.esc = esc; 2695 | 2696 | module.exports = Renderer; 2697 | 2698 | },{}],10:[function(require,module,exports){ 2699 | "use strict"; 2700 | 2701 | var Renderer = require('./renderer'); 2702 | 2703 | var reXMLTag = /\<[^>]*\>/; 2704 | 2705 | function toTagName(s) { 2706 | return s.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase(); 2707 | } 2708 | 2709 | function XmlRenderer(options) { 2710 | options = options || {}; 2711 | 2712 | this.disableTags = 0; 2713 | this.lastOut = "\n"; 2714 | 2715 | this.indentLevel = 0; 2716 | this.indent = ' '; 2717 | 2718 | this.options = options; 2719 | } 2720 | 2721 | function render(ast) { 2722 | 2723 | this.buffer = ''; 2724 | 2725 | var attrs; 2726 | var tagname; 2727 | var walker = ast.walker(); 2728 | var event, node, entering; 2729 | var container; 2730 | var selfClosing; 2731 | var nodetype; 2732 | 2733 | var options = this.options; 2734 | 2735 | if (options.time) { console.time("rendering"); } 2736 | 2737 | this.buffer += '\n'; 2738 | this.buffer += '\n'; 2739 | 2740 | while ((event = walker.next())) { 2741 | entering = event.entering; 2742 | node = event.node; 2743 | nodetype = node.type; 2744 | 2745 | container = node.isContainer; 2746 | 2747 | selfClosing = nodetype === 'thematic_break' 2748 | || nodetype === 'linebreak' 2749 | || nodetype === 'softbreak'; 2750 | 2751 | tagname = toTagName(nodetype); 2752 | 2753 | if (entering) { 2754 | 2755 | attrs = []; 2756 | 2757 | switch (nodetype) { 2758 | case 'document': 2759 | attrs.push(['xmlns', 'http://commonmark.org/xml/1.0']); 2760 | break; 2761 | case 'list': 2762 | if (node.listType !== null) { 2763 | attrs.push(['type', node.listType.toLowerCase()]); 2764 | } 2765 | if (node.listStart !== null) { 2766 | attrs.push(['start', String(node.listStart)]); 2767 | } 2768 | if (node.listTight !== null) { 2769 | attrs.push(['tight', (node.listTight ? 'true' : 'false')]); 2770 | } 2771 | var delim = node.listDelimiter; 2772 | if (delim !== null) { 2773 | var delimword = ''; 2774 | if (delim === '.') { 2775 | delimword = 'period'; 2776 | } else { 2777 | delimword = 'paren'; 2778 | } 2779 | attrs.push(['delimiter', delimword]); 2780 | } 2781 | break; 2782 | case 'code_block': 2783 | if (node.info) { 2784 | attrs.push(['info', node.info]); 2785 | } 2786 | break; 2787 | case 'heading': 2788 | attrs.push(['level', String(node.level)]); 2789 | break; 2790 | case 'link': 2791 | case 'image': 2792 | attrs.push(['destination', node.destination]); 2793 | attrs.push(['title', node.title]); 2794 | break; 2795 | case 'custom_inline': 2796 | case 'custom_block': 2797 | attrs.push(['on_enter', node.onEnter]); 2798 | attrs.push(['on_exit', node.onExit]); 2799 | break; 2800 | default: 2801 | break; 2802 | } 2803 | if (options.sourcepos) { 2804 | var pos = node.sourcepos; 2805 | if (pos) { 2806 | attrs.push(['sourcepos', String(pos[0][0]) + ':' + 2807 | String(pos[0][1]) + '-' + String(pos[1][0]) + ':' + 2808 | String(pos[1][1])]); 2809 | } 2810 | } 2811 | 2812 | this.cr(); 2813 | this.out(this.tag(tagname, attrs, selfClosing)); 2814 | if (container) { 2815 | this.indentLevel += 1; 2816 | } else if (!container && !selfClosing) { 2817 | var lit = node.literal; 2818 | if (lit) { 2819 | this.out(this.esc(lit)); 2820 | } 2821 | this.out(this.tag('/' + tagname)); 2822 | } 2823 | } else { 2824 | this.indentLevel -= 1; 2825 | this.cr(); 2826 | this.out(this.tag('/' + tagname)); 2827 | } 2828 | } 2829 | if (options.time) { console.timeEnd("rendering"); } 2830 | this.buffer += '\n'; 2831 | return this.buffer; 2832 | } 2833 | 2834 | function out(s) { 2835 | if(this.disableTags > 0) { 2836 | this.buffer += s.replace(reXMLTag, ''); 2837 | }else{ 2838 | this.buffer += s; 2839 | } 2840 | this.lastOut = s; 2841 | } 2842 | 2843 | function cr() { 2844 | if(this.lastOut !== '\n') { 2845 | this.buffer += '\n'; 2846 | this.lastOut = '\n'; 2847 | for(var i = this.indentLevel; i > 0; i--) { 2848 | this.buffer += this.indent; 2849 | } 2850 | } 2851 | } 2852 | 2853 | // Helper function to produce an XML tag. 2854 | function tag(name, attrs, selfclosing) { 2855 | var result = '<' + name; 2856 | if(attrs && attrs.length > 0) { 2857 | var i = 0; 2858 | var attrib; 2859 | while ((attrib = attrs[i]) !== undefined) { 2860 | result += ' ' + attrib[0] + '="' + this.esc(attrib[1]) + '"'; 2861 | i++; 2862 | } 2863 | } 2864 | if(selfclosing) { 2865 | result += ' /'; 2866 | } 2867 | result += '>'; 2868 | return result; 2869 | } 2870 | 2871 | // quick browser-compatible inheritance 2872 | XmlRenderer.prototype = Object.create(Renderer.prototype); 2873 | 2874 | XmlRenderer.prototype.render = render; 2875 | XmlRenderer.prototype.out = out; 2876 | XmlRenderer.prototype.cr = cr; 2877 | XmlRenderer.prototype.tag = tag; 2878 | XmlRenderer.prototype.esc = require('../common').escapeXml; 2879 | 2880 | module.exports = XmlRenderer; 2881 | 2882 | },{"../common":2,"./renderer":9}],11:[function(require,module,exports){ 2883 | var encode = require("./lib/encode.js"), 2884 | decode = require("./lib/decode.js"); 2885 | 2886 | exports.decode = function(data, level){ 2887 | return (!level || level <= 0 ? decode.XML : decode.HTML)(data); 2888 | }; 2889 | 2890 | exports.decodeStrict = function(data, level){ 2891 | return (!level || level <= 0 ? decode.XML : decode.HTMLStrict)(data); 2892 | }; 2893 | 2894 | exports.encode = function(data, level){ 2895 | return (!level || level <= 0 ? encode.XML : encode.HTML)(data); 2896 | }; 2897 | 2898 | exports.encodeXML = encode.XML; 2899 | 2900 | exports.encodeHTML4 = 2901 | exports.encodeHTML5 = 2902 | exports.encodeHTML = encode.HTML; 2903 | 2904 | exports.decodeXML = 2905 | exports.decodeXMLStrict = decode.XML; 2906 | 2907 | exports.decodeHTML4 = 2908 | exports.decodeHTML5 = 2909 | exports.decodeHTML = decode.HTML; 2910 | 2911 | exports.decodeHTML4Strict = 2912 | exports.decodeHTML5Strict = 2913 | exports.decodeHTMLStrict = decode.HTMLStrict; 2914 | 2915 | exports.escape = encode.escape; 2916 | 2917 | },{"./lib/decode.js":12,"./lib/encode.js":14}],12:[function(require,module,exports){ 2918 | var entityMap = require("../maps/entities.json"), 2919 | legacyMap = require("../maps/legacy.json"), 2920 | xmlMap = require("../maps/xml.json"), 2921 | decodeCodePoint = require("./decode_codepoint.js"); 2922 | 2923 | var decodeXMLStrict = getStrictDecoder(xmlMap), 2924 | decodeHTMLStrict = getStrictDecoder(entityMap); 2925 | 2926 | function getStrictDecoder(map){ 2927 | var keys = Object.keys(map).join("|"), 2928 | replace = getReplacer(map); 2929 | 2930 | keys += "|#[xX][\\da-fA-F]+|#\\d+"; 2931 | 2932 | var re = new RegExp("&(?:" + keys + ");", "g"); 2933 | 2934 | return function(str){ 2935 | return String(str).replace(re, replace); 2936 | }; 2937 | } 2938 | 2939 | var decodeHTML = (function(){ 2940 | var legacy = Object.keys(legacyMap) 2941 | .sort(sorter); 2942 | 2943 | var keys = Object.keys(entityMap) 2944 | .sort(sorter); 2945 | 2946 | for(var i = 0, j = 0; i < keys.length; i++){ 2947 | if(legacy[j] === keys[i]){ 2948 | keys[i] += ";?"; 2949 | j++; 2950 | } else { 2951 | keys[i] += ";"; 2952 | } 2953 | } 2954 | 2955 | var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g"), 2956 | replace = getReplacer(entityMap); 2957 | 2958 | function replacer(str){ 2959 | if(str.substr(-1) !== ";") str += ";"; 2960 | return replace(str); 2961 | } 2962 | 2963 | //TODO consider creating a merged map 2964 | return function(str){ 2965 | return String(str).replace(re, replacer); 2966 | }; 2967 | }()); 2968 | 2969 | function sorter(a, b){ 2970 | return a < b ? 1 : -1; 2971 | } 2972 | 2973 | function getReplacer(map){ 2974 | return function replace(str){ 2975 | if(str.charAt(1) === "#"){ 2976 | if(str.charAt(2) === "X" || str.charAt(2) === "x"){ 2977 | return decodeCodePoint(parseInt(str.substr(3), 16)); 2978 | } 2979 | return decodeCodePoint(parseInt(str.substr(2), 10)); 2980 | } 2981 | return map[str.slice(1, -1)]; 2982 | }; 2983 | } 2984 | 2985 | module.exports = { 2986 | XML: decodeXMLStrict, 2987 | HTML: decodeHTML, 2988 | HTMLStrict: decodeHTMLStrict 2989 | }; 2990 | },{"../maps/entities.json":16,"../maps/legacy.json":17,"../maps/xml.json":18,"./decode_codepoint.js":13}],13:[function(require,module,exports){ 2991 | var decodeMap = require("../maps/decode.json"); 2992 | 2993 | module.exports = decodeCodePoint; 2994 | 2995 | // modified version of https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119 2996 | function decodeCodePoint(codePoint){ 2997 | 2998 | if((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF){ 2999 | return "\uFFFD"; 3000 | } 3001 | 3002 | if(codePoint in decodeMap){ 3003 | codePoint = decodeMap[codePoint]; 3004 | } 3005 | 3006 | var output = ""; 3007 | 3008 | if(codePoint > 0xFFFF){ 3009 | codePoint -= 0x10000; 3010 | output += String.fromCharCode(codePoint >>> 10 & 0x3FF | 0xD800); 3011 | codePoint = 0xDC00 | codePoint & 0x3FF; 3012 | } 3013 | 3014 | output += String.fromCharCode(codePoint); 3015 | return output; 3016 | } 3017 | 3018 | },{"../maps/decode.json":15}],14:[function(require,module,exports){ 3019 | var inverseXML = getInverseObj(require("../maps/xml.json")), 3020 | xmlReplacer = getInverseReplacer(inverseXML); 3021 | 3022 | exports.XML = getInverse(inverseXML, xmlReplacer); 3023 | 3024 | var inverseHTML = getInverseObj(require("../maps/entities.json")), 3025 | htmlReplacer = getInverseReplacer(inverseHTML); 3026 | 3027 | exports.HTML = getInverse(inverseHTML, htmlReplacer); 3028 | 3029 | function getInverseObj(obj){ 3030 | return Object.keys(obj).sort().reduce(function(inverse, name){ 3031 | inverse[obj[name]] = "&" + name + ";"; 3032 | return inverse; 3033 | }, {}); 3034 | } 3035 | 3036 | function getInverseReplacer(inverse){ 3037 | var single = [], 3038 | multiple = []; 3039 | 3040 | Object.keys(inverse).forEach(function(k){ 3041 | if(k.length === 1){ 3042 | single.push("\\" + k); 3043 | } else { 3044 | multiple.push(k); 3045 | } 3046 | }); 3047 | 3048 | //TODO add ranges 3049 | multiple.unshift("[" + single.join("") + "]"); 3050 | 3051 | return new RegExp(multiple.join("|"), "g"); 3052 | } 3053 | 3054 | var re_nonASCII = /[^\0-\x7F]/g, 3055 | re_astralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; 3056 | 3057 | function singleCharReplacer(c){ 3058 | return "&#x" + c.charCodeAt(0).toString(16).toUpperCase() + ";"; 3059 | } 3060 | 3061 | function astralReplacer(c){ 3062 | // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae 3063 | var high = c.charCodeAt(0); 3064 | var low = c.charCodeAt(1); 3065 | var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000; 3066 | return "&#x" + codePoint.toString(16).toUpperCase() + ";"; 3067 | } 3068 | 3069 | function getInverse(inverse, re){ 3070 | function func(name){ 3071 | return inverse[name]; 3072 | } 3073 | 3074 | return function(data){ 3075 | return data 3076 | .replace(re, func) 3077 | .replace(re_astralSymbols, astralReplacer) 3078 | .replace(re_nonASCII, singleCharReplacer); 3079 | }; 3080 | } 3081 | 3082 | var re_xmlChars = getInverseReplacer(inverseXML); 3083 | 3084 | function escapeXML(data){ 3085 | return data 3086 | .replace(re_xmlChars, singleCharReplacer) 3087 | .replace(re_astralSymbols, astralReplacer) 3088 | .replace(re_nonASCII, singleCharReplacer); 3089 | } 3090 | 3091 | exports.escape = escapeXML; 3092 | 3093 | },{"../maps/entities.json":16,"../maps/xml.json":18}],15:[function(require,module,exports){ 3094 | module.exports={"0":65533,"128":8364,"130":8218,"131":402,"132":8222,"133":8230,"134":8224,"135":8225,"136":710,"137":8240,"138":352,"139":8249,"140":338,"142":381,"145":8216,"146":8217,"147":8220,"148":8221,"149":8226,"150":8211,"151":8212,"152":732,"153":8482,"154":353,"155":8250,"156":339,"158":382,"159":376} 3095 | },{}],16:[function(require,module,exports){ 3096 | module.exports={"Aacute":"\u00C1","aacute":"\u00E1","Abreve":"\u0102","abreve":"\u0103","ac":"\u223E","acd":"\u223F","acE":"\u223E\u0333","Acirc":"\u00C2","acirc":"\u00E2","acute":"\u00B4","Acy":"\u0410","acy":"\u0430","AElig":"\u00C6","aelig":"\u00E6","af":"\u2061","Afr":"\uD835\uDD04","afr":"\uD835\uDD1E","Agrave":"\u00C0","agrave":"\u00E0","alefsym":"\u2135","aleph":"\u2135","Alpha":"\u0391","alpha":"\u03B1","Amacr":"\u0100","amacr":"\u0101","amalg":"\u2A3F","amp":"&","AMP":"&","andand":"\u2A55","And":"\u2A53","and":"\u2227","andd":"\u2A5C","andslope":"\u2A58","andv":"\u2A5A","ang":"\u2220","ange":"\u29A4","angle":"\u2220","angmsdaa":"\u29A8","angmsdab":"\u29A9","angmsdac":"\u29AA","angmsdad":"\u29AB","angmsdae":"\u29AC","angmsdaf":"\u29AD","angmsdag":"\u29AE","angmsdah":"\u29AF","angmsd":"\u2221","angrt":"\u221F","angrtvb":"\u22BE","angrtvbd":"\u299D","angsph":"\u2222","angst":"\u00C5","angzarr":"\u237C","Aogon":"\u0104","aogon":"\u0105","Aopf":"\uD835\uDD38","aopf":"\uD835\uDD52","apacir":"\u2A6F","ap":"\u2248","apE":"\u2A70","ape":"\u224A","apid":"\u224B","apos":"'","ApplyFunction":"\u2061","approx":"\u2248","approxeq":"\u224A","Aring":"\u00C5","aring":"\u00E5","Ascr":"\uD835\uDC9C","ascr":"\uD835\uDCB6","Assign":"\u2254","ast":"*","asymp":"\u2248","asympeq":"\u224D","Atilde":"\u00C3","atilde":"\u00E3","Auml":"\u00C4","auml":"\u00E4","awconint":"\u2233","awint":"\u2A11","backcong":"\u224C","backepsilon":"\u03F6","backprime":"\u2035","backsim":"\u223D","backsimeq":"\u22CD","Backslash":"\u2216","Barv":"\u2AE7","barvee":"\u22BD","barwed":"\u2305","Barwed":"\u2306","barwedge":"\u2305","bbrk":"\u23B5","bbrktbrk":"\u23B6","bcong":"\u224C","Bcy":"\u0411","bcy":"\u0431","bdquo":"\u201E","becaus":"\u2235","because":"\u2235","Because":"\u2235","bemptyv":"\u29B0","bepsi":"\u03F6","bernou":"\u212C","Bernoullis":"\u212C","Beta":"\u0392","beta":"\u03B2","beth":"\u2136","between":"\u226C","Bfr":"\uD835\uDD05","bfr":"\uD835\uDD1F","bigcap":"\u22C2","bigcirc":"\u25EF","bigcup":"\u22C3","bigodot":"\u2A00","bigoplus":"\u2A01","bigotimes":"\u2A02","bigsqcup":"\u2A06","bigstar":"\u2605","bigtriangledown":"\u25BD","bigtriangleup":"\u25B3","biguplus":"\u2A04","bigvee":"\u22C1","bigwedge":"\u22C0","bkarow":"\u290D","blacklozenge":"\u29EB","blacksquare":"\u25AA","blacktriangle":"\u25B4","blacktriangledown":"\u25BE","blacktriangleleft":"\u25C2","blacktriangleright":"\u25B8","blank":"\u2423","blk12":"\u2592","blk14":"\u2591","blk34":"\u2593","block":"\u2588","bne":"=\u20E5","bnequiv":"\u2261\u20E5","bNot":"\u2AED","bnot":"\u2310","Bopf":"\uD835\uDD39","bopf":"\uD835\uDD53","bot":"\u22A5","bottom":"\u22A5","bowtie":"\u22C8","boxbox":"\u29C9","boxdl":"\u2510","boxdL":"\u2555","boxDl":"\u2556","boxDL":"\u2557","boxdr":"\u250C","boxdR":"\u2552","boxDr":"\u2553","boxDR":"\u2554","boxh":"\u2500","boxH":"\u2550","boxhd":"\u252C","boxHd":"\u2564","boxhD":"\u2565","boxHD":"\u2566","boxhu":"\u2534","boxHu":"\u2567","boxhU":"\u2568","boxHU":"\u2569","boxminus":"\u229F","boxplus":"\u229E","boxtimes":"\u22A0","boxul":"\u2518","boxuL":"\u255B","boxUl":"\u255C","boxUL":"\u255D","boxur":"\u2514","boxuR":"\u2558","boxUr":"\u2559","boxUR":"\u255A","boxv":"\u2502","boxV":"\u2551","boxvh":"\u253C","boxvH":"\u256A","boxVh":"\u256B","boxVH":"\u256C","boxvl":"\u2524","boxvL":"\u2561","boxVl":"\u2562","boxVL":"\u2563","boxvr":"\u251C","boxvR":"\u255E","boxVr":"\u255F","boxVR":"\u2560","bprime":"\u2035","breve":"\u02D8","Breve":"\u02D8","brvbar":"\u00A6","bscr":"\uD835\uDCB7","Bscr":"\u212C","bsemi":"\u204F","bsim":"\u223D","bsime":"\u22CD","bsolb":"\u29C5","bsol":"\\","bsolhsub":"\u27C8","bull":"\u2022","bullet":"\u2022","bump":"\u224E","bumpE":"\u2AAE","bumpe":"\u224F","Bumpeq":"\u224E","bumpeq":"\u224F","Cacute":"\u0106","cacute":"\u0107","capand":"\u2A44","capbrcup":"\u2A49","capcap":"\u2A4B","cap":"\u2229","Cap":"\u22D2","capcup":"\u2A47","capdot":"\u2A40","CapitalDifferentialD":"\u2145","caps":"\u2229\uFE00","caret":"\u2041","caron":"\u02C7","Cayleys":"\u212D","ccaps":"\u2A4D","Ccaron":"\u010C","ccaron":"\u010D","Ccedil":"\u00C7","ccedil":"\u00E7","Ccirc":"\u0108","ccirc":"\u0109","Cconint":"\u2230","ccups":"\u2A4C","ccupssm":"\u2A50","Cdot":"\u010A","cdot":"\u010B","cedil":"\u00B8","Cedilla":"\u00B8","cemptyv":"\u29B2","cent":"\u00A2","centerdot":"\u00B7","CenterDot":"\u00B7","cfr":"\uD835\uDD20","Cfr":"\u212D","CHcy":"\u0427","chcy":"\u0447","check":"\u2713","checkmark":"\u2713","Chi":"\u03A7","chi":"\u03C7","circ":"\u02C6","circeq":"\u2257","circlearrowleft":"\u21BA","circlearrowright":"\u21BB","circledast":"\u229B","circledcirc":"\u229A","circleddash":"\u229D","CircleDot":"\u2299","circledR":"\u00AE","circledS":"\u24C8","CircleMinus":"\u2296","CirclePlus":"\u2295","CircleTimes":"\u2297","cir":"\u25CB","cirE":"\u29C3","cire":"\u2257","cirfnint":"\u2A10","cirmid":"\u2AEF","cirscir":"\u29C2","ClockwiseContourIntegral":"\u2232","CloseCurlyDoubleQuote":"\u201D","CloseCurlyQuote":"\u2019","clubs":"\u2663","clubsuit":"\u2663","colon":":","Colon":"\u2237","Colone":"\u2A74","colone":"\u2254","coloneq":"\u2254","comma":",","commat":"@","comp":"\u2201","compfn":"\u2218","complement":"\u2201","complexes":"\u2102","cong":"\u2245","congdot":"\u2A6D","Congruent":"\u2261","conint":"\u222E","Conint":"\u222F","ContourIntegral":"\u222E","copf":"\uD835\uDD54","Copf":"\u2102","coprod":"\u2210","Coproduct":"\u2210","copy":"\u00A9","COPY":"\u00A9","copysr":"\u2117","CounterClockwiseContourIntegral":"\u2233","crarr":"\u21B5","cross":"\u2717","Cross":"\u2A2F","Cscr":"\uD835\uDC9E","cscr":"\uD835\uDCB8","csub":"\u2ACF","csube":"\u2AD1","csup":"\u2AD0","csupe":"\u2AD2","ctdot":"\u22EF","cudarrl":"\u2938","cudarrr":"\u2935","cuepr":"\u22DE","cuesc":"\u22DF","cularr":"\u21B6","cularrp":"\u293D","cupbrcap":"\u2A48","cupcap":"\u2A46","CupCap":"\u224D","cup":"\u222A","Cup":"\u22D3","cupcup":"\u2A4A","cupdot":"\u228D","cupor":"\u2A45","cups":"\u222A\uFE00","curarr":"\u21B7","curarrm":"\u293C","curlyeqprec":"\u22DE","curlyeqsucc":"\u22DF","curlyvee":"\u22CE","curlywedge":"\u22CF","curren":"\u00A4","curvearrowleft":"\u21B6","curvearrowright":"\u21B7","cuvee":"\u22CE","cuwed":"\u22CF","cwconint":"\u2232","cwint":"\u2231","cylcty":"\u232D","dagger":"\u2020","Dagger":"\u2021","daleth":"\u2138","darr":"\u2193","Darr":"\u21A1","dArr":"\u21D3","dash":"\u2010","Dashv":"\u2AE4","dashv":"\u22A3","dbkarow":"\u290F","dblac":"\u02DD","Dcaron":"\u010E","dcaron":"\u010F","Dcy":"\u0414","dcy":"\u0434","ddagger":"\u2021","ddarr":"\u21CA","DD":"\u2145","dd":"\u2146","DDotrahd":"\u2911","ddotseq":"\u2A77","deg":"\u00B0","Del":"\u2207","Delta":"\u0394","delta":"\u03B4","demptyv":"\u29B1","dfisht":"\u297F","Dfr":"\uD835\uDD07","dfr":"\uD835\uDD21","dHar":"\u2965","dharl":"\u21C3","dharr":"\u21C2","DiacriticalAcute":"\u00B4","DiacriticalDot":"\u02D9","DiacriticalDoubleAcute":"\u02DD","DiacriticalGrave":"`","DiacriticalTilde":"\u02DC","diam":"\u22C4","diamond":"\u22C4","Diamond":"\u22C4","diamondsuit":"\u2666","diams":"\u2666","die":"\u00A8","DifferentialD":"\u2146","digamma":"\u03DD","disin":"\u22F2","div":"\u00F7","divide":"\u00F7","divideontimes":"\u22C7","divonx":"\u22C7","DJcy":"\u0402","djcy":"\u0452","dlcorn":"\u231E","dlcrop":"\u230D","dollar":"$","Dopf":"\uD835\uDD3B","dopf":"\uD835\uDD55","Dot":"\u00A8","dot":"\u02D9","DotDot":"\u20DC","doteq":"\u2250","doteqdot":"\u2251","DotEqual":"\u2250","dotminus":"\u2238","dotplus":"\u2214","dotsquare":"\u22A1","doublebarwedge":"\u2306","DoubleContourIntegral":"\u222F","DoubleDot":"\u00A8","DoubleDownArrow":"\u21D3","DoubleLeftArrow":"\u21D0","DoubleLeftRightArrow":"\u21D4","DoubleLeftTee":"\u2AE4","DoubleLongLeftArrow":"\u27F8","DoubleLongLeftRightArrow":"\u27FA","DoubleLongRightArrow":"\u27F9","DoubleRightArrow":"\u21D2","DoubleRightTee":"\u22A8","DoubleUpArrow":"\u21D1","DoubleUpDownArrow":"\u21D5","DoubleVerticalBar":"\u2225","DownArrowBar":"\u2913","downarrow":"\u2193","DownArrow":"\u2193","Downarrow":"\u21D3","DownArrowUpArrow":"\u21F5","DownBreve":"\u0311","downdownarrows":"\u21CA","downharpoonleft":"\u21C3","downharpoonright":"\u21C2","DownLeftRightVector":"\u2950","DownLeftTeeVector":"\u295E","DownLeftVectorBar":"\u2956","DownLeftVector":"\u21BD","DownRightTeeVector":"\u295F","DownRightVectorBar":"\u2957","DownRightVector":"\u21C1","DownTeeArrow":"\u21A7","DownTee":"\u22A4","drbkarow":"\u2910","drcorn":"\u231F","drcrop":"\u230C","Dscr":"\uD835\uDC9F","dscr":"\uD835\uDCB9","DScy":"\u0405","dscy":"\u0455","dsol":"\u29F6","Dstrok":"\u0110","dstrok":"\u0111","dtdot":"\u22F1","dtri":"\u25BF","dtrif":"\u25BE","duarr":"\u21F5","duhar":"\u296F","dwangle":"\u29A6","DZcy":"\u040F","dzcy":"\u045F","dzigrarr":"\u27FF","Eacute":"\u00C9","eacute":"\u00E9","easter":"\u2A6E","Ecaron":"\u011A","ecaron":"\u011B","Ecirc":"\u00CA","ecirc":"\u00EA","ecir":"\u2256","ecolon":"\u2255","Ecy":"\u042D","ecy":"\u044D","eDDot":"\u2A77","Edot":"\u0116","edot":"\u0117","eDot":"\u2251","ee":"\u2147","efDot":"\u2252","Efr":"\uD835\uDD08","efr":"\uD835\uDD22","eg":"\u2A9A","Egrave":"\u00C8","egrave":"\u00E8","egs":"\u2A96","egsdot":"\u2A98","el":"\u2A99","Element":"\u2208","elinters":"\u23E7","ell":"\u2113","els":"\u2A95","elsdot":"\u2A97","Emacr":"\u0112","emacr":"\u0113","empty":"\u2205","emptyset":"\u2205","EmptySmallSquare":"\u25FB","emptyv":"\u2205","EmptyVerySmallSquare":"\u25AB","emsp13":"\u2004","emsp14":"\u2005","emsp":"\u2003","ENG":"\u014A","eng":"\u014B","ensp":"\u2002","Eogon":"\u0118","eogon":"\u0119","Eopf":"\uD835\uDD3C","eopf":"\uD835\uDD56","epar":"\u22D5","eparsl":"\u29E3","eplus":"\u2A71","epsi":"\u03B5","Epsilon":"\u0395","epsilon":"\u03B5","epsiv":"\u03F5","eqcirc":"\u2256","eqcolon":"\u2255","eqsim":"\u2242","eqslantgtr":"\u2A96","eqslantless":"\u2A95","Equal":"\u2A75","equals":"=","EqualTilde":"\u2242","equest":"\u225F","Equilibrium":"\u21CC","equiv":"\u2261","equivDD":"\u2A78","eqvparsl":"\u29E5","erarr":"\u2971","erDot":"\u2253","escr":"\u212F","Escr":"\u2130","esdot":"\u2250","Esim":"\u2A73","esim":"\u2242","Eta":"\u0397","eta":"\u03B7","ETH":"\u00D0","eth":"\u00F0","Euml":"\u00CB","euml":"\u00EB","euro":"\u20AC","excl":"!","exist":"\u2203","Exists":"\u2203","expectation":"\u2130","exponentiale":"\u2147","ExponentialE":"\u2147","fallingdotseq":"\u2252","Fcy":"\u0424","fcy":"\u0444","female":"\u2640","ffilig":"\uFB03","fflig":"\uFB00","ffllig":"\uFB04","Ffr":"\uD835\uDD09","ffr":"\uD835\uDD23","filig":"\uFB01","FilledSmallSquare":"\u25FC","FilledVerySmallSquare":"\u25AA","fjlig":"fj","flat":"\u266D","fllig":"\uFB02","fltns":"\u25B1","fnof":"\u0192","Fopf":"\uD835\uDD3D","fopf":"\uD835\uDD57","forall":"\u2200","ForAll":"\u2200","fork":"\u22D4","forkv":"\u2AD9","Fouriertrf":"\u2131","fpartint":"\u2A0D","frac12":"\u00BD","frac13":"\u2153","frac14":"\u00BC","frac15":"\u2155","frac16":"\u2159","frac18":"\u215B","frac23":"\u2154","frac25":"\u2156","frac34":"\u00BE","frac35":"\u2157","frac38":"\u215C","frac45":"\u2158","frac56":"\u215A","frac58":"\u215D","frac78":"\u215E","frasl":"\u2044","frown":"\u2322","fscr":"\uD835\uDCBB","Fscr":"\u2131","gacute":"\u01F5","Gamma":"\u0393","gamma":"\u03B3","Gammad":"\u03DC","gammad":"\u03DD","gap":"\u2A86","Gbreve":"\u011E","gbreve":"\u011F","Gcedil":"\u0122","Gcirc":"\u011C","gcirc":"\u011D","Gcy":"\u0413","gcy":"\u0433","Gdot":"\u0120","gdot":"\u0121","ge":"\u2265","gE":"\u2267","gEl":"\u2A8C","gel":"\u22DB","geq":"\u2265","geqq":"\u2267","geqslant":"\u2A7E","gescc":"\u2AA9","ges":"\u2A7E","gesdot":"\u2A80","gesdoto":"\u2A82","gesdotol":"\u2A84","gesl":"\u22DB\uFE00","gesles":"\u2A94","Gfr":"\uD835\uDD0A","gfr":"\uD835\uDD24","gg":"\u226B","Gg":"\u22D9","ggg":"\u22D9","gimel":"\u2137","GJcy":"\u0403","gjcy":"\u0453","gla":"\u2AA5","gl":"\u2277","glE":"\u2A92","glj":"\u2AA4","gnap":"\u2A8A","gnapprox":"\u2A8A","gne":"\u2A88","gnE":"\u2269","gneq":"\u2A88","gneqq":"\u2269","gnsim":"\u22E7","Gopf":"\uD835\uDD3E","gopf":"\uD835\uDD58","grave":"`","GreaterEqual":"\u2265","GreaterEqualLess":"\u22DB","GreaterFullEqual":"\u2267","GreaterGreater":"\u2AA2","GreaterLess":"\u2277","GreaterSlantEqual":"\u2A7E","GreaterTilde":"\u2273","Gscr":"\uD835\uDCA2","gscr":"\u210A","gsim":"\u2273","gsime":"\u2A8E","gsiml":"\u2A90","gtcc":"\u2AA7","gtcir":"\u2A7A","gt":">","GT":">","Gt":"\u226B","gtdot":"\u22D7","gtlPar":"\u2995","gtquest":"\u2A7C","gtrapprox":"\u2A86","gtrarr":"\u2978","gtrdot":"\u22D7","gtreqless":"\u22DB","gtreqqless":"\u2A8C","gtrless":"\u2277","gtrsim":"\u2273","gvertneqq":"\u2269\uFE00","gvnE":"\u2269\uFE00","Hacek":"\u02C7","hairsp":"\u200A","half":"\u00BD","hamilt":"\u210B","HARDcy":"\u042A","hardcy":"\u044A","harrcir":"\u2948","harr":"\u2194","hArr":"\u21D4","harrw":"\u21AD","Hat":"^","hbar":"\u210F","Hcirc":"\u0124","hcirc":"\u0125","hearts":"\u2665","heartsuit":"\u2665","hellip":"\u2026","hercon":"\u22B9","hfr":"\uD835\uDD25","Hfr":"\u210C","HilbertSpace":"\u210B","hksearow":"\u2925","hkswarow":"\u2926","hoarr":"\u21FF","homtht":"\u223B","hookleftarrow":"\u21A9","hookrightarrow":"\u21AA","hopf":"\uD835\uDD59","Hopf":"\u210D","horbar":"\u2015","HorizontalLine":"\u2500","hscr":"\uD835\uDCBD","Hscr":"\u210B","hslash":"\u210F","Hstrok":"\u0126","hstrok":"\u0127","HumpDownHump":"\u224E","HumpEqual":"\u224F","hybull":"\u2043","hyphen":"\u2010","Iacute":"\u00CD","iacute":"\u00ED","ic":"\u2063","Icirc":"\u00CE","icirc":"\u00EE","Icy":"\u0418","icy":"\u0438","Idot":"\u0130","IEcy":"\u0415","iecy":"\u0435","iexcl":"\u00A1","iff":"\u21D4","ifr":"\uD835\uDD26","Ifr":"\u2111","Igrave":"\u00CC","igrave":"\u00EC","ii":"\u2148","iiiint":"\u2A0C","iiint":"\u222D","iinfin":"\u29DC","iiota":"\u2129","IJlig":"\u0132","ijlig":"\u0133","Imacr":"\u012A","imacr":"\u012B","image":"\u2111","ImaginaryI":"\u2148","imagline":"\u2110","imagpart":"\u2111","imath":"\u0131","Im":"\u2111","imof":"\u22B7","imped":"\u01B5","Implies":"\u21D2","incare":"\u2105","in":"\u2208","infin":"\u221E","infintie":"\u29DD","inodot":"\u0131","intcal":"\u22BA","int":"\u222B","Int":"\u222C","integers":"\u2124","Integral":"\u222B","intercal":"\u22BA","Intersection":"\u22C2","intlarhk":"\u2A17","intprod":"\u2A3C","InvisibleComma":"\u2063","InvisibleTimes":"\u2062","IOcy":"\u0401","iocy":"\u0451","Iogon":"\u012E","iogon":"\u012F","Iopf":"\uD835\uDD40","iopf":"\uD835\uDD5A","Iota":"\u0399","iota":"\u03B9","iprod":"\u2A3C","iquest":"\u00BF","iscr":"\uD835\uDCBE","Iscr":"\u2110","isin":"\u2208","isindot":"\u22F5","isinE":"\u22F9","isins":"\u22F4","isinsv":"\u22F3","isinv":"\u2208","it":"\u2062","Itilde":"\u0128","itilde":"\u0129","Iukcy":"\u0406","iukcy":"\u0456","Iuml":"\u00CF","iuml":"\u00EF","Jcirc":"\u0134","jcirc":"\u0135","Jcy":"\u0419","jcy":"\u0439","Jfr":"\uD835\uDD0D","jfr":"\uD835\uDD27","jmath":"\u0237","Jopf":"\uD835\uDD41","jopf":"\uD835\uDD5B","Jscr":"\uD835\uDCA5","jscr":"\uD835\uDCBF","Jsercy":"\u0408","jsercy":"\u0458","Jukcy":"\u0404","jukcy":"\u0454","Kappa":"\u039A","kappa":"\u03BA","kappav":"\u03F0","Kcedil":"\u0136","kcedil":"\u0137","Kcy":"\u041A","kcy":"\u043A","Kfr":"\uD835\uDD0E","kfr":"\uD835\uDD28","kgreen":"\u0138","KHcy":"\u0425","khcy":"\u0445","KJcy":"\u040C","kjcy":"\u045C","Kopf":"\uD835\uDD42","kopf":"\uD835\uDD5C","Kscr":"\uD835\uDCA6","kscr":"\uD835\uDCC0","lAarr":"\u21DA","Lacute":"\u0139","lacute":"\u013A","laemptyv":"\u29B4","lagran":"\u2112","Lambda":"\u039B","lambda":"\u03BB","lang":"\u27E8","Lang":"\u27EA","langd":"\u2991","langle":"\u27E8","lap":"\u2A85","Laplacetrf":"\u2112","laquo":"\u00AB","larrb":"\u21E4","larrbfs":"\u291F","larr":"\u2190","Larr":"\u219E","lArr":"\u21D0","larrfs":"\u291D","larrhk":"\u21A9","larrlp":"\u21AB","larrpl":"\u2939","larrsim":"\u2973","larrtl":"\u21A2","latail":"\u2919","lAtail":"\u291B","lat":"\u2AAB","late":"\u2AAD","lates":"\u2AAD\uFE00","lbarr":"\u290C","lBarr":"\u290E","lbbrk":"\u2772","lbrace":"{","lbrack":"[","lbrke":"\u298B","lbrksld":"\u298F","lbrkslu":"\u298D","Lcaron":"\u013D","lcaron":"\u013E","Lcedil":"\u013B","lcedil":"\u013C","lceil":"\u2308","lcub":"{","Lcy":"\u041B","lcy":"\u043B","ldca":"\u2936","ldquo":"\u201C","ldquor":"\u201E","ldrdhar":"\u2967","ldrushar":"\u294B","ldsh":"\u21B2","le":"\u2264","lE":"\u2266","LeftAngleBracket":"\u27E8","LeftArrowBar":"\u21E4","leftarrow":"\u2190","LeftArrow":"\u2190","Leftarrow":"\u21D0","LeftArrowRightArrow":"\u21C6","leftarrowtail":"\u21A2","LeftCeiling":"\u2308","LeftDoubleBracket":"\u27E6","LeftDownTeeVector":"\u2961","LeftDownVectorBar":"\u2959","LeftDownVector":"\u21C3","LeftFloor":"\u230A","leftharpoondown":"\u21BD","leftharpoonup":"\u21BC","leftleftarrows":"\u21C7","leftrightarrow":"\u2194","LeftRightArrow":"\u2194","Leftrightarrow":"\u21D4","leftrightarrows":"\u21C6","leftrightharpoons":"\u21CB","leftrightsquigarrow":"\u21AD","LeftRightVector":"\u294E","LeftTeeArrow":"\u21A4","LeftTee":"\u22A3","LeftTeeVector":"\u295A","leftthreetimes":"\u22CB","LeftTriangleBar":"\u29CF","LeftTriangle":"\u22B2","LeftTriangleEqual":"\u22B4","LeftUpDownVector":"\u2951","LeftUpTeeVector":"\u2960","LeftUpVectorBar":"\u2958","LeftUpVector":"\u21BF","LeftVectorBar":"\u2952","LeftVector":"\u21BC","lEg":"\u2A8B","leg":"\u22DA","leq":"\u2264","leqq":"\u2266","leqslant":"\u2A7D","lescc":"\u2AA8","les":"\u2A7D","lesdot":"\u2A7F","lesdoto":"\u2A81","lesdotor":"\u2A83","lesg":"\u22DA\uFE00","lesges":"\u2A93","lessapprox":"\u2A85","lessdot":"\u22D6","lesseqgtr":"\u22DA","lesseqqgtr":"\u2A8B","LessEqualGreater":"\u22DA","LessFullEqual":"\u2266","LessGreater":"\u2276","lessgtr":"\u2276","LessLess":"\u2AA1","lesssim":"\u2272","LessSlantEqual":"\u2A7D","LessTilde":"\u2272","lfisht":"\u297C","lfloor":"\u230A","Lfr":"\uD835\uDD0F","lfr":"\uD835\uDD29","lg":"\u2276","lgE":"\u2A91","lHar":"\u2962","lhard":"\u21BD","lharu":"\u21BC","lharul":"\u296A","lhblk":"\u2584","LJcy":"\u0409","ljcy":"\u0459","llarr":"\u21C7","ll":"\u226A","Ll":"\u22D8","llcorner":"\u231E","Lleftarrow":"\u21DA","llhard":"\u296B","lltri":"\u25FA","Lmidot":"\u013F","lmidot":"\u0140","lmoustache":"\u23B0","lmoust":"\u23B0","lnap":"\u2A89","lnapprox":"\u2A89","lne":"\u2A87","lnE":"\u2268","lneq":"\u2A87","lneqq":"\u2268","lnsim":"\u22E6","loang":"\u27EC","loarr":"\u21FD","lobrk":"\u27E6","longleftarrow":"\u27F5","LongLeftArrow":"\u27F5","Longleftarrow":"\u27F8","longleftrightarrow":"\u27F7","LongLeftRightArrow":"\u27F7","Longleftrightarrow":"\u27FA","longmapsto":"\u27FC","longrightarrow":"\u27F6","LongRightArrow":"\u27F6","Longrightarrow":"\u27F9","looparrowleft":"\u21AB","looparrowright":"\u21AC","lopar":"\u2985","Lopf":"\uD835\uDD43","lopf":"\uD835\uDD5D","loplus":"\u2A2D","lotimes":"\u2A34","lowast":"\u2217","lowbar":"_","LowerLeftArrow":"\u2199","LowerRightArrow":"\u2198","loz":"\u25CA","lozenge":"\u25CA","lozf":"\u29EB","lpar":"(","lparlt":"\u2993","lrarr":"\u21C6","lrcorner":"\u231F","lrhar":"\u21CB","lrhard":"\u296D","lrm":"\u200E","lrtri":"\u22BF","lsaquo":"\u2039","lscr":"\uD835\uDCC1","Lscr":"\u2112","lsh":"\u21B0","Lsh":"\u21B0","lsim":"\u2272","lsime":"\u2A8D","lsimg":"\u2A8F","lsqb":"[","lsquo":"\u2018","lsquor":"\u201A","Lstrok":"\u0141","lstrok":"\u0142","ltcc":"\u2AA6","ltcir":"\u2A79","lt":"<","LT":"<","Lt":"\u226A","ltdot":"\u22D6","lthree":"\u22CB","ltimes":"\u22C9","ltlarr":"\u2976","ltquest":"\u2A7B","ltri":"\u25C3","ltrie":"\u22B4","ltrif":"\u25C2","ltrPar":"\u2996","lurdshar":"\u294A","luruhar":"\u2966","lvertneqq":"\u2268\uFE00","lvnE":"\u2268\uFE00","macr":"\u00AF","male":"\u2642","malt":"\u2720","maltese":"\u2720","Map":"\u2905","map":"\u21A6","mapsto":"\u21A6","mapstodown":"\u21A7","mapstoleft":"\u21A4","mapstoup":"\u21A5","marker":"\u25AE","mcomma":"\u2A29","Mcy":"\u041C","mcy":"\u043C","mdash":"\u2014","mDDot":"\u223A","measuredangle":"\u2221","MediumSpace":"\u205F","Mellintrf":"\u2133","Mfr":"\uD835\uDD10","mfr":"\uD835\uDD2A","mho":"\u2127","micro":"\u00B5","midast":"*","midcir":"\u2AF0","mid":"\u2223","middot":"\u00B7","minusb":"\u229F","minus":"\u2212","minusd":"\u2238","minusdu":"\u2A2A","MinusPlus":"\u2213","mlcp":"\u2ADB","mldr":"\u2026","mnplus":"\u2213","models":"\u22A7","Mopf":"\uD835\uDD44","mopf":"\uD835\uDD5E","mp":"\u2213","mscr":"\uD835\uDCC2","Mscr":"\u2133","mstpos":"\u223E","Mu":"\u039C","mu":"\u03BC","multimap":"\u22B8","mumap":"\u22B8","nabla":"\u2207","Nacute":"\u0143","nacute":"\u0144","nang":"\u2220\u20D2","nap":"\u2249","napE":"\u2A70\u0338","napid":"\u224B\u0338","napos":"\u0149","napprox":"\u2249","natural":"\u266E","naturals":"\u2115","natur":"\u266E","nbsp":"\u00A0","nbump":"\u224E\u0338","nbumpe":"\u224F\u0338","ncap":"\u2A43","Ncaron":"\u0147","ncaron":"\u0148","Ncedil":"\u0145","ncedil":"\u0146","ncong":"\u2247","ncongdot":"\u2A6D\u0338","ncup":"\u2A42","Ncy":"\u041D","ncy":"\u043D","ndash":"\u2013","nearhk":"\u2924","nearr":"\u2197","neArr":"\u21D7","nearrow":"\u2197","ne":"\u2260","nedot":"\u2250\u0338","NegativeMediumSpace":"\u200B","NegativeThickSpace":"\u200B","NegativeThinSpace":"\u200B","NegativeVeryThinSpace":"\u200B","nequiv":"\u2262","nesear":"\u2928","nesim":"\u2242\u0338","NestedGreaterGreater":"\u226B","NestedLessLess":"\u226A","NewLine":"\n","nexist":"\u2204","nexists":"\u2204","Nfr":"\uD835\uDD11","nfr":"\uD835\uDD2B","ngE":"\u2267\u0338","nge":"\u2271","ngeq":"\u2271","ngeqq":"\u2267\u0338","ngeqslant":"\u2A7E\u0338","nges":"\u2A7E\u0338","nGg":"\u22D9\u0338","ngsim":"\u2275","nGt":"\u226B\u20D2","ngt":"\u226F","ngtr":"\u226F","nGtv":"\u226B\u0338","nharr":"\u21AE","nhArr":"\u21CE","nhpar":"\u2AF2","ni":"\u220B","nis":"\u22FC","nisd":"\u22FA","niv":"\u220B","NJcy":"\u040A","njcy":"\u045A","nlarr":"\u219A","nlArr":"\u21CD","nldr":"\u2025","nlE":"\u2266\u0338","nle":"\u2270","nleftarrow":"\u219A","nLeftarrow":"\u21CD","nleftrightarrow":"\u21AE","nLeftrightarrow":"\u21CE","nleq":"\u2270","nleqq":"\u2266\u0338","nleqslant":"\u2A7D\u0338","nles":"\u2A7D\u0338","nless":"\u226E","nLl":"\u22D8\u0338","nlsim":"\u2274","nLt":"\u226A\u20D2","nlt":"\u226E","nltri":"\u22EA","nltrie":"\u22EC","nLtv":"\u226A\u0338","nmid":"\u2224","NoBreak":"\u2060","NonBreakingSpace":"\u00A0","nopf":"\uD835\uDD5F","Nopf":"\u2115","Not":"\u2AEC","not":"\u00AC","NotCongruent":"\u2262","NotCupCap":"\u226D","NotDoubleVerticalBar":"\u2226","NotElement":"\u2209","NotEqual":"\u2260","NotEqualTilde":"\u2242\u0338","NotExists":"\u2204","NotGreater":"\u226F","NotGreaterEqual":"\u2271","NotGreaterFullEqual":"\u2267\u0338","NotGreaterGreater":"\u226B\u0338","NotGreaterLess":"\u2279","NotGreaterSlantEqual":"\u2A7E\u0338","NotGreaterTilde":"\u2275","NotHumpDownHump":"\u224E\u0338","NotHumpEqual":"\u224F\u0338","notin":"\u2209","notindot":"\u22F5\u0338","notinE":"\u22F9\u0338","notinva":"\u2209","notinvb":"\u22F7","notinvc":"\u22F6","NotLeftTriangleBar":"\u29CF\u0338","NotLeftTriangle":"\u22EA","NotLeftTriangleEqual":"\u22EC","NotLess":"\u226E","NotLessEqual":"\u2270","NotLessGreater":"\u2278","NotLessLess":"\u226A\u0338","NotLessSlantEqual":"\u2A7D\u0338","NotLessTilde":"\u2274","NotNestedGreaterGreater":"\u2AA2\u0338","NotNestedLessLess":"\u2AA1\u0338","notni":"\u220C","notniva":"\u220C","notnivb":"\u22FE","notnivc":"\u22FD","NotPrecedes":"\u2280","NotPrecedesEqual":"\u2AAF\u0338","NotPrecedesSlantEqual":"\u22E0","NotReverseElement":"\u220C","NotRightTriangleBar":"\u29D0\u0338","NotRightTriangle":"\u22EB","NotRightTriangleEqual":"\u22ED","NotSquareSubset":"\u228F\u0338","NotSquareSubsetEqual":"\u22E2","NotSquareSuperset":"\u2290\u0338","NotSquareSupersetEqual":"\u22E3","NotSubset":"\u2282\u20D2","NotSubsetEqual":"\u2288","NotSucceeds":"\u2281","NotSucceedsEqual":"\u2AB0\u0338","NotSucceedsSlantEqual":"\u22E1","NotSucceedsTilde":"\u227F\u0338","NotSuperset":"\u2283\u20D2","NotSupersetEqual":"\u2289","NotTilde":"\u2241","NotTildeEqual":"\u2244","NotTildeFullEqual":"\u2247","NotTildeTilde":"\u2249","NotVerticalBar":"\u2224","nparallel":"\u2226","npar":"\u2226","nparsl":"\u2AFD\u20E5","npart":"\u2202\u0338","npolint":"\u2A14","npr":"\u2280","nprcue":"\u22E0","nprec":"\u2280","npreceq":"\u2AAF\u0338","npre":"\u2AAF\u0338","nrarrc":"\u2933\u0338","nrarr":"\u219B","nrArr":"\u21CF","nrarrw":"\u219D\u0338","nrightarrow":"\u219B","nRightarrow":"\u21CF","nrtri":"\u22EB","nrtrie":"\u22ED","nsc":"\u2281","nsccue":"\u22E1","nsce":"\u2AB0\u0338","Nscr":"\uD835\uDCA9","nscr":"\uD835\uDCC3","nshortmid":"\u2224","nshortparallel":"\u2226","nsim":"\u2241","nsime":"\u2244","nsimeq":"\u2244","nsmid":"\u2224","nspar":"\u2226","nsqsube":"\u22E2","nsqsupe":"\u22E3","nsub":"\u2284","nsubE":"\u2AC5\u0338","nsube":"\u2288","nsubset":"\u2282\u20D2","nsubseteq":"\u2288","nsubseteqq":"\u2AC5\u0338","nsucc":"\u2281","nsucceq":"\u2AB0\u0338","nsup":"\u2285","nsupE":"\u2AC6\u0338","nsupe":"\u2289","nsupset":"\u2283\u20D2","nsupseteq":"\u2289","nsupseteqq":"\u2AC6\u0338","ntgl":"\u2279","Ntilde":"\u00D1","ntilde":"\u00F1","ntlg":"\u2278","ntriangleleft":"\u22EA","ntrianglelefteq":"\u22EC","ntriangleright":"\u22EB","ntrianglerighteq":"\u22ED","Nu":"\u039D","nu":"\u03BD","num":"#","numero":"\u2116","numsp":"\u2007","nvap":"\u224D\u20D2","nvdash":"\u22AC","nvDash":"\u22AD","nVdash":"\u22AE","nVDash":"\u22AF","nvge":"\u2265\u20D2","nvgt":">\u20D2","nvHarr":"\u2904","nvinfin":"\u29DE","nvlArr":"\u2902","nvle":"\u2264\u20D2","nvlt":"<\u20D2","nvltrie":"\u22B4\u20D2","nvrArr":"\u2903","nvrtrie":"\u22B5\u20D2","nvsim":"\u223C\u20D2","nwarhk":"\u2923","nwarr":"\u2196","nwArr":"\u21D6","nwarrow":"\u2196","nwnear":"\u2927","Oacute":"\u00D3","oacute":"\u00F3","oast":"\u229B","Ocirc":"\u00D4","ocirc":"\u00F4","ocir":"\u229A","Ocy":"\u041E","ocy":"\u043E","odash":"\u229D","Odblac":"\u0150","odblac":"\u0151","odiv":"\u2A38","odot":"\u2299","odsold":"\u29BC","OElig":"\u0152","oelig":"\u0153","ofcir":"\u29BF","Ofr":"\uD835\uDD12","ofr":"\uD835\uDD2C","ogon":"\u02DB","Ograve":"\u00D2","ograve":"\u00F2","ogt":"\u29C1","ohbar":"\u29B5","ohm":"\u03A9","oint":"\u222E","olarr":"\u21BA","olcir":"\u29BE","olcross":"\u29BB","oline":"\u203E","olt":"\u29C0","Omacr":"\u014C","omacr":"\u014D","Omega":"\u03A9","omega":"\u03C9","Omicron":"\u039F","omicron":"\u03BF","omid":"\u29B6","ominus":"\u2296","Oopf":"\uD835\uDD46","oopf":"\uD835\uDD60","opar":"\u29B7","OpenCurlyDoubleQuote":"\u201C","OpenCurlyQuote":"\u2018","operp":"\u29B9","oplus":"\u2295","orarr":"\u21BB","Or":"\u2A54","or":"\u2228","ord":"\u2A5D","order":"\u2134","orderof":"\u2134","ordf":"\u00AA","ordm":"\u00BA","origof":"\u22B6","oror":"\u2A56","orslope":"\u2A57","orv":"\u2A5B","oS":"\u24C8","Oscr":"\uD835\uDCAA","oscr":"\u2134","Oslash":"\u00D8","oslash":"\u00F8","osol":"\u2298","Otilde":"\u00D5","otilde":"\u00F5","otimesas":"\u2A36","Otimes":"\u2A37","otimes":"\u2297","Ouml":"\u00D6","ouml":"\u00F6","ovbar":"\u233D","OverBar":"\u203E","OverBrace":"\u23DE","OverBracket":"\u23B4","OverParenthesis":"\u23DC","para":"\u00B6","parallel":"\u2225","par":"\u2225","parsim":"\u2AF3","parsl":"\u2AFD","part":"\u2202","PartialD":"\u2202","Pcy":"\u041F","pcy":"\u043F","percnt":"%","period":".","permil":"\u2030","perp":"\u22A5","pertenk":"\u2031","Pfr":"\uD835\uDD13","pfr":"\uD835\uDD2D","Phi":"\u03A6","phi":"\u03C6","phiv":"\u03D5","phmmat":"\u2133","phone":"\u260E","Pi":"\u03A0","pi":"\u03C0","pitchfork":"\u22D4","piv":"\u03D6","planck":"\u210F","planckh":"\u210E","plankv":"\u210F","plusacir":"\u2A23","plusb":"\u229E","pluscir":"\u2A22","plus":"+","plusdo":"\u2214","plusdu":"\u2A25","pluse":"\u2A72","PlusMinus":"\u00B1","plusmn":"\u00B1","plussim":"\u2A26","plustwo":"\u2A27","pm":"\u00B1","Poincareplane":"\u210C","pointint":"\u2A15","popf":"\uD835\uDD61","Popf":"\u2119","pound":"\u00A3","prap":"\u2AB7","Pr":"\u2ABB","pr":"\u227A","prcue":"\u227C","precapprox":"\u2AB7","prec":"\u227A","preccurlyeq":"\u227C","Precedes":"\u227A","PrecedesEqual":"\u2AAF","PrecedesSlantEqual":"\u227C","PrecedesTilde":"\u227E","preceq":"\u2AAF","precnapprox":"\u2AB9","precneqq":"\u2AB5","precnsim":"\u22E8","pre":"\u2AAF","prE":"\u2AB3","precsim":"\u227E","prime":"\u2032","Prime":"\u2033","primes":"\u2119","prnap":"\u2AB9","prnE":"\u2AB5","prnsim":"\u22E8","prod":"\u220F","Product":"\u220F","profalar":"\u232E","profline":"\u2312","profsurf":"\u2313","prop":"\u221D","Proportional":"\u221D","Proportion":"\u2237","propto":"\u221D","prsim":"\u227E","prurel":"\u22B0","Pscr":"\uD835\uDCAB","pscr":"\uD835\uDCC5","Psi":"\u03A8","psi":"\u03C8","puncsp":"\u2008","Qfr":"\uD835\uDD14","qfr":"\uD835\uDD2E","qint":"\u2A0C","qopf":"\uD835\uDD62","Qopf":"\u211A","qprime":"\u2057","Qscr":"\uD835\uDCAC","qscr":"\uD835\uDCC6","quaternions":"\u210D","quatint":"\u2A16","quest":"?","questeq":"\u225F","quot":"\"","QUOT":"\"","rAarr":"\u21DB","race":"\u223D\u0331","Racute":"\u0154","racute":"\u0155","radic":"\u221A","raemptyv":"\u29B3","rang":"\u27E9","Rang":"\u27EB","rangd":"\u2992","range":"\u29A5","rangle":"\u27E9","raquo":"\u00BB","rarrap":"\u2975","rarrb":"\u21E5","rarrbfs":"\u2920","rarrc":"\u2933","rarr":"\u2192","Rarr":"\u21A0","rArr":"\u21D2","rarrfs":"\u291E","rarrhk":"\u21AA","rarrlp":"\u21AC","rarrpl":"\u2945","rarrsim":"\u2974","Rarrtl":"\u2916","rarrtl":"\u21A3","rarrw":"\u219D","ratail":"\u291A","rAtail":"\u291C","ratio":"\u2236","rationals":"\u211A","rbarr":"\u290D","rBarr":"\u290F","RBarr":"\u2910","rbbrk":"\u2773","rbrace":"}","rbrack":"]","rbrke":"\u298C","rbrksld":"\u298E","rbrkslu":"\u2990","Rcaron":"\u0158","rcaron":"\u0159","Rcedil":"\u0156","rcedil":"\u0157","rceil":"\u2309","rcub":"}","Rcy":"\u0420","rcy":"\u0440","rdca":"\u2937","rdldhar":"\u2969","rdquo":"\u201D","rdquor":"\u201D","rdsh":"\u21B3","real":"\u211C","realine":"\u211B","realpart":"\u211C","reals":"\u211D","Re":"\u211C","rect":"\u25AD","reg":"\u00AE","REG":"\u00AE","ReverseElement":"\u220B","ReverseEquilibrium":"\u21CB","ReverseUpEquilibrium":"\u296F","rfisht":"\u297D","rfloor":"\u230B","rfr":"\uD835\uDD2F","Rfr":"\u211C","rHar":"\u2964","rhard":"\u21C1","rharu":"\u21C0","rharul":"\u296C","Rho":"\u03A1","rho":"\u03C1","rhov":"\u03F1","RightAngleBracket":"\u27E9","RightArrowBar":"\u21E5","rightarrow":"\u2192","RightArrow":"\u2192","Rightarrow":"\u21D2","RightArrowLeftArrow":"\u21C4","rightarrowtail":"\u21A3","RightCeiling":"\u2309","RightDoubleBracket":"\u27E7","RightDownTeeVector":"\u295D","RightDownVectorBar":"\u2955","RightDownVector":"\u21C2","RightFloor":"\u230B","rightharpoondown":"\u21C1","rightharpoonup":"\u21C0","rightleftarrows":"\u21C4","rightleftharpoons":"\u21CC","rightrightarrows":"\u21C9","rightsquigarrow":"\u219D","RightTeeArrow":"\u21A6","RightTee":"\u22A2","RightTeeVector":"\u295B","rightthreetimes":"\u22CC","RightTriangleBar":"\u29D0","RightTriangle":"\u22B3","RightTriangleEqual":"\u22B5","RightUpDownVector":"\u294F","RightUpTeeVector":"\u295C","RightUpVectorBar":"\u2954","RightUpVector":"\u21BE","RightVectorBar":"\u2953","RightVector":"\u21C0","ring":"\u02DA","risingdotseq":"\u2253","rlarr":"\u21C4","rlhar":"\u21CC","rlm":"\u200F","rmoustache":"\u23B1","rmoust":"\u23B1","rnmid":"\u2AEE","roang":"\u27ED","roarr":"\u21FE","robrk":"\u27E7","ropar":"\u2986","ropf":"\uD835\uDD63","Ropf":"\u211D","roplus":"\u2A2E","rotimes":"\u2A35","RoundImplies":"\u2970","rpar":")","rpargt":"\u2994","rppolint":"\u2A12","rrarr":"\u21C9","Rrightarrow":"\u21DB","rsaquo":"\u203A","rscr":"\uD835\uDCC7","Rscr":"\u211B","rsh":"\u21B1","Rsh":"\u21B1","rsqb":"]","rsquo":"\u2019","rsquor":"\u2019","rthree":"\u22CC","rtimes":"\u22CA","rtri":"\u25B9","rtrie":"\u22B5","rtrif":"\u25B8","rtriltri":"\u29CE","RuleDelayed":"\u29F4","ruluhar":"\u2968","rx":"\u211E","Sacute":"\u015A","sacute":"\u015B","sbquo":"\u201A","scap":"\u2AB8","Scaron":"\u0160","scaron":"\u0161","Sc":"\u2ABC","sc":"\u227B","sccue":"\u227D","sce":"\u2AB0","scE":"\u2AB4","Scedil":"\u015E","scedil":"\u015F","Scirc":"\u015C","scirc":"\u015D","scnap":"\u2ABA","scnE":"\u2AB6","scnsim":"\u22E9","scpolint":"\u2A13","scsim":"\u227F","Scy":"\u0421","scy":"\u0441","sdotb":"\u22A1","sdot":"\u22C5","sdote":"\u2A66","searhk":"\u2925","searr":"\u2198","seArr":"\u21D8","searrow":"\u2198","sect":"\u00A7","semi":";","seswar":"\u2929","setminus":"\u2216","setmn":"\u2216","sext":"\u2736","Sfr":"\uD835\uDD16","sfr":"\uD835\uDD30","sfrown":"\u2322","sharp":"\u266F","SHCHcy":"\u0429","shchcy":"\u0449","SHcy":"\u0428","shcy":"\u0448","ShortDownArrow":"\u2193","ShortLeftArrow":"\u2190","shortmid":"\u2223","shortparallel":"\u2225","ShortRightArrow":"\u2192","ShortUpArrow":"\u2191","shy":"\u00AD","Sigma":"\u03A3","sigma":"\u03C3","sigmaf":"\u03C2","sigmav":"\u03C2","sim":"\u223C","simdot":"\u2A6A","sime":"\u2243","simeq":"\u2243","simg":"\u2A9E","simgE":"\u2AA0","siml":"\u2A9D","simlE":"\u2A9F","simne":"\u2246","simplus":"\u2A24","simrarr":"\u2972","slarr":"\u2190","SmallCircle":"\u2218","smallsetminus":"\u2216","smashp":"\u2A33","smeparsl":"\u29E4","smid":"\u2223","smile":"\u2323","smt":"\u2AAA","smte":"\u2AAC","smtes":"\u2AAC\uFE00","SOFTcy":"\u042C","softcy":"\u044C","solbar":"\u233F","solb":"\u29C4","sol":"/","Sopf":"\uD835\uDD4A","sopf":"\uD835\uDD64","spades":"\u2660","spadesuit":"\u2660","spar":"\u2225","sqcap":"\u2293","sqcaps":"\u2293\uFE00","sqcup":"\u2294","sqcups":"\u2294\uFE00","Sqrt":"\u221A","sqsub":"\u228F","sqsube":"\u2291","sqsubset":"\u228F","sqsubseteq":"\u2291","sqsup":"\u2290","sqsupe":"\u2292","sqsupset":"\u2290","sqsupseteq":"\u2292","square":"\u25A1","Square":"\u25A1","SquareIntersection":"\u2293","SquareSubset":"\u228F","SquareSubsetEqual":"\u2291","SquareSuperset":"\u2290","SquareSupersetEqual":"\u2292","SquareUnion":"\u2294","squarf":"\u25AA","squ":"\u25A1","squf":"\u25AA","srarr":"\u2192","Sscr":"\uD835\uDCAE","sscr":"\uD835\uDCC8","ssetmn":"\u2216","ssmile":"\u2323","sstarf":"\u22C6","Star":"\u22C6","star":"\u2606","starf":"\u2605","straightepsilon":"\u03F5","straightphi":"\u03D5","strns":"\u00AF","sub":"\u2282","Sub":"\u22D0","subdot":"\u2ABD","subE":"\u2AC5","sube":"\u2286","subedot":"\u2AC3","submult":"\u2AC1","subnE":"\u2ACB","subne":"\u228A","subplus":"\u2ABF","subrarr":"\u2979","subset":"\u2282","Subset":"\u22D0","subseteq":"\u2286","subseteqq":"\u2AC5","SubsetEqual":"\u2286","subsetneq":"\u228A","subsetneqq":"\u2ACB","subsim":"\u2AC7","subsub":"\u2AD5","subsup":"\u2AD3","succapprox":"\u2AB8","succ":"\u227B","succcurlyeq":"\u227D","Succeeds":"\u227B","SucceedsEqual":"\u2AB0","SucceedsSlantEqual":"\u227D","SucceedsTilde":"\u227F","succeq":"\u2AB0","succnapprox":"\u2ABA","succneqq":"\u2AB6","succnsim":"\u22E9","succsim":"\u227F","SuchThat":"\u220B","sum":"\u2211","Sum":"\u2211","sung":"\u266A","sup1":"\u00B9","sup2":"\u00B2","sup3":"\u00B3","sup":"\u2283","Sup":"\u22D1","supdot":"\u2ABE","supdsub":"\u2AD8","supE":"\u2AC6","supe":"\u2287","supedot":"\u2AC4","Superset":"\u2283","SupersetEqual":"\u2287","suphsol":"\u27C9","suphsub":"\u2AD7","suplarr":"\u297B","supmult":"\u2AC2","supnE":"\u2ACC","supne":"\u228B","supplus":"\u2AC0","supset":"\u2283","Supset":"\u22D1","supseteq":"\u2287","supseteqq":"\u2AC6","supsetneq":"\u228B","supsetneqq":"\u2ACC","supsim":"\u2AC8","supsub":"\u2AD4","supsup":"\u2AD6","swarhk":"\u2926","swarr":"\u2199","swArr":"\u21D9","swarrow":"\u2199","swnwar":"\u292A","szlig":"\u00DF","Tab":"\t","target":"\u2316","Tau":"\u03A4","tau":"\u03C4","tbrk":"\u23B4","Tcaron":"\u0164","tcaron":"\u0165","Tcedil":"\u0162","tcedil":"\u0163","Tcy":"\u0422","tcy":"\u0442","tdot":"\u20DB","telrec":"\u2315","Tfr":"\uD835\uDD17","tfr":"\uD835\uDD31","there4":"\u2234","therefore":"\u2234","Therefore":"\u2234","Theta":"\u0398","theta":"\u03B8","thetasym":"\u03D1","thetav":"\u03D1","thickapprox":"\u2248","thicksim":"\u223C","ThickSpace":"\u205F\u200A","ThinSpace":"\u2009","thinsp":"\u2009","thkap":"\u2248","thksim":"\u223C","THORN":"\u00DE","thorn":"\u00FE","tilde":"\u02DC","Tilde":"\u223C","TildeEqual":"\u2243","TildeFullEqual":"\u2245","TildeTilde":"\u2248","timesbar":"\u2A31","timesb":"\u22A0","times":"\u00D7","timesd":"\u2A30","tint":"\u222D","toea":"\u2928","topbot":"\u2336","topcir":"\u2AF1","top":"\u22A4","Topf":"\uD835\uDD4B","topf":"\uD835\uDD65","topfork":"\u2ADA","tosa":"\u2929","tprime":"\u2034","trade":"\u2122","TRADE":"\u2122","triangle":"\u25B5","triangledown":"\u25BF","triangleleft":"\u25C3","trianglelefteq":"\u22B4","triangleq":"\u225C","triangleright":"\u25B9","trianglerighteq":"\u22B5","tridot":"\u25EC","trie":"\u225C","triminus":"\u2A3A","TripleDot":"\u20DB","triplus":"\u2A39","trisb":"\u29CD","tritime":"\u2A3B","trpezium":"\u23E2","Tscr":"\uD835\uDCAF","tscr":"\uD835\uDCC9","TScy":"\u0426","tscy":"\u0446","TSHcy":"\u040B","tshcy":"\u045B","Tstrok":"\u0166","tstrok":"\u0167","twixt":"\u226C","twoheadleftarrow":"\u219E","twoheadrightarrow":"\u21A0","Uacute":"\u00DA","uacute":"\u00FA","uarr":"\u2191","Uarr":"\u219F","uArr":"\u21D1","Uarrocir":"\u2949","Ubrcy":"\u040E","ubrcy":"\u045E","Ubreve":"\u016C","ubreve":"\u016D","Ucirc":"\u00DB","ucirc":"\u00FB","Ucy":"\u0423","ucy":"\u0443","udarr":"\u21C5","Udblac":"\u0170","udblac":"\u0171","udhar":"\u296E","ufisht":"\u297E","Ufr":"\uD835\uDD18","ufr":"\uD835\uDD32","Ugrave":"\u00D9","ugrave":"\u00F9","uHar":"\u2963","uharl":"\u21BF","uharr":"\u21BE","uhblk":"\u2580","ulcorn":"\u231C","ulcorner":"\u231C","ulcrop":"\u230F","ultri":"\u25F8","Umacr":"\u016A","umacr":"\u016B","uml":"\u00A8","UnderBar":"_","UnderBrace":"\u23DF","UnderBracket":"\u23B5","UnderParenthesis":"\u23DD","Union":"\u22C3","UnionPlus":"\u228E","Uogon":"\u0172","uogon":"\u0173","Uopf":"\uD835\uDD4C","uopf":"\uD835\uDD66","UpArrowBar":"\u2912","uparrow":"\u2191","UpArrow":"\u2191","Uparrow":"\u21D1","UpArrowDownArrow":"\u21C5","updownarrow":"\u2195","UpDownArrow":"\u2195","Updownarrow":"\u21D5","UpEquilibrium":"\u296E","upharpoonleft":"\u21BF","upharpoonright":"\u21BE","uplus":"\u228E","UpperLeftArrow":"\u2196","UpperRightArrow":"\u2197","upsi":"\u03C5","Upsi":"\u03D2","upsih":"\u03D2","Upsilon":"\u03A5","upsilon":"\u03C5","UpTeeArrow":"\u21A5","UpTee":"\u22A5","upuparrows":"\u21C8","urcorn":"\u231D","urcorner":"\u231D","urcrop":"\u230E","Uring":"\u016E","uring":"\u016F","urtri":"\u25F9","Uscr":"\uD835\uDCB0","uscr":"\uD835\uDCCA","utdot":"\u22F0","Utilde":"\u0168","utilde":"\u0169","utri":"\u25B5","utrif":"\u25B4","uuarr":"\u21C8","Uuml":"\u00DC","uuml":"\u00FC","uwangle":"\u29A7","vangrt":"\u299C","varepsilon":"\u03F5","varkappa":"\u03F0","varnothing":"\u2205","varphi":"\u03D5","varpi":"\u03D6","varpropto":"\u221D","varr":"\u2195","vArr":"\u21D5","varrho":"\u03F1","varsigma":"\u03C2","varsubsetneq":"\u228A\uFE00","varsubsetneqq":"\u2ACB\uFE00","varsupsetneq":"\u228B\uFE00","varsupsetneqq":"\u2ACC\uFE00","vartheta":"\u03D1","vartriangleleft":"\u22B2","vartriangleright":"\u22B3","vBar":"\u2AE8","Vbar":"\u2AEB","vBarv":"\u2AE9","Vcy":"\u0412","vcy":"\u0432","vdash":"\u22A2","vDash":"\u22A8","Vdash":"\u22A9","VDash":"\u22AB","Vdashl":"\u2AE6","veebar":"\u22BB","vee":"\u2228","Vee":"\u22C1","veeeq":"\u225A","vellip":"\u22EE","verbar":"|","Verbar":"\u2016","vert":"|","Vert":"\u2016","VerticalBar":"\u2223","VerticalLine":"|","VerticalSeparator":"\u2758","VerticalTilde":"\u2240","VeryThinSpace":"\u200A","Vfr":"\uD835\uDD19","vfr":"\uD835\uDD33","vltri":"\u22B2","vnsub":"\u2282\u20D2","vnsup":"\u2283\u20D2","Vopf":"\uD835\uDD4D","vopf":"\uD835\uDD67","vprop":"\u221D","vrtri":"\u22B3","Vscr":"\uD835\uDCB1","vscr":"\uD835\uDCCB","vsubnE":"\u2ACB\uFE00","vsubne":"\u228A\uFE00","vsupnE":"\u2ACC\uFE00","vsupne":"\u228B\uFE00","Vvdash":"\u22AA","vzigzag":"\u299A","Wcirc":"\u0174","wcirc":"\u0175","wedbar":"\u2A5F","wedge":"\u2227","Wedge":"\u22C0","wedgeq":"\u2259","weierp":"\u2118","Wfr":"\uD835\uDD1A","wfr":"\uD835\uDD34","Wopf":"\uD835\uDD4E","wopf":"\uD835\uDD68","wp":"\u2118","wr":"\u2240","wreath":"\u2240","Wscr":"\uD835\uDCB2","wscr":"\uD835\uDCCC","xcap":"\u22C2","xcirc":"\u25EF","xcup":"\u22C3","xdtri":"\u25BD","Xfr":"\uD835\uDD1B","xfr":"\uD835\uDD35","xharr":"\u27F7","xhArr":"\u27FA","Xi":"\u039E","xi":"\u03BE","xlarr":"\u27F5","xlArr":"\u27F8","xmap":"\u27FC","xnis":"\u22FB","xodot":"\u2A00","Xopf":"\uD835\uDD4F","xopf":"\uD835\uDD69","xoplus":"\u2A01","xotime":"\u2A02","xrarr":"\u27F6","xrArr":"\u27F9","Xscr":"\uD835\uDCB3","xscr":"\uD835\uDCCD","xsqcup":"\u2A06","xuplus":"\u2A04","xutri":"\u25B3","xvee":"\u22C1","xwedge":"\u22C0","Yacute":"\u00DD","yacute":"\u00FD","YAcy":"\u042F","yacy":"\u044F","Ycirc":"\u0176","ycirc":"\u0177","Ycy":"\u042B","ycy":"\u044B","yen":"\u00A5","Yfr":"\uD835\uDD1C","yfr":"\uD835\uDD36","YIcy":"\u0407","yicy":"\u0457","Yopf":"\uD835\uDD50","yopf":"\uD835\uDD6A","Yscr":"\uD835\uDCB4","yscr":"\uD835\uDCCE","YUcy":"\u042E","yucy":"\u044E","yuml":"\u00FF","Yuml":"\u0178","Zacute":"\u0179","zacute":"\u017A","Zcaron":"\u017D","zcaron":"\u017E","Zcy":"\u0417","zcy":"\u0437","Zdot":"\u017B","zdot":"\u017C","zeetrf":"\u2128","ZeroWidthSpace":"\u200B","Zeta":"\u0396","zeta":"\u03B6","zfr":"\uD835\uDD37","Zfr":"\u2128","ZHcy":"\u0416","zhcy":"\u0436","zigrarr":"\u21DD","zopf":"\uD835\uDD6B","Zopf":"\u2124","Zscr":"\uD835\uDCB5","zscr":"\uD835\uDCCF","zwj":"\u200D","zwnj":"\u200C"} 3097 | },{}],17:[function(require,module,exports){ 3098 | module.exports={"Aacute":"\u00C1","aacute":"\u00E1","Acirc":"\u00C2","acirc":"\u00E2","acute":"\u00B4","AElig":"\u00C6","aelig":"\u00E6","Agrave":"\u00C0","agrave":"\u00E0","amp":"&","AMP":"&","Aring":"\u00C5","aring":"\u00E5","Atilde":"\u00C3","atilde":"\u00E3","Auml":"\u00C4","auml":"\u00E4","brvbar":"\u00A6","Ccedil":"\u00C7","ccedil":"\u00E7","cedil":"\u00B8","cent":"\u00A2","copy":"\u00A9","COPY":"\u00A9","curren":"\u00A4","deg":"\u00B0","divide":"\u00F7","Eacute":"\u00C9","eacute":"\u00E9","Ecirc":"\u00CA","ecirc":"\u00EA","Egrave":"\u00C8","egrave":"\u00E8","ETH":"\u00D0","eth":"\u00F0","Euml":"\u00CB","euml":"\u00EB","frac12":"\u00BD","frac14":"\u00BC","frac34":"\u00BE","gt":">","GT":">","Iacute":"\u00CD","iacute":"\u00ED","Icirc":"\u00CE","icirc":"\u00EE","iexcl":"\u00A1","Igrave":"\u00CC","igrave":"\u00EC","iquest":"\u00BF","Iuml":"\u00CF","iuml":"\u00EF","laquo":"\u00AB","lt":"<","LT":"<","macr":"\u00AF","micro":"\u00B5","middot":"\u00B7","nbsp":"\u00A0","not":"\u00AC","Ntilde":"\u00D1","ntilde":"\u00F1","Oacute":"\u00D3","oacute":"\u00F3","Ocirc":"\u00D4","ocirc":"\u00F4","Ograve":"\u00D2","ograve":"\u00F2","ordf":"\u00AA","ordm":"\u00BA","Oslash":"\u00D8","oslash":"\u00F8","Otilde":"\u00D5","otilde":"\u00F5","Ouml":"\u00D6","ouml":"\u00F6","para":"\u00B6","plusmn":"\u00B1","pound":"\u00A3","quot":"\"","QUOT":"\"","raquo":"\u00BB","reg":"\u00AE","REG":"\u00AE","sect":"\u00A7","shy":"\u00AD","sup1":"\u00B9","sup2":"\u00B2","sup3":"\u00B3","szlig":"\u00DF","THORN":"\u00DE","thorn":"\u00FE","times":"\u00D7","Uacute":"\u00DA","uacute":"\u00FA","Ucirc":"\u00DB","ucirc":"\u00FB","Ugrave":"\u00D9","ugrave":"\u00F9","uml":"\u00A8","Uuml":"\u00DC","uuml":"\u00FC","Yacute":"\u00DD","yacute":"\u00FD","yen":"\u00A5","yuml":"\u00FF"} 3099 | },{}],18:[function(require,module,exports){ 3100 | module.exports={"amp":"&","apos":"'","gt":">","lt":"<","quot":"\""} 3101 | 3102 | },{}],19:[function(require,module,exports){ 3103 | 3104 | 'use strict'; 3105 | 3106 | 3107 | /* eslint-disable no-bitwise */ 3108 | 3109 | var decodeCache = {}; 3110 | 3111 | function getDecodeCache(exclude) { 3112 | var i, ch, cache = decodeCache[exclude]; 3113 | if (cache) { return cache; } 3114 | 3115 | cache = decodeCache[exclude] = []; 3116 | 3117 | for (i = 0; i < 128; i++) { 3118 | ch = String.fromCharCode(i); 3119 | cache.push(ch); 3120 | } 3121 | 3122 | for (i = 0; i < exclude.length; i++) { 3123 | ch = exclude.charCodeAt(i); 3124 | cache[ch] = '%' + ('0' + ch.toString(16).toUpperCase()).slice(-2); 3125 | } 3126 | 3127 | return cache; 3128 | } 3129 | 3130 | 3131 | // Decode percent-encoded string. 3132 | // 3133 | function decode(string, exclude) { 3134 | var cache; 3135 | 3136 | if (typeof exclude !== 'string') { 3137 | exclude = decode.defaultChars; 3138 | } 3139 | 3140 | cache = getDecodeCache(exclude); 3141 | 3142 | return string.replace(/(%[a-f0-9]{2})+/gi, function(seq) { 3143 | var i, l, b1, b2, b3, b4, chr, 3144 | result = ''; 3145 | 3146 | for (i = 0, l = seq.length; i < l; i += 3) { 3147 | b1 = parseInt(seq.slice(i + 1, i + 3), 16); 3148 | 3149 | if (b1 < 0x80) { 3150 | result += cache[b1]; 3151 | continue; 3152 | } 3153 | 3154 | if ((b1 & 0xE0) === 0xC0 && (i + 3 < l)) { 3155 | // 110xxxxx 10xxxxxx 3156 | b2 = parseInt(seq.slice(i + 4, i + 6), 16); 3157 | 3158 | if ((b2 & 0xC0) === 0x80) { 3159 | chr = ((b1 << 6) & 0x7C0) | (b2 & 0x3F); 3160 | 3161 | if (chr < 0x80) { 3162 | result += '\ufffd\ufffd'; 3163 | } else { 3164 | result += String.fromCharCode(chr); 3165 | } 3166 | 3167 | i += 3; 3168 | continue; 3169 | } 3170 | } 3171 | 3172 | if ((b1 & 0xF0) === 0xE0 && (i + 6 < l)) { 3173 | // 1110xxxx 10xxxxxx 10xxxxxx 3174 | b2 = parseInt(seq.slice(i + 4, i + 6), 16); 3175 | b3 = parseInt(seq.slice(i + 7, i + 9), 16); 3176 | 3177 | if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) { 3178 | chr = ((b1 << 12) & 0xF000) | ((b2 << 6) & 0xFC0) | (b3 & 0x3F); 3179 | 3180 | if (chr < 0x800 || (chr >= 0xD800 && chr <= 0xDFFF)) { 3181 | result += '\ufffd\ufffd\ufffd'; 3182 | } else { 3183 | result += String.fromCharCode(chr); 3184 | } 3185 | 3186 | i += 6; 3187 | continue; 3188 | } 3189 | } 3190 | 3191 | if ((b1 & 0xF8) === 0xF0 && (i + 9 < l)) { 3192 | // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 3193 | b2 = parseInt(seq.slice(i + 4, i + 6), 16); 3194 | b3 = parseInt(seq.slice(i + 7, i + 9), 16); 3195 | b4 = parseInt(seq.slice(i + 10, i + 12), 16); 3196 | 3197 | if ((b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80 && (b4 & 0xC0) === 0x80) { 3198 | chr = ((b1 << 18) & 0x1C0000) | ((b2 << 12) & 0x3F000) | ((b3 << 6) & 0xFC0) | (b4 & 0x3F); 3199 | 3200 | if (chr < 0x10000 || chr > 0x10FFFF) { 3201 | result += '\ufffd\ufffd\ufffd\ufffd'; 3202 | } else { 3203 | chr -= 0x10000; 3204 | result += String.fromCharCode(0xD800 + (chr >> 10), 0xDC00 + (chr & 0x3FF)); 3205 | } 3206 | 3207 | i += 9; 3208 | continue; 3209 | } 3210 | } 3211 | 3212 | result += '\ufffd'; 3213 | } 3214 | 3215 | return result; 3216 | }); 3217 | } 3218 | 3219 | 3220 | decode.defaultChars = ';/?:@&=+$,#'; 3221 | decode.componentChars = ''; 3222 | 3223 | 3224 | module.exports = decode; 3225 | 3226 | },{}],20:[function(require,module,exports){ 3227 | 3228 | 'use strict'; 3229 | 3230 | 3231 | var encodeCache = {}; 3232 | 3233 | 3234 | // Create a lookup array where anything but characters in `chars` string 3235 | // and alphanumeric chars is percent-encoded. 3236 | // 3237 | function getEncodeCache(exclude) { 3238 | var i, ch, cache = encodeCache[exclude]; 3239 | if (cache) { return cache; } 3240 | 3241 | cache = encodeCache[exclude] = []; 3242 | 3243 | for (i = 0; i < 128; i++) { 3244 | ch = String.fromCharCode(i); 3245 | 3246 | if (/^[0-9a-z]$/i.test(ch)) { 3247 | // always allow unencoded alphanumeric characters 3248 | cache.push(ch); 3249 | } else { 3250 | cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2)); 3251 | } 3252 | } 3253 | 3254 | for (i = 0; i < exclude.length; i++) { 3255 | cache[exclude.charCodeAt(i)] = exclude[i]; 3256 | } 3257 | 3258 | return cache; 3259 | } 3260 | 3261 | 3262 | // Encode unsafe characters with percent-encoding, skipping already 3263 | // encoded sequences. 3264 | // 3265 | // - string - string to encode 3266 | // - exclude - list of characters to ignore (in addition to a-zA-Z0-9) 3267 | // - keepEscaped - don't encode '%' in a correct escape sequence (default: true) 3268 | // 3269 | function encode(string, exclude, keepEscaped) { 3270 | var i, l, code, nextCode, cache, 3271 | result = ''; 3272 | 3273 | if (typeof exclude !== 'string') { 3274 | // encode(string, keepEscaped) 3275 | keepEscaped = exclude; 3276 | exclude = encode.defaultChars; 3277 | } 3278 | 3279 | if (typeof keepEscaped === 'undefined') { 3280 | keepEscaped = true; 3281 | } 3282 | 3283 | cache = getEncodeCache(exclude); 3284 | 3285 | for (i = 0, l = string.length; i < l; i++) { 3286 | code = string.charCodeAt(i); 3287 | 3288 | if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) { 3289 | if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) { 3290 | result += string.slice(i, i + 3); 3291 | i += 2; 3292 | continue; 3293 | } 3294 | } 3295 | 3296 | if (code < 128) { 3297 | result += cache[code]; 3298 | continue; 3299 | } 3300 | 3301 | if (code >= 0xD800 && code <= 0xDFFF) { 3302 | if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) { 3303 | nextCode = string.charCodeAt(i + 1); 3304 | if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) { 3305 | result += encodeURIComponent(string[i] + string[i + 1]); 3306 | i++; 3307 | continue; 3308 | } 3309 | } 3310 | result += '%EF%BF%BD'; 3311 | continue; 3312 | } 3313 | 3314 | result += encodeURIComponent(string[i]); 3315 | } 3316 | 3317 | return result; 3318 | } 3319 | 3320 | encode.defaultChars = ";/?:@&=+$,-_.!~*'()#"; 3321 | encode.componentChars = "-_.!~*'()"; 3322 | 3323 | 3324 | module.exports = encode; 3325 | 3326 | },{}],21:[function(require,module,exports){ 3327 | /*! http://mths.be/repeat v0.2.0 by @mathias */ 3328 | if (!String.prototype.repeat) { 3329 | (function() { 3330 | 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` 3331 | var defineProperty = (function() { 3332 | // IE 8 only supports `Object.defineProperty` on DOM elements 3333 | try { 3334 | var object = {}; 3335 | var $defineProperty = Object.defineProperty; 3336 | var result = $defineProperty(object, object, object) && $defineProperty; 3337 | } catch(error) {} 3338 | return result; 3339 | }()); 3340 | var repeat = function(count) { 3341 | if (this == null) { 3342 | throw TypeError(); 3343 | } 3344 | var string = String(this); 3345 | // `ToInteger` 3346 | var n = count ? Number(count) : 0; 3347 | if (n != n) { // better `isNaN` 3348 | n = 0; 3349 | } 3350 | // Account for out-of-bounds indices 3351 | if (n < 0 || n == Infinity) { 3352 | throw RangeError(); 3353 | } 3354 | var result = ''; 3355 | while (n) { 3356 | if (n % 2 == 1) { 3357 | result += string; 3358 | } 3359 | if (n > 1) { 3360 | string += string; 3361 | } 3362 | n >>= 1; 3363 | } 3364 | return result; 3365 | }; 3366 | if (defineProperty) { 3367 | defineProperty(String.prototype, 'repeat', { 3368 | 'value': repeat, 3369 | 'configurable': true, 3370 | 'writable': true 3371 | }); 3372 | } else { 3373 | String.prototype.repeat = repeat; 3374 | } 3375 | }()); 3376 | } 3377 | 3378 | },{}]},{},[4])(4) 3379 | }); -------------------------------------------------------------------------------- /fun-snippets/examples/blur-focus.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Layers finished updating 7 | 36 | 37 | 38 | 39 | 40 | 69 | 70 | 71 | 72 |
73 |
74 | Hello! I'm a message that will disappear as soon as the view loaded. 75 |
76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /fun-snippets/examples/create-a-tour.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Create a tour 9 | 10 | 11 | 30 | 31 | 83 | 84 | 85 | 86 |
87 |
88 |
89 |

Places I've lived in 🏘️

90 |

91 |
92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /fun-snippets/examples/fade-in-out-layers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Fade out layers 7 | 21 | 22 | 23 | 24 | 25 | 192 | 193 | 194 | 195 |
196 | 197 | 198 | 199 | 200 | 201 | -------------------------------------------------------------------------------- /fun-snippets/examples/have-a-look-around.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Look around 9 | 10 | 11 | 21 | 22 | 85 | 86 | 87 | 88 |
89 |
90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /fun-snippets/examples/print-camera.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Pretty print camera 8 | 18 | 19 | 20 | 21 | 22 | 93 | 94 | 95 | 96 |
97 |
98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /fun-snippets/examples/rotate-the-globe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Rotating the globe 7 | 17 | 18 | 19 | 20 | 59 | 60 | 61 | 62 |
63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /fun-snippets/examples/switch-2d-3d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Switch between 2D and 3D 8 | 9 | 10 | 11 | 12 | 50 | 133 | 134 | 135 | 136 |
137 |
138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /fun-snippets/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ArcGIS API for JavaScript - fun 3D code snippets 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 |

ArcGIS API for JavaScript - fun 3D code snippets

19 |

Collection of code snippets for 3D apps using ArcGIS API for JavaScript. 20 | Check out the code on Github. 21 | If you have some cool code snippet that takes your 3D app to the next level, open up a PR or add it to the issues.

22 |
23 |
24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /fun-snippets/script.js: -------------------------------------------------------------------------------- 1 | 2 | fetch('./snippets.md') 3 | .then(function(response) { 4 | return response.text(); 5 | }) 6 | .then(function(snippets) { 7 | const reader = new commonmark.Parser({smart: true}); 8 | const parsed = reader.parse(snippets); 9 | walker = parsed.walker(); 10 | 11 | const container = document.getElementsByClassName("container")[0]; 12 | 13 | const snippetList = []; 14 | let snippet = {}; 15 | 16 | while ((event = walker.next())) { 17 | node = event.node; 18 | if (event.entering) { 19 | 20 | if (node.type === "thematic_break") { 21 | snippetList.push(snippet); 22 | snippet = {}; 23 | } 24 | 25 | if (node.type === "heading") { 26 | node = walker.next().node; 27 | if (node.type === "text") { 28 | snippet.heading = node.literal; 29 | } 30 | } 31 | 32 | if (node.type === "paragraph") { 33 | node = walker.next().node; 34 | snippet.description = ""; 35 | while (node.type === "text") { 36 | snippet.description += node.literal; 37 | node = walker.next().node; 38 | } 39 | } 40 | 41 | if (node.type === "link") { 42 | snippet.demo = { 43 | url: node.destination 44 | } 45 | node = walker.next().node; 46 | snippet.demo.text = ""; 47 | while (node.type === "text") { 48 | snippet.demo.text += node.literal; 49 | node = walker.next().node; 50 | } 51 | } 52 | 53 | if (node.type === "code_block") { 54 | snippet.code = node.literal; 55 | } 56 | 57 | } 58 | } 59 | 60 | snippetList.forEach(function(item) { 61 | const template = ` 62 |
63 | ${item.heading} 64 |
65 |

${item.description}

66 |

67 |             ${item.code}
68 |           
69 | ${(demo => { 70 | if(demo) 71 | return `${item.demo.text}`; 72 | else 73 | return ""; 74 | })(item.demo)} 75 |
76 |
77 | `; 78 | 79 | const htmlElement = document.createElement("div"); 80 | htmlElement.innerHTML = template; 81 | container.appendChild(htmlElement); 82 | const block = htmlElement.getElementsByTagName("code")[0]; 83 | hljs.highlightBlock(block); 84 | }); 85 | }); 86 | -------------------------------------------------------------------------------- /fun-snippets/snippet-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RalucaNicola/code-snippets-arcgis-api-js/aafe3c608a80ce42dbec9f074a9a30edc9af0a42/fun-snippets/snippet-page.png -------------------------------------------------------------------------------- /fun-snippets/snippets.md: -------------------------------------------------------------------------------- 1 | ### 🌎 Rotate the globe 2 | 3 | Showing world wide data on a globe is cool. But showing it on a globe that rotates is even cooler. With this code snippet the globe rotates until the user interacts with it. [Spin me right round](rotate-the-globe.html) 4 | 5 | ```js 6 | 7 | function rotate() { 8 | if (!view.interacting) { 9 | const camera = view.camera.clone(); 10 | camera.position.longitude -= 0.2; 11 | view.goTo(camera, { animate: false }); 12 | requestAnimationFrame(rotate); 13 | } 14 | } 15 | ``` 16 | 17 | --- 18 | 19 | ### 👀 Look around 20 | 21 | The one where the camera turns around to see what's behind it. Seriously now, with this code the camera rotates around its position (until the user interacts with the view). [Let's have a look around](have-a-look-around.html) 22 | 23 | ```js 24 | 25 | function lookAround() { 26 | if (!view.interacting) { 27 | const camera = view.camera.clone(); 28 | camera.heading += 0.05; 29 | view.goTo(camera, { animate: false }); 30 | requestAnimationFrame(lookAround); 31 | } 32 | } 33 | 34 | ``` 35 | 36 | --- 37 | 38 | ### ✈️ Create a tour from a set of points 39 | 40 | Animate the camera between slides, (view)points or features. [Take me on a tour](create-a-tour.html) 41 | 42 | ```js 43 | 44 | function startAnimation(slideNo) { 45 | if (slideNo < webscene.presentation.slides.length) { 46 | 47 | const slide = webscene.presentation.slides.getItemAt(slideNo); 48 | document.getElementById("description").innerHTML = slide.title.text; 49 | 50 | view.goTo(slide.viewpoint, {duration: 3000}) 51 | .then(function(){ 52 | 53 | window.setTimeout(function(){ 54 | startAnimation(slideNo + 1); 55 | }, 5000) 56 | }) 57 | .otherwise(function(err){ 58 | console.log(err); 59 | }); 60 | } 61 | } 62 | 63 | window.setTimeout(function(){ 64 | startAnimation(0); 65 | }, 5000); 66 | ``` 67 | 68 | --- 69 | 70 | ### Fade in/out effect on layers 71 | 72 | Code snippet to be used in those moments when fading layers in or out would be so awesome. [Fade layers in and out](fade-in-out-layers.html) 73 | 74 | ```js 75 | 76 | function fadeIn(layer) { 77 | const opacity = parseFloat((layer.opacity + 0.05).toFixed(2)); 78 | layer.opacity = opacity; 79 | if (layer.opacity < 1) { 80 | window.requestAnimationFrame(function () { 81 | fadeIn(layer); 82 | }); 83 | } 84 | } 85 | 86 | function fadeOut(layer) { 87 | const opacity = parseFloat((layer.opacity - 0.05).toFixed(2)); 88 | layer.opacity = opacity; 89 | if (layer.opacity > 0) { 90 | window.requestAnimationFrame(function () { 91 | fadeOut(layer); 92 | }); 93 | } 94 | } 95 | ``` 96 | 97 | --- 98 | 99 | ### Focus view after it loaded 100 | 101 | This effect is about dislaying a blurry view until it finishes updating. Once all the data is displayed, the view gets focused. [Focus on view](blur-focus.html) 102 | 103 | ```js 104 | 105 | const webscene = new WebScene({ 106 | portalItem: { 107 | id: "0614ea1f9dd043e9ba157b9c20d3c538" 108 | } 109 | }); 110 | 111 | const view = new SceneView({ 112 | container: "viewDiv", 113 | map: webscene 114 | }); 115 | 116 | view.when(function() { 117 | watchUtils.whenFalseOnce(view, "updating", function() { 118 | view.container.style.filter = "blur(0px)"; 119 | }); 120 | }); 121 | 122 | // Idea from Jesse van den Kieboom 123 | ``` 124 | 125 | --- 126 | 127 | ### Switch between 2D and 3D 128 | 129 | For those special moments when you have a 2D map and a 3D scene and you want to switch between them. [Switch between 2D and 3D](switch-2d-3d.html) 130 | 131 | ```js 132 | 133 | const webmap = new WebMap({ 134 | portalItem: { 135 | id: "7ee3c8a93f254753a83ac0195757f137" 136 | } 137 | }); 138 | 139 | const webscene = new WebScene({ 140 | portalItem: { 141 | id: "c8cf26d7acab4e45afcd5e20080983c1" 142 | } 143 | }); 144 | 145 | const mapView = new MapView({ 146 | container: "mapViewDiv", 147 | map: webmap 148 | }); 149 | 150 | const sceneView = new SceneView({ 151 | container: "sceneViewDiv", 152 | map: webscene 153 | }); 154 | 155 | let is2D = true; 156 | 157 | // button that switches between 2D and 3D views 158 | const switchButton = document.getElementById("switch-view"); 159 | switchButton.addEventListener("click", function () { 160 | is2D = !is2D; 161 | switchButton.innerHTML = is2D ? "Switch to 3D" : "Switch to 2D"; 162 | switchView(); 163 | }); 164 | 165 | function switchView() { 166 | const newView = is2D ? mapView : sceneView; 167 | const oldView = is2D ? sceneView : mapView; 168 | 169 | newView.extent = oldView.extent; 170 | 171 | if (newView === sceneView) { 172 | newView.goTo({ 173 | rotation: oldView.rotation, 174 | tilt: 0 175 | }, { animate: false }) 176 | .then(function() { 177 | animateOpacity(newView, oldView); 178 | newView.goTo({ 179 | tilt: 60 180 | }, {speedFactor: 0.3}); 181 | }); 182 | } else { 183 | oldView.goTo({ 184 | tilt: 0 185 | }) 186 | .then(function() { 187 | animateOpacity(newView, oldView); 188 | newView.rotation = 360 - oldView.camera.heading; 189 | }); 190 | } 191 | } 192 | 193 | function animateOpacity(newView, oldView) { 194 | newView.container.classList.remove("switch-off"); 195 | newView.container.classList.add("switch-on"); 196 | 197 | oldView.container.classList.remove("switch-on"); 198 | oldView.container.classList.add("switch-off"); 199 | } 200 | 201 | // Idea from Jesse van den Kieboom 202 | ``` 203 | 204 | --- 205 | -------------------------------------------------------------------------------- /fun-snippets/style.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | height: 100%; 3 | font-family: 'Share Tech Mono', monospace; 4 | } 5 | 6 | header>h1 { 7 | padding: 0.5em; 8 | border: 10px solid pink; 9 | border-left: none; 10 | display: inline-block; 11 | color: #777; 12 | } 13 | 14 | .container { 15 | display: flex; 16 | flex-wrap: wrap; 17 | } 18 | 19 | .snippet .snippet-title { 20 | border-bottom: 10px solid #bbadf7; 21 | font-size: 1.4em; 22 | } 23 | 24 | .snippet { 25 | margin: 3.5em 0; 26 | max-width: 600px; 27 | } 28 | 29 | .snippet a, .demo-button { 30 | text-decoration: none; 31 | color: black; 32 | border: 3px solid #bbadf7; 33 | padding: 6px; 34 | background-color: #e7e3fc; 35 | } 36 | 37 | .snippet a:hover { 38 | background-color: #d4cdf4; 39 | } 40 | 41 | .snippet-main>p { 42 | margin: 2em; 43 | margin-bottom: 0; 44 | } 45 | 46 | .snippet pre { 47 | margin: 0; 48 | } 49 | 50 | .snippet code { 51 | padding: 0; 52 | } 53 | 54 | .hljs { 55 | background: transparent; 56 | } 57 | 58 | header a { 59 | color: #f44283; 60 | font-weight: bold; 61 | text-decoration: none; 62 | } 63 | 64 | header a:hover { 65 | color: pink; 66 | } 67 | 68 | footer { 69 | 70 | padding-bottom: 1em; 71 | font-size: 0.9em; 72 | } 73 | 74 | .console { 75 | background-color: rgba(0, 0, 0, 0.8); 76 | color: white; 77 | font-family: 'Share Tech Mono', monospace; 78 | padding: 0.5em; 79 | } 80 | --------------------------------------------------------------------------------