{"version":3,"file":"europa.min.js","sources":["../node_modules/nevis/src/extend.js","../node_modules/nevis/src/nevis.js","../node_modules/europa-core/src/util/Utilities.js","../node_modules/europa-core/src/Conversion.js","../node_modules/europa-core/src/util/DOMUtilities.js","../node_modules/europa-core/src/option/Option.js","../node_modules/europa-core/src/option/OptionParser.js","../node_modules/europa-core/src/plugin/Plugin.js","../node_modules/europa-core/src/Europa.js","../node_modules/europa-core/src/service/ServiceManager.js","../node_modules/europa-core/src/plugin/predefined/AnchorPlugin.js","../node_modules/europa-core/src/plugin/predefined/BlockQuotePlugin.js","../node_modules/europa-core/src/plugin/predefined/BreakPlugin.js","../node_modules/europa-core/src/plugin/predefined/CodePlugin.js","../node_modules/europa-core/src/plugin/predefined/DefinitionTermPlugin.js","../node_modules/europa-core/src/plugin/predefined/DetailsPlugin.js","../node_modules/europa-core/src/plugin/predefined/EmphasisPlugin.js","../node_modules/europa-core/src/plugin/predefined/EmptyPlugin.js","../node_modules/europa-core/src/plugin/predefined/FramePlugin.js","../node_modules/europa-core/src/plugin/predefined/HeadingPlugin.js","../node_modules/europa-core/src/plugin/predefined/HorizontalRulePlugin.js","../node_modules/europa-core/src/plugin/predefined/ImagePlugin.js","../node_modules/europa-core/src/plugin/predefined/ListItemPlugin.js","../node_modules/europa-core/src/plugin/predefined/OrderedListPlugin.js","../node_modules/europa-core/src/plugin/predefined/ParagraphPlugin.js","../node_modules/europa-core/src/plugin/predefined/PreformattedPlugin.js","../node_modules/europa-core/src/plugin/predefined/QuotePlugin.js","../node_modules/europa-core/src/plugin/predefined/StrongPlugin.js","../node_modules/europa-core/src/plugin/predefined/UnorderedListPlugin.js","../node_modules/europa-core/index.js","../node_modules/europa-core/src/service/Service.js","../node_modules/europa-core/src/service/window/WindowService.js","../src/service/window/BrowserWindowService.js","../src/Europa.js"],"sourcesContent":["/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\n/**\n * A bare-bones constructor for surrogate prototype swapping.\n *\n * @private\n * @constructor\n */\nvar Constructor = /* istanbul ignore next */ function() {};\n/**\n * A reference to Object.prototype.hasOwnProperty
.\n *\n * @private\n * @type {Function}\n */\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * A reference to Array.prototype.slice
.\n *\n * @private\n * @type {Function}\n */\nvar slice = Array.prototype.slice;\n\n/**\n * Creates an object which inherits the given prototype
.\n *\n * Optionally, the created object can be extended further with the specified properties
.\n *\n * @param {Object} prototype - the prototype to be inherited by the created object\n * @param {Object} [properties] - the optional properties to be extended by the created object\n * @return {Object} The newly created object.\n * @private\n */\nfunction createObject(prototype, properties) {\n var result;\n /* istanbul ignore next */\n if (typeof Object.create === 'function') {\n result = Object.create(prototype);\n } else {\n Constructor.prototype = prototype;\n result = new Constructor();\n Constructor.prototype = null;\n }\n\n if (properties) {\n extendObject(true, result, properties);\n }\n\n return result;\n}\n\n/**\n * Extends the constructor to which this method is associated with the prototype
and/or\n * statics
provided.\n *\n * If name
is provided, it will be used as the class name and can be accessed via a special\n * class_
property on the child constructor, otherwise the class name of the super constructor will be used\n * instead. The class name may also be used string representation for instances of the child constructor (via\n * toString
), but this is not applicable to the lite version of Nevis.\n *\n * If constructor
is provided, it will be used as the constructor for the child, otherwise a simple\n * constructor which only calls the super constructor will be used instead.\n *\n * The super constructor can be accessed via a special super_
property on the child constructor.\n *\n * @param {string} [name=this.class_] - the class name to be used for the child constructor\n * @param {Function} [constructor] - the constructor for the child\n * @param {Object} [prototype] - the prototype properties to be defined for the child\n * @param {Object} [statics] - the static properties to be defined for the child\n * @return {Function} The child constructor
provided or the one created if none was given.\n * @public\n */\nfunction extend(name, constructor, prototype, statics) {\n var superConstructor = this;\n\n if (typeof name !== 'string') {\n statics = prototype;\n prototype = constructor;\n constructor = name;\n name = null;\n }\n\n if (typeof constructor !== 'function') {\n statics = prototype;\n prototype = constructor;\n constructor = function() {\n return superConstructor.apply(this, arguments);\n };\n }\n\n extendObject(false, constructor, superConstructor, statics);\n\n constructor.prototype = createObject(superConstructor.prototype, prototype);\n constructor.prototype.constructor = constructor;\n\n constructor.class_ = name || superConstructor.class_;\n constructor.super_ = superConstructor;\n\n return constructor;\n}\n\n/**\n * Extends the specified target
object with the properties in each of the sources
provided.\n *\n * if any source is null
it will be ignored.\n *\n * @param {boolean} own - true
to only copy own properties from sources
onto\n * target
; otherwise false
\n * @param {Object} target - the target object which should be extended\n * @param {...Object} [sources] - the source objects whose properties are to be copied onto target
\n * @return {void}\n * @private\n */\nfunction extendObject(own, target, sources) {\n sources = slice.call(arguments, 2);\n\n var property;\n var source;\n\n for (var i = 0, length = sources.length; i < length; i++) {\n source = sources[i];\n\n for (property in source) {\n if (!own || hasOwnProperty.call(source, property)) {\n target[property] = source[property];\n }\n }\n }\n}\n\nmodule.exports = extend;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar extend = require('./extend');\n\n/**\n * The base class from which all others should extend.\n *\n * @public\n * @constructor\n */\nfunction Nevis() {}\nNevis.class_ = 'Nevis';\nNevis.super_ = Object;\n\n/**\n * Extends the constructor to which this method is associated with the prototype
and/or\n * statics
provided.\n *\n * If name
is provided, it will be used as the class name and can be accessed via a special\n * class_
property on the child constructor, otherwise the class name of the super constructor will be used\n * instead. The class name may also be used string representation for instances of the child constructor (via\n * toString
), but this is not applicable to the lite version of Nevis.\n *\n * If constructor
is provided, it will be used as the constructor for the child, otherwise a simple\n * constructor which only calls the super constructor will be used instead.\n *\n * The super constructor can be accessed via a special super_
property on the child constructor.\n *\n * @param {string} [name=this.class_] - the class name to be used for the child constructor\n * @param {Function} [constructor] - the constructor for the child\n * @param {Object} [prototype] - the prototype properties to be defined for the child\n * @param {Object} [statics] - the static properties to be defined for the child\n * @return {Function} The child constructor
provided or the one created if none was given.\n * @public\n * @static\n * @memberof Nevis\n */\nNevis.extend = extend;\n\nmodule.exports = Nevis;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains utility methods that are useful throughout the library.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Utilities = Nevis.extend(null, {\n\n /**\n * Iterates over own (not inherited) enumerable properties on the specified object
.\n *\n * Nothing happens if object
is null
.\n *\n * @param {Object} object - the object whose own properties are to be iterated over\n * @param {Utilities~ForOwnCallback} callback - the function to be called with the value and key for each own property\n * on object
\n * @param {Object} [context] - the value to use this
when executing callback
\n * @return {void}\n * @public\n * @static\n * @memberof Utilities\n */\n forOwn: function(object, callback, context) {\n if (!object) {\n return;\n }\n\n for (var key in object) {\n if (Utilities.hasOwn(object, key)) {\n callback.call(context, object[key], key, object);\n }\n }\n },\n\n /**\n * Returns whether the specified object
has a property with the specified name
as an own\n * (not inherited) property.\n *\n * @param {Object} object - the object on which the property is to be checked\n * @param {string} name - the name of the property to be checked\n * @return {boolean} true
if object
has an own property with name
.\n * @public\n * @static\n * @memberof Utilities\n */\n hasOwn: function(object, name) {\n return Object.prototype.hasOwnProperty.call(object, name);\n },\n\n /**\n * Left pads the string
provided with the given padding string for the specified number of\n * times
.\n *\n * @param {string} [string=\"\"] - the string to be padded\n * @param {number} [times=0] - the number of times to pad string
\n * @param {string} [padding=\" \"] - the padding string\n * @return {string} The padded string
.\n * @public\n * @static\n * @memberof Utilities\n */\n leftPad: function(string, times, padding) {\n if (string == null) {\n string = '';\n }\n if (times == null) {\n times = 0;\n }\n if (padding == null) {\n padding = ' ';\n }\n if (!padding) {\n return string;\n }\n\n for (var i = 0; i < times; i++) {\n string = padding + string;\n }\n\n return string;\n }\n\n});\n\nmodule.exports = Utilities;\n\n/**\n * Called for each own enumerable property on object
.\n *\n * @callback Utilities~ForOwnCallback\n * @param {*} value - the value of the property\n * @param {string} key - the name of the property\n * @param {Object} object - the object to which the property belongs\n * @return {void}\n */\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\nvar Utilities = require('./util/Utilities');\n\n/**\n * Contains contextual information for a single conversion process.\n *\n * @param {Europa} europa - the {@link Europa} instance responsible for this conversion\n * @param {Europa~Options} options - the options to be used\n * @public\n * @class\n * @extends Nevis\n */\nvar Conversion = Nevis.extend(function(europa, options) {\n /**\n * The {@link Europa} instance responsible for this {@link Conversion}.\n *\n * @public\n * @type {Europa}\n * @memberof Conversion#\n */\n this.europa = europa;\n\n /**\n * The options for this {@link Conversion}.\n *\n * @public\n * @type {Europa~Options}\n * @memberof Conversion#\n */\n this.options = options;\n\n /**\n * Whether the buffer is at the start of the current line.\n *\n * @public\n * @type {boolean}\n * @memberof Conversion#\n */\n this.atLeft = true;\n\n /**\n * Whether any white space should be removed from the start of the next output.\n *\n * @public\n * @type {boolean}\n * @memberof Conversion#\n */\n this.atNoWhiteSpace = true;\n\n /**\n * Whether the buffer is at the start of a paragraph.\n *\n * @public\n * @type {boolean}\n * @memberof Conversion#\n */\n this.atParagraph = true;\n\n /**\n * The conversion output buffer to which the Markdown will be written.\n *\n * @public\n * @type {string}\n * @memberof Conversion#\n */\n this.buffer = '';\n\n /**\n * The context for this {@link Conversion}.\n *\n * @public\n * @type {Object.}\n * @memberof Conversion#\n */\n this.context = {};\n\n /**\n * Whether the buffer is currently within a code block.\n *\n * @public\n * @type {boolean}\n * @memberof Conversion#\n */\n this.inCodeBlock = false;\n\n /**\n * Whether the buffer is currently within an ordered list.\n *\n * @public\n * @type {boolean}\n * @memberof Conversion#\n */\n this.inOrderedList = false;\n\n /**\n * Whether the buffer is currently within a preformatted block.\n *\n * @public\n * @type {boolean}\n * @memberof Conversion#\n */\n this.inPreformattedBlock = false;\n\n /**\n * The last string to be output next to the buffer.\n *\n * @public\n * @type {string}\n * @memberof Conversion#\n */\n this.last = null;\n\n /**\n * The start of the current line.\n *\n * @public\n * @type {string}\n * @memberof Conversion#\n */\n this.left = '\\n';\n\n /**\n * The depth of nested lists.\n *\n * @public\n * @type {number}\n * @memberof Conversion#\n */\n this.listDepth = 0;\n\n /**\n * The one-based index for the current list item within the current list.\n *\n * @public\n * @type {number}\n * @memberof Conversion#\n */\n this.listIndex = 1;\n\n this._document = europa.document;\n this._element = null;\n this._tagName = null;\n this._window = europa.window;\n}, {\n\n /**\n * Appends the last output string to the buffer and then queues the specified string
to be output.\n *\n * @param {string} string - the string to be appended\n * @return {Conversion} A reference to this {@link Conversion} for chaining purposes.\n * @public\n * @memberof Conversion#\n */\n append: function(string) {\n if (this.last != null) {\n this.buffer += this.last;\n }\n\n this.last = string;\n\n return this;\n },\n\n /**\n * Appends a paragraph to the output buffer.\n *\n * @return {Conversion} A reference to this {@link Conversion} for chaining purposes.\n * @public\n * @memberof Conversion#\n */\n appendParagraph: function() {\n if (this.atParagraph) {\n return this;\n }\n\n if (!this.atLeft) {\n this.append(this.left);\n\n this.atLeft = true;\n }\n\n this.append(this.left);\n\n this.atNoWhiteSpace = true;\n this.atParagraph = true;\n\n return this;\n },\n\n /**\n * Outputs the specified string
to the buffer.\n *\n * Optionally, string
can be \"cleaned\" before being output. Doing so will replace any certain special\n * characters as well as some white space.\n *\n * @param {string} string - the string to be output\n * @param {boolean} [clean=false] - true
to clean string
; otherwise false
\n * @return {Conversion} A reference to this {@link Conversion} for chaining purposes.\n * @public\n * @memberof Conversion#\n */\n output: function(string, clean) {\n if (!string) {\n return this;\n }\n\n string = string.replace(/\\r\\n/g, '\\n');\n\n if (clean) {\n string = string.replace(/\\n([ \\t]*\\n)+/g, '\\n')\n .replace(/\\n[ \\t]+/g, '\\n')\n .replace(/[ \\t]+/g, ' ');\n\n Utilities.forOwn(Conversion.replacements, function(value, key) {\n string = string.replace(Conversion.replacementsRegExp[key], value);\n });\n }\n\n if (!this.inPreformattedBlock) {\n if (this.atNoWhiteSpace) {\n string = string.replace(/^[ \\t\\n]+/, '');\n } else if (/^[ \\t]*\\n/.test(string)) {\n string = string.replace(/^[ \\t\\n]+/, '\\n');\n } else {\n string = string.replace(/^[ \\t]+/, ' ');\n }\n }\n\n if (!string) {\n return this;\n }\n\n this.atLeft = /\\n$/.test(string);\n this.atNoWhiteSpace = /[ \\t\\n]$/.test(string);\n this.atParagraph = /\\n{2}$/.test(string);\n\n return this.append(string.replace(/\\n/g, this.left));\n },\n\n /**\n * Replaces the start of the current line with the string
provided.\n *\n * @param {string} string - the string to replace the start of the current line\n * @return {Conversion} A reference to this {@link Conversion} for chaining purposes.\n * @public\n * @memberof Conversion#\n */\n replaceLeft: function(string) {\n if (!this.atLeft) {\n this.append(this.left.replace(/[ ]{2,4}$/, string));\n\n this.atLeft = true;\n this.atNoWhiteSpace = true;\n this.atParagraph = true;\n } else if (this.last) {\n this.last = this.last.replace(/[ ]{2,4}$/, string);\n }\n\n return this;\n }\n\n}, {\n\n /**\n * A map of special characters and their replacements.\n *\n * @public\n * @static\n * @type {Object.}\n * @memberof Conversion\n */\n replacements: {\n '\\\\\\\\': '\\\\\\\\',\n '\\\\[': '\\\\[',\n '\\\\]': '\\\\]',\n '>': '\\\\>',\n '_': '\\\\_',\n '\\\\*': '\\\\*',\n '`': '\\\\`',\n '#': '\\\\#',\n '([0-9])\\\\.(\\\\s|$)': '$1\\\\.$2',\n '\\u00a9': '(c)',\n '\\u00ae': '(r)',\n '\\u2122': '(tm)',\n '\\u00a0': ' ',\n '\\u00b7': '\\\\*',\n '\\u2002': ' ',\n '\\u2003': ' ',\n '\\u2009': ' ',\n '\\u2018': '\\'',\n '\\u2019': '\\'',\n '\\u201c': '\"',\n '\\u201d': '\"',\n '\\u2026': '...',\n '\\u2013': '--',\n '\\u2014': '---'\n },\n\n /**\n * A map of special characters and the regular expression used to identify them.\n *\n * @public\n * @static\n * @type {Object.}\n * @memberof Conversion\n */\n replacementsRegExp: {}\n\n});\n\nObject.defineProperties(Conversion.prototype, {\n\n document: {\n /**\n * Returns the current document for this {@link Conversion}.\n *\n * This may not be the same document as is associated with the {@link Europa} instance as this document may be\n * nested (e.g. a frame).\n *\n * @return {Document} The current document.\n * @public\n * @memberof Conversion#\n * @alias document\n */\n get: function() {\n return this._document;\n }\n },\n\n element: {\n /**\n * Returns the current element for this {@link Conversion}.\n *\n * @return {Element} The current element.\n * @public\n * @memberof Conversion#\n * @alias element\n */\n get: function() {\n return this._element;\n },\n\n /**\n * Sets the current element for this {@link Conversion} to element
.\n *\n * @param {Element} element - the current element to be set\n * @return {void}\n * @public\n * @memberof Conversion#\n * @alias element\n */\n set: function(element) {\n this._element = element;\n this._tagName = element && element.tagName ? element.tagName.toLowerCase() : null;\n }\n },\n\n tagName: {\n /**\n * Returns the name of the tag for the current element for this {@link Conversion}.\n *\n * The tag name will always be in lower case, when available.\n *\n * @return {string} The current element's tag name.\n * @public\n * @memberof Conversion#\n * @alias tagName\n */\n get: function() {\n return this._tagName;\n }\n },\n\n window: {\n /**\n * Returns the current window for this {@link Conversion}.\n *\n * This may not be the same window as is associated with the {@link Europa} instance as this window may be nested\n * (e.g. a frame).\n *\n * @return {Window} The current window.\n * @public\n * @memberof Conversion#\n * @alias window\n */\n get: function() {\n return this._window;\n },\n\n /**\n * Sets the current window for this {@link Conversion} to window
.\n *\n * This may not be the same window as is associated with the {@link Europa} instance as this window may be nested\n * (e.g. a frame).\n *\n * @param {Window} window - the window to be set\n * @return {void}\n * @public\n * @memberof Conversion#\n * @alias window\n */\n set: function(window) {\n this._window = window;\n this._document = window ? window.document : null;\n }\n }\n\n});\n\nUtilities.forOwn(Conversion.replacements, function(value, key) {\n Conversion.replacementsRegExp[key] = new RegExp(key, 'g');\n});\n\nmodule.exports = Conversion;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Contains utility methods that are useful when dealing with the DOM.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar DOMUtilities = Nevis.extend(null, {\n\n /**\n * Checks whether the specified element
is currently visible using the window
provided.\n *\n * This is not a very sophisticated check and could easily be mistaken, but it should catch a lot of the most simple\n * cases.\n *\n * @param {Element} element - the element whose visibility is to be checked\n * @param {Window} window - the window to be used\n * @return {boolean} true
if element
is visible; otherwise false
.\n * @public\n * @static\n * @memberof DOMUtilities\n */\n isVisible: function(element, window) {\n var style = window.getComputedStyle(element);\n\n return style.getPropertyValue('display') !== 'none' && style.getPropertyValue('visibility') !== 'hidden';\n }\n\n});\n\nmodule.exports = DOMUtilities;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Defines an available option.\n *\n * If defaultValue
is a function, it will be called if/when needed and the return value will be used as the\n * default value. If the default value is to be a function itself, then defaultValue
must return that\n * function.\n *\n * @param {string} name - the name to be used\n * @param {*} [defaultValue] - the default value to be used\n * @public\n * @class\n * @extends Nevis\n */\nvar Option = Nevis.extend(function(name, defaultValue) {\n /**\n * The name for this {@link Option}.\n *\n * @public\n * @type {string}\n * @memberof Option#\n */\n this.name = name;\n\n this._defaultValue = defaultValue;\n});\n\nObject.defineProperty(Option.prototype, 'defaultValue', {\n /**\n * Returns the default value for this {@link Option}.\n *\n * @return {*} The default value.\n * @public\n * @memberof Option#\n * @alias defaultValue\n */\n get: function() {\n var defaultValue = this._defaultValue;\n\n return typeof defaultValue === 'function' ? defaultValue.call(this) : defaultValue;\n }\n});\n\nmodule.exports = Option;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Manages multiple {@link Option} instances that are intended to be used by multiple implementations/instances.\n *\n * @param {Option[]} options - the options to be used\n * @public\n * @class\n * @extends Nevis\n */\nvar OptionParser = Nevis.extend(function(options) {\n /**\n * The available options for this {@link OptionParser}.\n *\n * @public\n * @type {Option[]}\n * @memberof OptionParser#\n */\n this.options = options;\n}, {\n\n /**\n * Returns whether an option with the specified name
is available.\n *\n * @param {string} name - the name of the {@link Option} whose existence is to be checked\n * @return {boolean} true
if an {@link Option} exists with name
; otherwise\n * false
.\n * @public\n * @memberof OptionParser#\n */\n exists: function(name) {\n return this.options.some(function(option) {\n return option.name === name;\n });\n },\n\n /**\n * Parses the specified options
, extracting only properties that match valid options and applying default\n * values where required.\n *\n * @param {Object} [options] - the options to be parsed\n * @return {Object.} The parsed options.\n * @public\n * @memberof OptionParser#\n */\n parse: function(options) {\n if (!options) {\n options = {};\n }\n\n var result = {};\n\n this.options.forEach(function(option) {\n var name = option.name;\n var value = options[name] != null ? options[name] : option.defaultValue;\n\n result[name] = value;\n });\n\n return result;\n }\n\n});\n\nmodule.exports = OptionParser;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * A plugin that can tap into multiple parts in the conversion process while being specific to only a sub-set of tags.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Plugin = Nevis.extend({\n\n /**\n * Called after {@link Plugin#convert} and only once all children elements have been converted as well,\n * provided they weren't skipped, and intended for tidying up after the conversion.\n *\n * context
can be used to receive any state for a single element conversion from {@link Plugin#before}\n * and {@link Plugin#convert}.\n *\n * @param {Conversion} conversion - the current {@link Conversion}\n * @param {Object.} context - the current context for this {@link Plugin}\n * @return {void}\n * @public\n * @memberof Plugin#\n */\n after: function(conversion, context) {},\n\n /**\n * Called before any elements are converted and intended to setup this {@link Plugin} initially.\n *\n * @param {Conversion} conversion - the current {@link Conversion}\n * @return {void}\n * @public\n * @memberof Plugin#\n */\n afterAll: function(conversion) {},\n\n /**\n * Called immediately before {@link Plugin#convert} and intended for preparing this {@link Plugin} for conversion.\n *\n * context
can be used to pass any state for a single element conversion to {@link Plugin#convert} and\n * then to {@link Plugin#after}.\n *\n * @param {Conversion} conversion - the current {@link Conversion}\n * @param {Object.} context - the current context for this {@link Plugin}\n * @return {void}\n * @public\n * @memberof Plugin#\n */\n before: function(conversion, context) {},\n\n /**\n * Called after all elements have been converted and intended to completing any steps for this {@link Plugin}.\n *\n * @param {Conversion} conversion - the current {@link Conversion}\n * @return {void}\n * @public\n * @memberof Plugin#\n */\n beforeAll: function(conversion) {},\n\n /**\n * Converts the current element within the specified conversion
which can be used to provide control over\n * the conversion and returns whether the children of the element should be converted.\n *\n * context
can be used to pass any state for a single element conversion from {@link Plugin#before} to\n * {@link Plugin#after}.\n *\n * @param {Conversion} conversion - the current {@link Conversion}\n * @param {Object.} context - the current context for this {@link Plugin}\n * @return {boolean} true
if the children of the current element should be converted; otherwise\n * false
.\n * @public\n * @memberof Plugin#\n */\n convert: function(conversion, context) {\n return true;\n },\n\n /**\n * Returns the names of tags with which this {@link Plugin} should be registered to handle.\n *\n * @return {string[]} The names of supported tags.\n * @public\n * @memberof Plugin#\n */\n getTagNames: function() {\n return [];\n }\n\n});\n\nmodule.exports = Plugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\nvar Conversion = require('./Conversion');\nvar DOMUtilities = require('./util/DOMUtilities');\nvar Option = require('./option/Option');\nvar OptionParser = require('./option/OptionParser');\nvar Plugin = require('./plugin/Plugin');\nvar ServiceManager = require('./service/ServiceManager');\nvar Utilities = require('./util/Utilities');\n\nvar plugins = {};\nvar serviceManager = new ServiceManager();\n\n/**\n * Enables configuration of a HTML to Markdown converter that supports HTML strings and DOM elements.\n *\n * @param {Europa~Options} [options] - the options to be used\n * @public\n * @class\n * @extends Nevis\n */\nvar Europa = Nevis.extend(function(options) {\n this._options = new OptionParser([\n new Option('absolute', false),\n new Option('baseUri', function() {\n return serviceManager.getService('window').getDefaultBaseUri();\n }),\n new Option('inline', false)\n ])\n .parse(options);\n this._window = null;\n}, {\n\n /**\n * Converts the specified html
into Markdown based on the options configured for this {@link Europa}\n * instance.\n *\n * html
can either be an HTML string or a DOM element whose HTML contents are to be converted into\n * Markdown.\n *\n * @param {Element|string} html - the HTML (or element whose inner HTML is) to be converted into Markdown\n * @return {string} The Markdown converted from html
.\n * @public\n * @memberof Europa#\n */\n convert: function(html) {\n if (!html) {\n return '';\n }\n\n var document = this.document;\n var root;\n\n if (typeof html === 'string') {\n root = document.createElement('div');\n root.innerHTML = html;\n } else {\n root = html;\n }\n\n var conversion = new Conversion(this, this._options);\n var wrapper;\n\n if (!document.contains(root)) {\n wrapper = document.createElement('div');\n wrapper.style.display = 'none';\n wrapper.appendChild(root);\n\n document.body.appendChild(wrapper);\n }\n\n try {\n Utilities.forOwn(plugins, function(plugin) {\n plugin.beforeAll(conversion);\n });\n\n this.convertElement(root, conversion);\n\n Utilities.forOwn(plugins, function(plugin) {\n plugin.afterAll(conversion);\n });\n } finally {\n if (wrapper) {\n document.body.removeChild(wrapper);\n\n wrapper.removeChild(root);\n }\n }\n\n return conversion.append('').buffer.trim();\n },\n\n /**\n * Converts the specified element
and it's children into Markdown using the conversion
\n * provided.\n *\n * Nothing happens if element
is null
or is invisible (simplified detection used).\n *\n * @param {Element} element - the element (along well as it's children) to be converted into Markdown\n * @param {Conversion} conversion - the current {@link Conversion}\n * @return {void}\n * @public\n * @memberof Europa#\n */\n convertElement: function(element, conversion) {\n if (!element) {\n return;\n }\n\n var convertChildren = false;\n var window = this.window;\n var context, i, plugin, value;\n\n if (element.nodeType === window.Node.ELEMENT_NODE) {\n if (!DOMUtilities.isVisible(element, window)) {\n return;\n }\n\n conversion.element = element;\n\n context = {};\n plugin = plugins[conversion.tagName];\n convertChildren = true;\n\n if (plugin) {\n plugin.before(conversion, context);\n convertChildren = plugin.convert(conversion, context);\n }\n\n if (convertChildren) {\n for (i = 0; i < element.childNodes.length; i++) {\n this.convertElement(element.childNodes[i], conversion);\n }\n }\n\n if (plugin) {\n plugin.after(conversion, context);\n }\n } else if (element.nodeType === window.Node.TEXT_NODE) {\n value = element.nodeValue || '';\n\n if (conversion.inPreformattedBlock) {\n conversion.output(value);\n } else if (conversion.inCodeBlock) {\n conversion.output(value.replace(/`/g, '\\\\`'));\n } else {\n conversion.output(value, true);\n }\n }\n },\n\n /**\n * Releases the window used by this {@link Europa} instance.\n *\n * This allows closeable {@link WindowService} implementations to close the window and free up resources. However,\n * this instance can and will simply retrieve another window from the {@link WindowService} the next time it is\n * required (i.e. {@link Europa#convert} is called).\n *\n * @return {Europa} A reference to this {@link Europa} for chaining purposes.\n * @public\n * @memberof Europa#\n */\n release: function() {\n if (this._window) {\n serviceManager.getService('window').closeWindow(this._window);\n this._window = null;\n }\n\n return this;\n }\n\n}, {\n\n /**\n * A convient reference to {@link Plugin} exposed on {@link Europa} for cases where Europa Core is bundled.\n *\n * @public\n * @static\n * @type {Function}\n * @memberof Europa\n */\n Plugin: Plugin,\n\n /**\n * Registers the specified plugin
to be used by all {@link Europa} instances.\n *\n * If plugin
declares support for a tag name which already has a {@link Plugin} registered for it,\n * plugin
will replace the previously registered plugin, but only for conflicting tag names.\n *\n * @param {Plugin} plugin - the {@link Plugin} to be registered\n * @return {void}\n * @public\n * @static\n * @memberof Europa\n */\n register: function(plugin) {\n plugin.getTagNames().forEach(function(tag) {\n plugins[tag] = plugin;\n });\n },\n\n /**\n * Configures the service
provided to be used by all {@link Europa} instances.\n *\n * @param {Service} service - the {@link Service} to be configured\n * @return {void}\n * @throws {Error} If a {@link Service} has already been configured with the same name.\n * @public\n * @static\n * @memberof Europa\n */\n use: function(service) {\n serviceManager.setService(service.getName(), service);\n }\n\n});\n\nObject.defineProperties(Europa.prototype, {\n\n document: {\n /**\n * Returns the document to be used for HTML to Markdown conversion by this {@link Europa} instance.\n *\n * @return {Document} The document.\n * @public\n * @memberof Europa#\n * @alias document\n */\n get: function() {\n return this.window.document;\n }\n },\n\n window: {\n /**\n * Returns the window to be used for HTML to Markdown conversion by this {@link Europa} instance.\n *\n * @return {Window} The window.\n * @public\n * @memberof Europa#\n * @alias window\n */\n get: function() {\n if (!this._window) {\n this._window = serviceManager.getService('window').getWindow(this._options.baseUri);\n }\n\n return this._window;\n }\n }\n\n});\n\nmodule.exports = Europa;\n\n/**\n * The options used by {@link Europa}.\n *\n * @typedef {Object} Europa~Options\n * @property {boolean} [absolute=false] - Whether absolute URLS should be used for anchors/images.\n * @property {string} [baseUri] - The base URI for the window. This is ignored in environments where the base URI cannot\n * be changed.\n * @property {boolean} [inline=false] - Whether anchor/image URLs are to be inserted inline.\n */\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * A basic manager for {@link Service} implementations that are mapped to simple names.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar ServiceManager = Nevis.extend(function() {\n this._services = {};\n}, {\n\n /**\n * Returns the {@link Service} being managed with the specified name
.\n *\n * @param {string} name - the name of the {@link Service} to be returned\n * @return {Service} The {@link Service} is being managed with name
.\n * @throws {Error} If no {@link Service} is being managed with name
.\n * @public\n * @memberof ServiceManager#\n */\n getService: function(name) {\n var service = this._services[name];\n if (!service) {\n throw new Error('Service is not being managed with name: ' + name);\n }\n\n return service;\n },\n\n /**\n * Sets the {@link Service} implementation to be managed for the specified name
to the\n * service
provided.\n *\n * @param {string} name - the name of the {@link Service} to be managed with name
\n * @param {Service} service - the {@link Service} implementation to be managed\n * @return {void}\n * @throws {Error} If a {@link Service} is already being managed with the same name
.\n * @public\n * @memberof ServiceManager#\n */\n setService: function(name, service) {\n if (this._services[name]) {\n throw new Error('Service is already managed with name: ' + name);\n }\n\n if (service) {\n this._services[name] = service;\n }\n }\n\n});\n\nmodule.exports = ServiceManager;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which extracts the URL from an anchor. Anchors without an href
are treated as plain\n * text.\n *\n * If the absolute
option is enabled, then the URL extracted from the anchor will be absolute. Otherwise,\n * the URL will be exactly as it is in the href
attribute.\n *\n * If the inline
option is enabled, then the URL (and any title
on the anchor) will be\n * inserted immediately after the anchor contents (e.g. [foo](/bar)
). Otherwise, all unique URL and title\n * combinations will be indexed (e.g. [foo][anchor0]
) and the references will be output at the very end.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar AnchorPlugin = Plugin.extend({\n\n /**\n * @override\n */\n after: function(conversion, context) {\n if (context.value != null) {\n conversion.output(']' + context.value);\n }\n },\n\n /**\n * @override\n */\n afterAll: function(conversion) {\n var anchors = conversion.context.anchors;\n if (!anchors.length) {\n return;\n }\n\n conversion.append('\\n\\n');\n\n for (var i = 0; i < anchors.length; i++) {\n conversion.append('[anchor' + i + ']: ' + anchors[i] + '\\n');\n }\n },\n\n /**\n * @override\n */\n beforeAll: function(conversion) {\n conversion.context.anchorMap = {};\n conversion.context.anchors = [];\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n var element = conversion.element;\n var options = conversion.options;\n var href = options.absolute ? element.href : element.getAttribute('href');\n if (!href) {\n return true;\n }\n\n var anchorMap = conversion.context.anchorMap;\n var anchors = conversion.context.anchors;\n var title = element.getAttribute('title');\n var value = title ? href + ' \"' + title + '\"' : href;\n var index;\n\n if (options.inline) {\n context.value = '(' + value + ')';\n } else {\n index = anchorMap[value];\n if (index == null) {\n index = anchors.push(value) - 1;\n\n anchorMap[value] = index;\n }\n\n context.value = '[anchor' + index + ']';\n }\n\n conversion.output('[');\n\n conversion.atNoWhiteSpace = true;\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'a' ];\n }\n\n});\n\nEuropa.register(new AnchorPlugin());\n\nmodule.exports = AnchorPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs the contents in a block quote.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar BlockQuotePlugin = Plugin.extend({\n\n /**\n * @override\n */\n after: function(conversion, context) {\n conversion.atLeft = false;\n conversion.atParagraph = false;\n conversion.left = context.previousLeft;\n\n conversion.appendParagraph();\n },\n\n /**\n * @override\n */\n before: function(conversion, context) {\n context.previousLeft = conversion.left;\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n var value = '> ';\n\n conversion.left += value;\n\n if (conversion.atParagraph) {\n conversion.append(value);\n } else {\n conversion.appendParagraph();\n }\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [\n 'blockquote',\n 'dd'\n ];\n }\n\n});\n\nEuropa.register(new BlockQuotePlugin());\n\nmodule.exports = BlockQuotePlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs an inline line break.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar BreakPlugin = Plugin.extend({\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n conversion.append(' ' + conversion.left);\n\n conversion.atLeft = true;\n conversion.atNoWhiteSpace = true;\n\n return false;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'br' ];\n }\n\n});\n\nEuropa.register(new BreakPlugin());\n\nmodule.exports = BreakPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs the contents in a code block.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar CodePlugin = Plugin.extend({\n\n /**\n * @override\n */\n after: function(conversion, context) {\n if (!context.skipped) {\n conversion.inCodeBlock = context.previousInCodeBlock;\n\n conversion.output('`');\n }\n },\n\n /**\n * @override\n */\n before: function(conversion, context) {\n context.previousInCodeBlock = conversion.inCodeBlock;\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n if (conversion.inPreformattedBlock) {\n context.skipped = true;\n } else {\n conversion.output('`');\n\n conversion.inCodeBlock = true;\n }\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [\n 'code',\n 'kbd',\n 'samp'\n ];\n }\n\n});\n\nEuropa.register(new CodePlugin());\n\nmodule.exports = CodePlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs a definition term as strong text.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar DefinitionTermPlugin = Plugin.extend({\n\n /**\n * @override\n */\n after: function(conversion, context) {\n conversion.output('**');\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n conversion.appendParagraph();\n\n conversion.output('**');\n\n conversion.atNoWhiteSpace = true;\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'dt' ];\n }\n\n});\n\nEuropa.register(new DefinitionTermPlugin());\n\nmodule.exports = DefinitionTermPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs a details section.\n *\n * If the details has an open
attribute then all of its children are converted. Otherwise, only the nested\n * summary
, if any, will be converted.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar DetailsPlugin = Plugin.extend({\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n var element = conversion.element;\n\n conversion.appendParagraph();\n\n if (element.hasAttribute('open')) {\n return true;\n }\n\n var summary = element.querySelector('summary');\n conversion.europa.convertElement(summary, conversion);\n\n return false;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'details' ];\n }\n\n});\n\nEuropa.register(new DetailsPlugin());\n\nmodule.exports = DetailsPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs as emphasised text.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar EmphasisPlugin = Plugin.extend({\n\n /**\n * @override\n */\n after: function(conversion, context) {\n conversion.output('_');\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n conversion.output('_');\n\n conversion.atNoWhiteSpace = true;\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [\n 'cite',\n 'dfn',\n 'em',\n 'i',\n 'u',\n 'var'\n ];\n }\n\n});\n\nEuropa.register(new EmphasisPlugin());\n\nmodule.exports = EmphasisPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which simply ensures that no children elements are converted.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar EmptyPlugin = Plugin.extend({\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n return false;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [\n 'applet',\n 'area',\n 'audio',\n 'button',\n 'canvas',\n 'datalist',\n 'embed',\n 'head',\n 'input',\n 'map',\n 'menu',\n 'meter',\n 'noframes',\n 'noscript',\n 'object',\n 'optgroup',\n 'option',\n 'param',\n 'progress',\n 'rp',\n 'rt',\n 'ruby',\n 'script',\n 'select',\n 'style',\n 'textarea',\n 'title',\n 'video'\n ];\n }\n\n});\n\nEuropa.register(new EmptyPlugin());\n\nmodule.exports = EmptyPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs the contents of nested frame.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar FramePlugin = Plugin.extend({\n\n /**\n * @override\n */\n after: function(conversion, context) {\n conversion.window = context.previousWindow;\n },\n\n /**\n * @override\n */\n before: function(conversion, context) {\n context.previousWindow = conversion.window;\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n var window = conversion.element.contentWindow;\n\n if (window) {\n conversion.window = window;\n\n conversion.europa.convertElement(window.document.body, conversion);\n }\n\n return false;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'frame', 'iframe' ];\n }\n\n});\n\nEuropa.register(new FramePlugin());\n\nmodule.exports = FramePlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs a heading of various levels.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar HeadingPlugin = Plugin.extend({\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n var level = parseInt(conversion.tagName.match(/([1-6])$/)[1], 10);\n\n conversion.appendParagraph();\n\n var heading = '';\n for (var i = 0; i < level; i++) {\n heading += '#';\n }\n\n conversion.output(heading + ' ');\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6'\n ];\n }\n\n});\n\nEuropa.register(new HeadingPlugin());\n\nmodule.exports = HeadingPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs a horizontal rule.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar HorizontalRulePlugin = Plugin.extend({\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n conversion\n .appendParagraph()\n .output('---')\n .appendParagraph();\n\n return false;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'hr' ];\n }\n\n});\n\nEuropa.register(new HorizontalRulePlugin());\n\nmodule.exports = HorizontalRulePlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which extracts the URL from an image.\n *\n * If the absolute
option is enabled, then the URL extracted from the image will be absolute. Otherwise,\n * the URL will be exactly as it is in the src
attribute.\n *\n * If the inline
option is enabled, then the URL will be inserted immediately after the alt
on\n * the image (e.g. ![foo](/bar.png)
). Otherwise, all unique URLs will be indexed\n * (e.g. ![foo][image0]
) and the references will be output at the very end.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar ImagePlugin = Plugin.extend({\n\n /**\n * @override\n */\n afterAll: function(conversion) {\n var images = conversion.context.images;\n if (!images.length) {\n return;\n }\n\n conversion.append('\\n\\n');\n\n for (var i = 0; i < images.length; i++) {\n conversion.append('[image' + i + ']: ' + images[i] + '\\n');\n }\n },\n\n /**\n * @override\n */\n beforeAll: function(conversion) {\n conversion.context.imageMap = {};\n conversion.context.images = [];\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n var element = conversion.element;\n var options = conversion.options;\n var source = options.absolute ? element.src : element.getAttribute('src');\n if (!source) {\n return false;\n }\n\n var alternativeText = element.getAttribute('alt') || '';\n var imageMap = conversion.context.imageMap;\n var images = conversion.context.images;\n var title = element.getAttribute('title');\n var value = title ? source + ' \"' + title + '\"' : source;\n var index;\n\n if (options.inline) {\n value = '(' + value + ')';\n } else {\n index = imageMap[value];\n if (index == null) {\n index = images.push(value) - 1;\n\n imageMap[value] = index;\n }\n\n value = '[image' + index + ']';\n }\n\n conversion.output('![' + alternativeText + ']' + value);\n\n return false;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'img' ];\n }\n\n});\n\nEuropa.register(new ImagePlugin());\n\nmodule.exports = ImagePlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\nvar Utilities = require('../../util/Utilities');\n\n/**\n * A {@link Plugin} which outputs a list item. The prefix for the list item will vary depending on what type of list the\n * item is contained within.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar ListItemPlugin = Plugin.extend({\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n var value = conversion.inOrderedList ? conversion.listIndex++ + '. ' : '* ';\n\n if (!conversion.atLeft) {\n conversion.append(conversion.left.replace(/[ ]{2,4}$/, '\\n'));\n\n conversion.atLeft = true;\n conversion.atNoWhiteSpace = true;\n conversion.atParagraph = true;\n } else if (conversion.last) {\n conversion.last = conversion.last.replace(/[ ]{2,4}$/, '\\n');\n }\n\n conversion.append(Utilities.leftPad(value, (conversion.listDepth - 1) * 2));\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'li' ];\n }\n\n});\n\nEuropa.register(new ListItemPlugin());\n\nmodule.exports = ListItemPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs an ordered list.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar OrderedListPlugin = Plugin.extend({\n\n /**\n * @override\n */\n after: function(conversion, context) {\n conversion.inOrderedList = context.previousInOrderedList;\n conversion.listIndex = context.previousListIndex;\n conversion.listDepth--;\n },\n\n /**\n * @override\n */\n before: function(conversion, context) {\n context.previousInOrderedList = conversion.inOrderedList;\n context.previousListIndex = conversion.listIndex;\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n if (conversion.listDepth === 0) {\n conversion.appendParagraph();\n }\n\n conversion.inOrderedList = true;\n conversion.listIndex = 1;\n conversion.listDepth++;\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'ol' ];\n }\n\n});\n\nEuropa.register(new OrderedListPlugin());\n\nmodule.exports = OrderedListPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs a paragraph.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar ParagraphPlugin = Plugin.extend({\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n conversion.appendParagraph();\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [\n 'address',\n 'article',\n 'aside',\n 'div',\n 'fieldset',\n 'footer',\n 'header',\n 'nav',\n 'p',\n 'section'\n ];\n }\n\n});\n\nEuropa.register(new ParagraphPlugin());\n\nmodule.exports = ParagraphPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs the contents in a preformatted block.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar PreformattedPlugin = Plugin.extend({\n\n /**\n * @override\n */\n after: function(conversion, context) {\n conversion.atLeft = false;\n conversion.atParagraph = false;\n conversion.inPreformattedBlock = context.previousInPreformattedBlock;\n conversion.left = context.previousLeft;\n\n conversion.appendParagraph();\n },\n\n /**\n * @override\n */\n before: function(conversion, context) {\n context.previousInPreformattedBlock = conversion.inPreformattedBlock;\n context.previousLeft = conversion.left;\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n var value = ' ';\n\n conversion.left += value;\n\n if (conversion.atParagraph) {\n conversion.append(value);\n } else {\n conversion.appendParagraph();\n }\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'pre' ];\n }\n\n});\n\nEuropa.register(new PreformattedPlugin());\n\nmodule.exports = PreformattedPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs as quoted text.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar QuotePlugin = Plugin.extend({\n\n /**\n * @override\n */\n after: function(conversion, context) {\n conversion.output('\"');\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n conversion.output('\"');\n\n conversion.atNoWhiteSpace = true;\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'q' ];\n }\n\n});\n\nEuropa.register(new QuotePlugin());\n\nmodule.exports = QuotePlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs as strong text.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar StrongPlugin = Plugin.extend({\n\n /**\n * @override\n */\n after: function(conversion, context) {\n conversion.output('**');\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n conversion.output('**');\n\n conversion.atNoWhiteSpace = true;\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [\n 'b',\n 'strong'\n ];\n }\n\n});\n\nEuropa.register(new StrongPlugin());\n\nmodule.exports = StrongPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('../../Europa');\nvar Plugin = require('../Plugin');\n\n/**\n * A {@link Plugin} which outputs an unordered list.\n *\n * @public\n * @class\n * @extends Plugin\n */\nvar UnorderedListPlugin = Plugin.extend({\n\n /**\n * @override\n */\n after: function(conversion, context) {\n conversion.inOrderedList = context.previousInOrderedList;\n conversion.listIndex = context.previousListIndex;\n conversion.listDepth--;\n },\n\n /**\n * @override\n */\n before: function(conversion, context) {\n context.previousInOrderedList = conversion.inOrderedList;\n context.previousListIndex = conversion.listIndex;\n },\n\n /**\n * @override\n */\n convert: function(conversion, context) {\n if (conversion.listDepth === 0) {\n conversion.appendParagraph();\n }\n\n conversion.inOrderedList = false;\n conversion.listIndex = 1;\n conversion.listDepth++;\n\n return true;\n },\n\n /**\n * @override\n */\n getTagNames: function() {\n return [ 'ul' ];\n }\n\n});\n\nEuropa.register(new UnorderedListPlugin());\n\nmodule.exports = UnorderedListPlugin;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('./src/Europa');\nrequire('./src/plugin/preset/default');\n\nmodule.exports = Europa;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Nevis = require('nevis/lite');\n\n/**\n * Defines a service contract that must be met by all implementations.\n *\n * @public\n * @class\n * @extends Nevis\n */\nvar Service = Nevis.extend({\n\n /**\n * Returns the name of this {@link Service}.\n *\n * @return {string} The service name.\n * @public\n * @abstract\n * @memberof Service#\n */\n getName: function() {}\n\n});\n\nmodule.exports = Service;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Service = require('../Service');\n\n/**\n * A service used to retrieve the window object for converting HTML to Markdown and, optionally, to close it upon\n * destruction of the {@link Europa} instance. This can be useful to free up resources as/when required in an artificial\n * browser environment.\n *\n * @public\n * @class\n * @extends Service\n */\nvar WindowService = Service.extend({\n\n /**\n * Closes the specified window
but only if this {@link WindowService} is closeable.\n *\n * @param {Window} window - the window to be closed\n * @return {void}\n * @public\n * @memberof WindowService#\n */\n closeWindow: function(window) {\n if (this.isCloseable(window)) {\n window.close();\n }\n },\n\n /**\n * Returns the default base URI for windows provided by this {@link WindowService}.\n *\n * Implementations of {@link WindowService} must override this method with their own specific logic.\n *\n * @return {string} The default base URI.\n * @public\n * @abstract\n * @memberof WindowService#\n */\n getDefaultBaseUri: function() {},\n\n /**\n * @override\n */\n getName: function() {\n return 'window';\n },\n\n /**\n * Returns a window to be used for converting HTML to Markdown using the base URI provided.\n *\n * It's important to note that the base URI cannot be changed in some environments, in which case baseUri
\n * will be ignored.\n *\n * Implementations of {@link WindowService} must override this method with their own specific logic.\n *\n * @param {string} baseUri - the base URI to be used\n * @return {Window} The window.\n * @public\n * @abstract\n * @memberof WindowService#\n */\n getWindow: function(baseUri) {},\n\n /**\n * Returns whether the specified window
which was retrieved by this {@link WindowService} is closeable.\n *\n * The default implementation of this method will always return false
.\n *\n * @param {Window} window - the window to be checked\n * @return {boolean} true
if window
is closeable; otherwise false
.\n * @public\n * @memberof WindowService#\n */\n isCloseable: function(window) {\n return false;\n }\n\n});\n\nmodule.exports = WindowService;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar WindowService = require('europa-core/src/service/window/WindowService');\n\n/**\n * An implementation of {@link WindowService} intended for use within a browser environment.\n *\n * @public\n * @class\n * @extends WindowService\n */\nvar BrowserWindowService = WindowService.extend({\n\n /**\n * @override\n */\n getDefaultBaseUri: function() {\n return window.document.baseURI;\n },\n\n /**\n * @override\n */\n getWindow: function(baseUri) {\n return window;\n }\n\n});\n\nmodule.exports = BrowserWindowService;\n","/*\n * Copyright (C) 2017 Alasdair Mercer, !ninja\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\n'use strict';\n\nvar Europa = require('europa-core');\n\nvar BrowserWindowService = require('./service/window/BrowserWindowService');\n\nEuropa.use(new BrowserWindowService());\n\nmodule.exports = Europa;\n"],"names":["createObject","prototype","properties","result","Object","create","Constructor","extendObject","extend","name","constructor","statics","superConstructor","this","apply","arguments","class_","super_","own","target","sources","property","source","i","length","slice","call","hasOwnProperty","Nevis","Array","Utilities","forOwn","object","callback","context","key","hasOwn","leftPad","string","times","padding","Conversion","europa","options","atLeft","atNoWhiteSpace","atParagraph","buffer","inCodeBlock","inOrderedList","inPreformattedBlock","last","left","listDepth","listIndex","_document","document","_element","_tagName","_window","window","append","appendParagraph","output","clean","replace","replacements","value","replacementsRegExp","test","replaceLeft","\\\\","\\[","\\]",">","_","\\*","`","#","([0-9])\\.(\\s|$)","©","®","™"," ","·"," "," "," ","‘","’","“","”","…","–","—","defineProperties","get","element","set","tagName","toLowerCase","RegExp","isVisible","style","getComputedStyle","getPropertyValue","Option","defaultValue","_defaultValue","defineProperty","exists","some","option","parse","forEach","after","conversion","afterAll","before","beforeAll","convert","getTagNames","plugins","serviceManager","_services","getService","service","Error","setService","Europa","_options","OptionParser","getDefaultBaseUri","html","root","createElement","innerHTML","wrapper","contains","display","appendChild","body","plugin","convertElement","removeChild","trim","convertChildren","nodeType","Node","ELEMENT_NODE","DOMUtilities","childNodes","TEXT_NODE","nodeValue","release","closeWindow","Plugin","register","tag","use","getName","getWindow","baseUri","AnchorPlugin","anchors","anchorMap","href","absolute","getAttribute","index","title","inline","push","BlockQuotePlugin","previousLeft","BreakPlugin","CodePlugin","skipped","previousInCodeBlock","DefinitionTermPlugin","DetailsPlugin","hasAttribute","summary","querySelector","EmphasisPlugin","EmptyPlugin","FramePlugin","previousWindow","contentWindow","HeadingPlugin","level","parseInt","match","heading","HorizontalRulePlugin","ImagePlugin","images","imageMap","src","alternativeText","ListItemPlugin","OrderedListPlugin","previousInOrderedList","previousListIndex","ParagraphPlugin","PreformattedPlugin","previousInPreformattedBlock","QuotePlugin","StrongPlugin","UnorderedListPlugin","isCloseable","close","baseURI","BrowserWindowService"],"mappings":";kLAwDA,SAASA,EAAaC,EAAWC,GAC/B,IAAIC,EAcJ,MAZ6B,mBAAlBC,OAAOC,OAChBF,EAASC,OAAOC,OAAOJ,IAEvBK,EAAYL,UAAYA,EACxBE,EAAS,IAAIG,EACbA,EAAYL,UAAY,MAGtBC,GACFK,GAAa,EAAMJ,EAAQD,GAGtBC,EAwBT,SAASK,EAAOC,EAAMC,EAAaT,EAAWU,GAC5C,IAAIC,EAAmBC,KAyBvB,MAvBoB,iBAATJ,IACTE,EAAUV,EACVA,EAAYS,EACZA,EAAcD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