mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
showdown.helper.event refactored to showdown.Event
This commit is contained in:
parent
480e4c0a95
commit
fdf3faa400
|
@ -33,6 +33,7 @@ module.exports = function (grunt) {
|
|||
'src/options.js',
|
||||
'src/showdown.js',
|
||||
'src/helpers.js',
|
||||
'src/event.js',
|
||||
'src/subParsers/makehtml/*.js',
|
||||
'src/subParsers/makemarkdown/*.js',
|
||||
'src/converter.js',
|
||||
|
|
|
@ -214,12 +214,12 @@ showdown.Converter = function (converterOptions) {
|
|||
|
||||
/**
|
||||
*
|
||||
* @param {showdown.helper.Event} event
|
||||
* @returns showdown.helper.Event
|
||||
* @param {showdown.Event} event
|
||||
* @returns showdown.Event
|
||||
*/
|
||||
this.dispatch = function (event) {
|
||||
if (!(event instanceof showdown.helper.Event)) {
|
||||
throw new TypeError('dispatch only accepts showdown.helper.Event objects as param, but ' + typeof event + ' given');
|
||||
if (!(event instanceof showdown.Event)) {
|
||||
throw new TypeError('dispatch only accepts showdown.Event objects as param, but ' + typeof event + ' given');
|
||||
}
|
||||
event.converter = this;
|
||||
if (listeners.hasOwnProperty(event.name)) {
|
||||
|
@ -228,7 +228,7 @@ showdown.Converter = function (converterOptions) {
|
|||
if (showdown.helper.isString(listRet)) {
|
||||
event.output = listRet;
|
||||
event.input = listRet;
|
||||
} else if (listRet instanceof showdown.helper.Event && listRet.name === event.name) {
|
||||
} else if (listRet instanceof showdown.Event && listRet.name === event.name) {
|
||||
event = listRet;
|
||||
}
|
||||
}
|
||||
|
@ -243,7 +243,7 @@ showdown.Converter = function (converterOptions) {
|
|||
* @param {{}} options Converter Options
|
||||
* @param {{}} globals Converter globals
|
||||
* @param {{}} [pParams] extra params for event
|
||||
* @returns showdown.helper.Event
|
||||
* @returns showdown.Event
|
||||
* @private
|
||||
*/
|
||||
this._dispatch = function dispatch (evtName, text, options, globals, pParams) {
|
||||
|
@ -254,7 +254,7 @@ showdown.Converter = function (converterOptions) {
|
|||
params.input = text;
|
||||
params.options = options;
|
||||
params.globals = globals;
|
||||
var event = new showdown.helper.Event(evtName, text, params);
|
||||
var event = new showdown.Event(evtName, text, params);
|
||||
|
||||
if (listeners.hasOwnProperty(evtName)) {
|
||||
for (var ei = 0; ei < listeners[evtName].length; ++ei) {
|
||||
|
|
228
src/event.js
Normal file
228
src/event.js
Normal file
|
@ -0,0 +1,228 @@
|
|||
/**
|
||||
* Created by Estevao on 31-05-2015.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {showdown.Event}
|
||||
*/
|
||||
showdown.Event = class {
|
||||
|
||||
/**
|
||||
* Creates a new showdown Event object
|
||||
* @param {string} name
|
||||
* @param {string} input
|
||||
* @param {{}} [params]
|
||||
* @param {string} params.output
|
||||
* @param {RegExp} params.regexp
|
||||
* @param {{}} params.matches
|
||||
* @param {{}} params.attributes
|
||||
* @param {{}} params.globals
|
||||
* @param {{}} params.options
|
||||
* @param {showdown.Converter} params.converter
|
||||
*/
|
||||
constructor (name, input, params) {
|
||||
params = params || {};
|
||||
let {output, regexp, matches, attributes, globals, options, converter} = params;
|
||||
if (!showdown.helper.isString(name)) {
|
||||
if (!showdown.helper.isString(name)) {
|
||||
throw new TypeError('Event.name must be a string but ' + typeof name + ' given');
|
||||
}
|
||||
}
|
||||
this._name = name.toLowerCase();
|
||||
this.input = input;
|
||||
this.output = output || input;
|
||||
this.regexp = regexp || null;
|
||||
this.matches = matches || {};
|
||||
this.attributes = attributes || {};
|
||||
this._globals = globals || {};
|
||||
this._options = showdown.helper.cloneObject(options, true) || {};
|
||||
this._converter = converter || undefined;
|
||||
}
|
||||
|
||||
/** @returns {string} */
|
||||
get name () {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
/** @returns {string} */
|
||||
get input () {
|
||||
return this._input;
|
||||
}
|
||||
|
||||
/** @param {string} value */
|
||||
set input (value) {
|
||||
if (!showdown.helper.isString(value)) {
|
||||
throw new TypeError('Event.input must be a string but ' + typeof value + ' given');
|
||||
}
|
||||
this._input = value;
|
||||
}
|
||||
|
||||
/** @returns {string} */
|
||||
get output () {
|
||||
return this._output;
|
||||
}
|
||||
|
||||
/** @param {string|null} value */
|
||||
set output (value) {
|
||||
if (!showdown.helper.isString(value) && value !== null) {
|
||||
throw new TypeError('Event.output must be a string but ' + typeof value + ' given');
|
||||
}
|
||||
this._output = value;
|
||||
}
|
||||
|
||||
/** @returns {null|RegExp} */
|
||||
get regexp () {
|
||||
return this._regexp;
|
||||
}
|
||||
|
||||
/** @param {null|RegExp} value */
|
||||
set regexp (value) {
|
||||
if (!(value instanceof RegExp) && value !== null) {
|
||||
throw new TypeError('Event.regexp must be a RegExp object (or null) but ' + typeof value + ' given');
|
||||
}
|
||||
this._regexp = value;
|
||||
}
|
||||
|
||||
/** @returns {{}} */
|
||||
get matches () {
|
||||
return this._matches;
|
||||
}
|
||||
|
||||
/** @param {{}}value */
|
||||
set matches (value) {
|
||||
if (typeof value !== 'object') {
|
||||
throw new TypeError('Event.matches must be an object (or null) but ' + typeof value + ' given');
|
||||
}
|
||||
this._matches = {};
|
||||
for (let prop in value) {
|
||||
if (value.hasOwnProperty(prop)) {
|
||||
let descriptor = {};
|
||||
if (/^_(.+)/.test(prop)) {
|
||||
descriptor = {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
writable: false,
|
||||
value: value[prop]
|
||||
};
|
||||
} else {
|
||||
descriptor = {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
writable: true,
|
||||
value: value[prop]
|
||||
};
|
||||
}
|
||||
Object.defineProperty(this._matches, prop, descriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** @returns {{}} */
|
||||
get attributes () {
|
||||
return this._attributes;
|
||||
}
|
||||
|
||||
/** @param {{}} value */
|
||||
set attributes (value) {
|
||||
if (typeof value !== 'object') {
|
||||
throw new TypeError('Event.attributes must be an object (or null) but ' + typeof value + ' given');
|
||||
}
|
||||
this._attributes = value;
|
||||
}
|
||||
|
||||
/** @param {showdown.Converter} converter */
|
||||
set converter (converter) {
|
||||
this._converter = converter;
|
||||
}
|
||||
|
||||
/** @returns {showdown.Converter} */
|
||||
get converter () {
|
||||
return this._converter;
|
||||
}
|
||||
|
||||
get options () {
|
||||
return this._options;
|
||||
}
|
||||
|
||||
get globals () {
|
||||
return this._globals;
|
||||
}
|
||||
// FLUID INTERFACE
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} value
|
||||
* @returns {showdown.Event}
|
||||
*/
|
||||
setInput (value) {
|
||||
this.input = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string|null} value
|
||||
* @returns {showdown.Event}
|
||||
*/
|
||||
setOutput (value) {
|
||||
this.output = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {RegExp} value
|
||||
* @returns {showdown.Event}
|
||||
*/
|
||||
setRegexp (value) {
|
||||
this.regexp = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {{}}value
|
||||
* @returns {showdown.Event}
|
||||
*/
|
||||
setMatches (value) {
|
||||
this.matches = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {{}}value
|
||||
* @returns {showdown.Event}
|
||||
*/
|
||||
setAttributes (value) {
|
||||
this.attributes = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
_setOptions (value) {
|
||||
this._options = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
_setGlobals (value) {
|
||||
this._globals = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
_setConverter (value) {
|
||||
this.converter = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy: Return the output text
|
||||
* @returns {string}
|
||||
*/
|
||||
getText () {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
getMatches () {
|
||||
return this.matches;
|
||||
}
|
||||
};
|
234
src/helpers.js
234
src/helpers.js
|
@ -57,7 +57,15 @@ showdown.helper.isFunction = function (a) {
|
|||
*/
|
||||
showdown.helper.isArray = function (a) {
|
||||
'use strict';
|
||||
return Array.isArray(a);
|
||||
let isArray;
|
||||
if (!Array.isArray) {
|
||||
isArray = function (arg) {
|
||||
return Object.prototype.toString.call(arg) === '[object Array]';
|
||||
};
|
||||
} else {
|
||||
isArray = Array.isArray;
|
||||
}
|
||||
return isArray(a);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -125,7 +133,7 @@ showdown.helper.forEach = function (obj, callback) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Standardidize extension name
|
||||
* Standardize extension name
|
||||
* @static
|
||||
* @param {string} s extension name
|
||||
* @returns {string}
|
||||
|
@ -718,228 +726,6 @@ showdown.helper.validateOptions = function (options) {
|
|||
return options;
|
||||
};
|
||||
|
||||
showdown.helper.Event = class {
|
||||
|
||||
/**
|
||||
* Creates a new event object
|
||||
* @param {string} name
|
||||
* @param {string} input
|
||||
* @param {{}} [params]
|
||||
* @param {string} params.output
|
||||
* @param {RegExp} params.regexp
|
||||
* @param {{}} params.matches
|
||||
* @param {{}} params.attributes
|
||||
* @param {{}} params.globals
|
||||
* @param {{}} params.options
|
||||
* @param {showdown.Converter} params.converter
|
||||
*/
|
||||
constructor (name, input, params) {
|
||||
params = params || {};
|
||||
let {output, regexp, matches, attributes, globals, options, converter} = params;
|
||||
if (!showdown.helper.isString(name)) {
|
||||
if (!showdown.helper.isString(name)) {
|
||||
throw new TypeError('Event.name must be a string but ' + typeof name + ' given');
|
||||
}
|
||||
}
|
||||
this._name = name.toLowerCase();
|
||||
this.input = input;
|
||||
this.output = output || input;
|
||||
this.regexp = regexp || null;
|
||||
this.matches = matches || {};
|
||||
this.attributes = attributes || {};
|
||||
this._globals = globals || {};
|
||||
this._options = showdown.helper.cloneObject(options, true) || {};
|
||||
this._converter = converter || undefined;
|
||||
}
|
||||
|
||||
/** @returns {string} */
|
||||
get name () {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
/** @returns {string} */
|
||||
get input () {
|
||||
return this._input;
|
||||
}
|
||||
|
||||
/** @param {string} value */
|
||||
set input (value) {
|
||||
if (!showdown.helper.isString(value)) {
|
||||
throw new TypeError('Event.input must be a string but ' + typeof value + ' given');
|
||||
}
|
||||
this._input = value;
|
||||
}
|
||||
|
||||
/** @returns {string} */
|
||||
get output () {
|
||||
return this._output;
|
||||
}
|
||||
|
||||
/** @param {string|null} value */
|
||||
set output (value) {
|
||||
if (!showdown.helper.isString(value) && value !== null) {
|
||||
throw new TypeError('Event.output must be a string but ' + typeof value + ' given');
|
||||
}
|
||||
this._output = value;
|
||||
}
|
||||
|
||||
/** @returns {null|RegExp} */
|
||||
get regexp () {
|
||||
return this._regexp;
|
||||
}
|
||||
|
||||
/** @param {null|RegExp} value */
|
||||
set regexp (value) {
|
||||
if (!(value instanceof RegExp) && value !== null) {
|
||||
throw new TypeError('Event.regexp must be a RegExp object (or null) but ' + typeof value + ' given');
|
||||
}
|
||||
this._regexp = value;
|
||||
}
|
||||
|
||||
/** @returns {{}} */
|
||||
get matches () {
|
||||
return this._matches;
|
||||
}
|
||||
|
||||
/** @param {{}}value */
|
||||
set matches (value) {
|
||||
if (typeof value !== 'object') {
|
||||
throw new TypeError('Event.matches must be an object (or null) but ' + typeof value + ' given');
|
||||
}
|
||||
this._matches = {};
|
||||
for (let prop in value) {
|
||||
if (value.hasOwnProperty(prop)) {
|
||||
let descriptor = {};
|
||||
if (/^_(.+)/.test(prop)) {
|
||||
descriptor = {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
writable: false,
|
||||
value: value[prop]
|
||||
};
|
||||
} else {
|
||||
descriptor = {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
writable: true,
|
||||
value: value[prop]
|
||||
};
|
||||
}
|
||||
Object.defineProperty(this._matches, prop, descriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** @returns {{}} */
|
||||
get attributes () {
|
||||
return this._attributes;
|
||||
}
|
||||
|
||||
/** @param {{}} value */
|
||||
set attributes (value) {
|
||||
if (typeof value !== 'object') {
|
||||
throw new TypeError('Event.attributes must be an object (or null) but ' + typeof value + ' given');
|
||||
}
|
||||
this._attributes = value;
|
||||
}
|
||||
|
||||
/** @param {showdown.Converter} converter */
|
||||
set converter (converter) {
|
||||
this._converter = converter;
|
||||
}
|
||||
|
||||
/** @returns {showdown.Converter} */
|
||||
get converter () {
|
||||
return this._converter;
|
||||
}
|
||||
|
||||
get options () {
|
||||
return this._options;
|
||||
}
|
||||
|
||||
get globals () {
|
||||
return this._globals;
|
||||
}
|
||||
// FLUID INTERFACE
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} value
|
||||
* @returns {showdown.helper.Event}
|
||||
*/
|
||||
setInput (value) {
|
||||
this.input = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string|null} value
|
||||
* @returns {showdown.helper.Event}
|
||||
*/
|
||||
setOutput (value) {
|
||||
this.output = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {RegExp} value
|
||||
* @returns {showdown.helper.Event}
|
||||
*/
|
||||
setRegexp (value) {
|
||||
this.regexp = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {{}}value
|
||||
* @returns {showdown.helper.Event}
|
||||
*/
|
||||
setMatches (value) {
|
||||
this.matches = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {{}}value
|
||||
* @returns {showdown.helper.Event}
|
||||
*/
|
||||
setAttributes (value) {
|
||||
this.attributes = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
_setOptions (value) {
|
||||
this._options = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
_setGlobals (value) {
|
||||
this._globals = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
_setConverter (value) {
|
||||
this.converter = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy: Return the output text
|
||||
* @returns {string}
|
||||
*/
|
||||
getText () {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
getMatches () {
|
||||
return this.matches;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* POLYFILLS
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
showdown.subParser('makehtml.blockGamut', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.blockGamut.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.blockGamut.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -40,7 +40,7 @@ showdown.subParser('makehtml.blockGamut', function (text, options, globals) {
|
|||
text = showdown.subParser('makehtml.hashHTMLBlocks')(text, options, globals);
|
||||
text = showdown.subParser('makehtml.paragraphs')(text, options, globals);
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.blockGamut.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.blockGamut.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
showdown.subParser('makehtml.blockquote', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.blockquote.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.blockquote.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -44,7 +44,7 @@ showdown.subParser('makehtml.blockquote', function (text, options, globals) {
|
|||
bq = bq.replace(/¨0/g, '');
|
||||
bq = bq.replace(/^[ \t]+$/gm, ''); // trim whitespace-only lines
|
||||
|
||||
let captureStartEvent = new showdown.helper.Event('makehtml.blockquote.onCapture', bq);
|
||||
let captureStartEvent = new showdown.Event('makehtml.blockquote.onCapture', bq);
|
||||
captureStartEvent
|
||||
.setOutput(null)
|
||||
._setGlobals(globals)
|
||||
|
@ -74,7 +74,7 @@ showdown.subParser('makehtml.blockquote', function (text, options, globals) {
|
|||
otp = '<blockquote' + showdown.helper._populateAttributes(attributes) + '>\n' + bq + '\n</blockquote>';
|
||||
}
|
||||
|
||||
let beforeHashEvent = new showdown.helper.Event('makehtml.blockquote.onHash', otp);
|
||||
let beforeHashEvent = new showdown.Event('makehtml.blockquote.onHash', otp);
|
||||
beforeHashEvent
|
||||
.setOutput(otp)
|
||||
._setGlobals(globals)
|
||||
|
@ -84,7 +84,7 @@ showdown.subParser('makehtml.blockquote', function (text, options, globals) {
|
|||
return showdown.subParser('makehtml.hashBlock')(otp, options, globals);
|
||||
});
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.blockquote.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.blockquote.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
showdown.subParser('makehtml.codeBlock', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.codeBlock.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.codeBlock.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -34,7 +34,7 @@ showdown.subParser('makehtml.codeBlock', function (text, options, globals) {
|
|||
code: {}
|
||||
};
|
||||
|
||||
let captureStartEvent = new showdown.helper.Event('makehtml.codeBlock.onCapture', codeblock);
|
||||
let captureStartEvent = new showdown.Event('makehtml.codeBlock.onCapture', codeblock);
|
||||
captureStartEvent
|
||||
.setOutput(null)
|
||||
._setGlobals(globals)
|
||||
|
@ -71,7 +71,7 @@ showdown.subParser('makehtml.codeBlock', function (text, options, globals) {
|
|||
otp += codeblock + end + '</code></pre>';
|
||||
}
|
||||
|
||||
let beforeHashEvent = new showdown.helper.Event('makehtml.codeBlock.onHash', otp);
|
||||
let beforeHashEvent = new showdown.Event('makehtml.codeBlock.onHash', otp);
|
||||
beforeHashEvent
|
||||
.setOutput(otp)
|
||||
._setGlobals(globals)
|
||||
|
@ -85,7 +85,7 @@ showdown.subParser('makehtml.codeBlock', function (text, options, globals) {
|
|||
// strip sentinel
|
||||
text = text.replace(/¨0/, '');
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.codeBlock.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.codeBlock.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
showdown.subParser('makehtml.codeSpan', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.codeSpan.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.codeSpan.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -56,7 +56,7 @@ showdown.subParser('makehtml.codeSpan', function (text, options, globals) {
|
|||
c = c.replace(/^([ \t]*)/g, ''); // leading whitespace
|
||||
c = c.replace(/[ \t]*$/g, ''); // trailing whitespace
|
||||
|
||||
let captureStartEvent = new showdown.helper.Event('makehtml.codeSpan.onCapture', c);
|
||||
let captureStartEvent = new showdown.Event('makehtml.codeSpan.onCapture', c);
|
||||
captureStartEvent
|
||||
.setOutput(null)
|
||||
._setGlobals(globals)
|
||||
|
@ -79,7 +79,7 @@ showdown.subParser('makehtml.codeSpan', function (text, options, globals) {
|
|||
otp = m1 + '<code' + showdown.helper._populateAttributes(attributes) + '>' + c + '</code>';
|
||||
}
|
||||
|
||||
let beforeHashEvent = new showdown.helper.Event('makehtml.codeSpan.onHash', otp);
|
||||
let beforeHashEvent = new showdown.Event('makehtml.codeSpan.onHash', otp);
|
||||
beforeHashEvent
|
||||
.setOutput(otp)
|
||||
._setGlobals(globals)
|
||||
|
@ -91,7 +91,7 @@ showdown.subParser('makehtml.codeSpan', function (text, options, globals) {
|
|||
}
|
||||
);
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.codeSpan.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.codeSpan.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -16,7 +16,7 @@ showdown.subParser('makehtml.completeHTMLDocument', function (text, options, glo
|
|||
return text;
|
||||
}
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.completeHTMLDocument.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.completeHTMLDocument.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -71,7 +71,7 @@ showdown.subParser('makehtml.completeHTMLDocument', function (text, options, glo
|
|||
|
||||
text = doctypeParsed + '<html' + lang + '>\n<head>\n' + title + charset + metadata + '</head>\n<body>\n' + text.trim() + '\n</body>\n</html>';
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.completeHTMLDocument.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.completeHTMLDocument.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
showdown.subParser('makehtml.detab', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.detab.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.detab.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -43,7 +43,7 @@ showdown.subParser('makehtml.detab', function (text, options, globals) {
|
|||
text = text.replace(/¨A/g, ' '); // g_tab_width
|
||||
text = text.replace(/¨B/g, '');
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.detab.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.detab.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -16,7 +16,7 @@ showdown.subParser('makehtml.ellipsis', function (text, options, globals) {
|
|||
return text;
|
||||
}
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.ellipsis.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.ellipsis.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -26,7 +26,7 @@ showdown.subParser('makehtml.ellipsis', function (text, options, globals) {
|
|||
|
||||
text = text.replace(/\.\.\./g, '…');
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.ellipsis.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.ellipsis.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -17,7 +17,7 @@ showdown.subParser('makehtml.emoji', function (text, options, globals) {
|
|||
return text;
|
||||
}
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.emoji.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.emoji.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -29,7 +29,7 @@ showdown.subParser('makehtml.emoji', function (text, options, globals) {
|
|||
|
||||
text = text.replace(pattern, function (wholeMatch, emojiCode) {
|
||||
let otp = '';
|
||||
let captureStartEvent = new showdown.helper.Event('makehtml.emoji.onCapture', emojiCode);
|
||||
let captureStartEvent = new showdown.Event('makehtml.emoji.onCapture', emojiCode);
|
||||
captureStartEvent
|
||||
.setOutput(null)
|
||||
._setGlobals(globals)
|
||||
|
@ -51,7 +51,7 @@ showdown.subParser('makehtml.emoji', function (text, options, globals) {
|
|||
otp = wm;
|
||||
}
|
||||
|
||||
let beforeHashEvent = new showdown.helper.Event('makehtml.emoji.onHash', otp);
|
||||
let beforeHashEvent = new showdown.Event('makehtml.emoji.onHash', otp);
|
||||
beforeHashEvent
|
||||
.setOutput(otp)
|
||||
._setGlobals(globals)
|
||||
|
@ -61,7 +61,7 @@ showdown.subParser('makehtml.emoji', function (text, options, globals) {
|
|||
return beforeHashEvent.output;
|
||||
});
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.emoji.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.emoji.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
showdown.subParser('makehtml.emphasisAndStrong', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.emphasisAndStrong.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.emphasisAndStrong.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -61,7 +61,7 @@ showdown.subParser('makehtml.emphasisAndStrong', function (text, options, global
|
|||
break;
|
||||
}
|
||||
|
||||
let captureStartEvent = new showdown.helper.Event('makehtml.' + subEventName + '.onCapture', txt);
|
||||
let captureStartEvent = new showdown.Event('makehtml.' + subEventName + '.onCapture', txt);
|
||||
captureStartEvent
|
||||
.setOutput(null)
|
||||
._setGlobals(globals)
|
||||
|
@ -102,7 +102,7 @@ showdown.subParser('makehtml.emphasisAndStrong', function (text, options, global
|
|||
}
|
||||
}
|
||||
|
||||
let beforeHashEvent = new showdown.helper.Event('makehtml.' + subEventName + '.onHash', otp);
|
||||
let beforeHashEvent = new showdown.Event('makehtml.' + subEventName + '.onHash', otp);
|
||||
beforeHashEvent
|
||||
.setOutput(otp)
|
||||
._setGlobals(globals)
|
||||
|
@ -163,7 +163,7 @@ showdown.subParser('makehtml.emphasisAndStrong', function (text, options, global
|
|||
return (/\S$/.test(m)) ? parseInside (m, '<em>', wm, asteriskEm) : wm;
|
||||
});
|
||||
//}
|
||||
let afterEvent = new showdown.helper.Event('makehtml.emphasisAndStrong.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.emphasisAndStrong.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
showdown.subParser('makehtml.encodeAmpsAndAngles', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.encodeAmpsAndAngles.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.encodeAmpsAndAngles.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -33,7 +33,7 @@ showdown.subParser('makehtml.encodeAmpsAndAngles', function (text, options, glob
|
|||
// Encode >
|
||||
text = text.replace(/>/g, '>');
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.encodeAmpsAndAngles.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.encodeAmpsAndAngles.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
showdown.subParser('makehtml.encodeBackslashEscapes', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.encodeBackslashEscapes.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.encodeBackslashEscapes.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -32,7 +32,7 @@ showdown.subParser('makehtml.encodeBackslashEscapes', function (text, options, g
|
|||
text = text.replace(/\\(\\)/g, showdown.helper.escapeCharactersCallback);
|
||||
text = text.replace(/\\([`*_{}\[\]()>#+.!~=|:-])/g, showdown.helper.escapeCharactersCallback);
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.encodeBackslashEscapes.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.encodeBackslashEscapes.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
showdown.subParser('makehtml.encodeCode', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.encodeCode.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.encodeCode.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -32,7 +32,7 @@ showdown.subParser('makehtml.encodeCode', function (text, options, globals) {
|
|||
// Now, escape characters that are magic in Markdown:
|
||||
.replace(/([*_{}\[\]\\=~-])/g, showdown.helper.escapeCharactersCallback);
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.encodeCode.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.encodeCode.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
showdown.subParser('makehtml.escapeSpecialCharsWithinTagAttributes', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.escapeSpecialCharsWithinTagAttributes.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.escapeSpecialCharsWithinTagAttributes.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -36,7 +36,7 @@ showdown.subParser('makehtml.escapeSpecialCharsWithinTagAttributes', function (t
|
|||
.replace(/([\\`*_~=|])/g, showdown.helper.escapeCharactersCallback);
|
||||
});
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.escapeSpecialCharsWithinTagAttributes.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.escapeSpecialCharsWithinTagAttributes.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -24,7 +24,7 @@ showdown.subParser('makehtml.githubCodeBlock', function (text, options, globals)
|
|||
return text;
|
||||
}
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.githubCodeBlock.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.githubCodeBlock.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -42,7 +42,7 @@ showdown.subParser('makehtml.githubCodeBlock', function (text, options, globals)
|
|||
code: {},
|
||||
};
|
||||
|
||||
let captureStartEvent = new showdown.helper.Event('makehtml.githubCodeBlock.onCapture', codeblock);
|
||||
let captureStartEvent = new showdown.Event('makehtml.githubCodeBlock.onCapture', codeblock);
|
||||
captureStartEvent
|
||||
.setOutput(null)
|
||||
._setGlobals(globals)
|
||||
|
@ -106,7 +106,7 @@ showdown.subParser('makehtml.githubCodeBlock', function (text, options, globals)
|
|||
otp += codeblock + end + '</code></pre>';
|
||||
}
|
||||
|
||||
let beforeHashEvent = new showdown.helper.Event('makehtml.githubCodeBlock.onHash', otp);
|
||||
let beforeHashEvent = new showdown.Event('makehtml.githubCodeBlock.onHash', otp);
|
||||
beforeHashEvent
|
||||
.setOutput(otp)
|
||||
._setGlobals(globals)
|
||||
|
@ -124,7 +124,7 @@ showdown.subParser('makehtml.githubCodeBlock', function (text, options, globals)
|
|||
// attacklab: strip sentinel
|
||||
text = text.replace(/¨0/, '');
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.githubCodeBlock.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.githubCodeBlock.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
showdown.subParser('makehtml.hashBlock', function (text, options, globals) {
|
||||
'use strict';
|
||||
let startEvent = new showdown.helper.Event('makehtml.hashBlock.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.hashBlock.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -21,7 +21,7 @@ showdown.subParser('makehtml.hashBlock', function (text, options, globals) {
|
|||
text = text.replace(/(^\n+|\n+$)/g, '');
|
||||
text = '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n';
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.hashBlock.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.hashBlock.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
showdown.subParser('makehtml.hashCodeTags', function (text, options, globals) {
|
||||
'use strict';
|
||||
let startEvent = new showdown.helper.Event('makehtml.hashCodeTags.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.hashCodeTags.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -27,7 +27,7 @@ showdown.subParser('makehtml.hashCodeTags', function (text, options, globals) {
|
|||
// Hash naked <code>
|
||||
text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '<code\\b[^>]*>', '</code>', 'gim');
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.hashCodeTags.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.hashCodeTags.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
showdown.subParser('makehtml.hashHTMLBlocks', function (text, options, globals) {
|
||||
'use strict';
|
||||
let startEvent = new showdown.helper.Event('makehtml.hashHTMLBlocks.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.hashHTMLBlocks.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -111,7 +111,7 @@ showdown.subParser('makehtml.hashHTMLBlocks', function (text, options, globals)
|
|||
text = text.replace(/\n\n( {0,3}<([?%])[^\r]*?\2>[ \t]*(?=\n{2,}))/g,
|
||||
showdown.subParser('makehtml.hashElement')(text, options, globals));
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.hashHTMLBlocks.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.hashHTMLBlocks.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
showdown.subParser('makehtml.hashHTMLSpans', function (text, options, globals) {
|
||||
'use strict';
|
||||
let startEvent = new showdown.helper.Event('makehtml.hashHTMLSpans.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.hashHTMLSpans.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -39,7 +39,7 @@ showdown.subParser('makehtml.hashHTMLSpans', function (text, options, globals) {
|
|||
return showdown.helper._hashHTMLSpan(wm, globals);
|
||||
});
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.hashHTMLSpans.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.hashHTMLSpans.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
showdown.subParser('makehtml.hashPreCodeTags', function (text, options, globals) {
|
||||
'use strict';
|
||||
let startEvent = new showdown.helper.Event('makehtml.hashHTMLBlocks.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.hashHTMLBlocks.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -28,7 +28,7 @@ showdown.subParser('makehtml.hashPreCodeTags', function (text, options, globals)
|
|||
// Hash <pre><code>
|
||||
text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>', '^ {0,3}</code>\\s*</pre>', 'gim');
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.hashPreCodeTags.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.hashPreCodeTags.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -26,7 +26,7 @@ showdown.subParser('makehtml.heading', function (text, options, globals) {
|
|||
'use strict';
|
||||
|
||||
function parseHeader (pattern, wholeMatch, headingText, headingLevel, headingId) {
|
||||
let captureStartEvent = new showdown.helper.Event('makehtml.heading.onCapture', headingText),
|
||||
let captureStartEvent = new showdown.Event('makehtml.heading.onCapture', headingText),
|
||||
otp;
|
||||
|
||||
captureStartEvent
|
||||
|
@ -54,7 +54,7 @@ showdown.subParser('makehtml.heading', function (text, options, globals) {
|
|||
otp = '<h' + headingLevel + showdown.helper._populateAttributes(attributes) + '>' + spanGamut + '</h' + headingLevel + '>';
|
||||
}
|
||||
|
||||
let beforeHashEvent = new showdown.helper.Event('makehtml.heading.onHash', otp);
|
||||
let beforeHashEvent = new showdown.Event('makehtml.heading.onHash', otp);
|
||||
beforeHashEvent
|
||||
.setOutput(otp)
|
||||
._setGlobals(globals)
|
||||
|
@ -65,7 +65,7 @@ showdown.subParser('makehtml.heading', function (text, options, globals) {
|
|||
return showdown.subParser('makehtml.hashBlock')(otp, options, globals);
|
||||
}
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.heading.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.heading.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -95,7 +95,7 @@ showdown.subParser('makehtml.heading', function (text, options, globals) {
|
|||
});
|
||||
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.heading.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.heading.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
////
|
||||
showdown.subParser('makehtml.horizontalRule', function (text, options, globals) {
|
||||
'use strict';
|
||||
let startEvent = new showdown.helper.Event('makehtml.horizontalRule.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.horizontalRule.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -25,7 +25,7 @@ showdown.subParser('makehtml.horizontalRule', function (text, options, globals)
|
|||
text = text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
|
||||
text = text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.horizontalRule.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.horizontalRule.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -84,7 +84,7 @@ showdown.subParser('makehtml.image', function (text, options, globals) {
|
|||
height = null;
|
||||
}
|
||||
|
||||
let captureStartEvent = new showdown.helper.Event('makehtml.image.onCapture', wholeMatch);
|
||||
let captureStartEvent = new showdown.Event('makehtml.image.onCapture', wholeMatch);
|
||||
captureStartEvent
|
||||
.setOutput(null)
|
||||
._setGlobals(globals)
|
||||
|
@ -109,7 +109,7 @@ showdown.subParser('makehtml.image', function (text, options, globals) {
|
|||
otp = '<img' + showdown.helper._populateAttributes(attributes) + ' />';
|
||||
}
|
||||
|
||||
let beforeHashEvent = new showdown.helper.Event('makehtml.image.onHash', otp);
|
||||
let beforeHashEvent = new showdown.Event('makehtml.image.onHash', otp);
|
||||
beforeHashEvent
|
||||
.setOutput(otp)
|
||||
._setGlobals(globals)
|
||||
|
@ -120,7 +120,7 @@ showdown.subParser('makehtml.image', function (text, options, globals) {
|
|||
return otp;
|
||||
}
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.image.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.image.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -163,7 +163,7 @@ showdown.subParser('makehtml.image', function (text, options, globals) {
|
|||
return writeImageTag (refShortcutRegExp, wholeMatch, altText, '', '');
|
||||
});
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.image.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.image.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
* @param {String} title
|
||||
* @param {{}} options
|
||||
* @param {{}} globals
|
||||
* @returns {showdown.helper.Event|*}
|
||||
* @returns {showdown.Event|*}
|
||||
*/
|
||||
function createEvent (rgx, evtName, wholeMatch, text, id, url, title, options, globals) {
|
||||
return globals.converter._dispatch(evtName, wholeMatch, options, globals, {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
showdown.subParser('makehtml.spanGamut', function (text, options, globals) {
|
||||
'use strict';
|
||||
|
||||
let startEvent = new showdown.helper.Event('makehtml.spanGamut.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.spanGamut.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -51,7 +51,7 @@ showdown.subParser('makehtml.spanGamut', function (text, options, globals) {
|
|||
text = text.replace(/ +\n/g, '<br />\n');
|
||||
}
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.spanGamut.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.spanGamut.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
showdown.subParser('makehtml.unhashHTMLSpans', function (text, options, globals) {
|
||||
'use strict';
|
||||
let startEvent = new showdown.helper.Event('makehtml.unhashHTMLSpans.onStart', text);
|
||||
let startEvent = new showdown.Event('makehtml.unhashHTMLSpans.onStart', text);
|
||||
startEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
@ -36,7 +36,7 @@ showdown.subParser('makehtml.unhashHTMLSpans', function (text, options, globals)
|
|||
text = text.replace('¨C' + i + 'C', repText);
|
||||
}
|
||||
|
||||
let afterEvent = new showdown.helper.Event('makehtml.unhashHTMLSpans.onEnd', text);
|
||||
let afterEvent = new showdown.Event('makehtml.unhashHTMLSpans.onEnd', text);
|
||||
afterEvent
|
||||
.setOutput(text)
|
||||
._setGlobals(globals)
|
||||
|
|
17
test/unit/events.js
Normal file
17
test/unit/events.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* Created by Tivie on 04/03/2022.
|
||||
*/
|
||||
|
||||
describe('showdown.Event', function () {
|
||||
'use strict';
|
||||
let eventList = {
|
||||
|
||||
};
|
||||
describe('event listeners', function () {
|
||||
|
||||
it('should listen to triggered event', function () {
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
});
|
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
* Created by Tivie on 27/01/2017.
|
||||
*/
|
||||
//let showdown = require('../../.build/showdown.js') || require('showdown');
|
||||
|
||||
describe('showdown.options', function () {
|
||||
'use strict';
|
||||
|
|
Loading…
Reference in New Issue
Block a user