Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: blocks.js
[4000] Fix | Delete
codeblock = '<pre><code' + (language ? ' class="' + language + ' language-' + language + '"' : '') + '>' + codeblock + end + '</code></pre>';
[4001] Fix | Delete
[4002] Fix | Delete
codeblock = showdown.subParser('hashBlock')(codeblock, options, globals);
[4003] Fix | Delete
[4004] Fix | Delete
// Since GHCodeblocks can be false positives, we need to
[4005] Fix | Delete
// store the primitive text and the parsed text in a global var,
[4006] Fix | Delete
// and then return a token
[4007] Fix | Delete
return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
[4008] Fix | Delete
});
[4009] Fix | Delete
[4010] Fix | Delete
// attacklab: strip sentinel
[4011] Fix | Delete
text = text.replace(/¨0/, '');
[4012] Fix | Delete
[4013] Fix | Delete
return globals.converter._dispatch('githubCodeBlocks.after', text, options, globals);
[4014] Fix | Delete
});
[4015] Fix | Delete
[4016] Fix | Delete
showdown.subParser('hashBlock', function (text, options, globals) {
[4017] Fix | Delete
'use strict';
[4018] Fix | Delete
text = globals.converter._dispatch('hashBlock.before', text, options, globals);
[4019] Fix | Delete
text = text.replace(/(^\n+|\n+$)/g, '');
[4020] Fix | Delete
text = '\n\n¨K' + (globals.gHtmlBlocks.push(text) - 1) + 'K\n\n';
[4021] Fix | Delete
text = globals.converter._dispatch('hashBlock.after', text, options, globals);
[4022] Fix | Delete
return text;
[4023] Fix | Delete
});
[4024] Fix | Delete
[4025] Fix | Delete
/**
[4026] Fix | Delete
* Hash and escape <code> elements that should not be parsed as markdown
[4027] Fix | Delete
*/
[4028] Fix | Delete
showdown.subParser('hashCodeTags', function (text, options, globals) {
[4029] Fix | Delete
'use strict';
[4030] Fix | Delete
text = globals.converter._dispatch('hashCodeTags.before', text, options, globals);
[4031] Fix | Delete
[4032] Fix | Delete
var repFunc = function (wholeMatch, match, left, right) {
[4033] Fix | Delete
var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right;
[4034] Fix | Delete
return '¨C' + (globals.gHtmlSpans.push(codeblock) - 1) + 'C';
[4035] Fix | Delete
};
[4036] Fix | Delete
[4037] Fix | Delete
// Hash naked <code>
[4038] Fix | Delete
text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '<code\\b[^>]*>', '</code>', 'gim');
[4039] Fix | Delete
[4040] Fix | Delete
text = globals.converter._dispatch('hashCodeTags.after', text, options, globals);
[4041] Fix | Delete
return text;
[4042] Fix | Delete
});
[4043] Fix | Delete
[4044] Fix | Delete
showdown.subParser('hashElement', function (text, options, globals) {
[4045] Fix | Delete
'use strict';
[4046] Fix | Delete
[4047] Fix | Delete
return function (wholeMatch, m1) {
[4048] Fix | Delete
var blockText = m1;
[4049] Fix | Delete
[4050] Fix | Delete
// Undo double lines
[4051] Fix | Delete
blockText = blockText.replace(/\n\n/g, '\n');
[4052] Fix | Delete
blockText = blockText.replace(/^\n/, '');
[4053] Fix | Delete
[4054] Fix | Delete
// strip trailing blank lines
[4055] Fix | Delete
blockText = blockText.replace(/\n+$/g, '');
[4056] Fix | Delete
[4057] Fix | Delete
// Replace the element text with a marker ("¨KxK" where x is its key)
[4058] Fix | Delete
blockText = '\n\n¨K' + (globals.gHtmlBlocks.push(blockText) - 1) + 'K\n\n';
[4059] Fix | Delete
[4060] Fix | Delete
return blockText;
[4061] Fix | Delete
};
[4062] Fix | Delete
});
[4063] Fix | Delete
[4064] Fix | Delete
showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
[4065] Fix | Delete
'use strict';
[4066] Fix | Delete
text = globals.converter._dispatch('hashHTMLBlocks.before', text, options, globals);
[4067] Fix | Delete
[4068] Fix | Delete
var blockTags = [
[4069] Fix | Delete
'pre',
[4070] Fix | Delete
'div',
[4071] Fix | Delete
'h1',
[4072] Fix | Delete
'h2',
[4073] Fix | Delete
'h3',
[4074] Fix | Delete
'h4',
[4075] Fix | Delete
'h5',
[4076] Fix | Delete
'h6',
[4077] Fix | Delete
'blockquote',
[4078] Fix | Delete
'table',
[4079] Fix | Delete
'dl',
[4080] Fix | Delete
'ol',
[4081] Fix | Delete
'ul',
[4082] Fix | Delete
'script',
[4083] Fix | Delete
'noscript',
[4084] Fix | Delete
'form',
[4085] Fix | Delete
'fieldset',
[4086] Fix | Delete
'iframe',
[4087] Fix | Delete
'math',
[4088] Fix | Delete
'style',
[4089] Fix | Delete
'section',
[4090] Fix | Delete
'header',
[4091] Fix | Delete
'footer',
[4092] Fix | Delete
'nav',
[4093] Fix | Delete
'article',
[4094] Fix | Delete
'aside',
[4095] Fix | Delete
'address',
[4096] Fix | Delete
'audio',
[4097] Fix | Delete
'canvas',
[4098] Fix | Delete
'figure',
[4099] Fix | Delete
'hgroup',
[4100] Fix | Delete
'output',
[4101] Fix | Delete
'video',
[4102] Fix | Delete
'p'
[4103] Fix | Delete
],
[4104] Fix | Delete
repFunc = function (wholeMatch, match, left, right) {
[4105] Fix | Delete
var txt = wholeMatch;
[4106] Fix | Delete
// check if this html element is marked as markdown
[4107] Fix | Delete
// if so, it's contents should be parsed as markdown
[4108] Fix | Delete
if (left.search(/\bmarkdown\b/) !== -1) {
[4109] Fix | Delete
txt = left + globals.converter.makeHtml(match) + right;
[4110] Fix | Delete
}
[4111] Fix | Delete
return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
[4112] Fix | Delete
};
[4113] Fix | Delete
[4114] Fix | Delete
if (options.backslashEscapesHTMLTags) {
[4115] Fix | Delete
// encode backslash escaped HTML tags
[4116] Fix | Delete
text = text.replace(/\\<(\/?[^>]+?)>/g, function (wm, inside) {
[4117] Fix | Delete
return '&lt;' + inside + '&gt;';
[4118] Fix | Delete
});
[4119] Fix | Delete
}
[4120] Fix | Delete
[4121] Fix | Delete
// hash HTML Blocks
[4122] Fix | Delete
for (var i = 0; i < blockTags.length; ++i) {
[4123] Fix | Delete
[4124] Fix | Delete
var opTagPos,
[4125] Fix | Delete
rgx1 = new RegExp('^ {0,3}(<' + blockTags[i] + '\\b[^>]*>)', 'im'),
[4126] Fix | Delete
patLeft = '<' + blockTags[i] + '\\b[^>]*>',
[4127] Fix | Delete
patRight = '</' + blockTags[i] + '>';
[4128] Fix | Delete
// 1. Look for the first position of the first opening HTML tag in the text
[4129] Fix | Delete
while ((opTagPos = showdown.helper.regexIndexOf(text, rgx1)) !== -1) {
[4130] Fix | Delete
[4131] Fix | Delete
// if the HTML tag is \ escaped, we need to escape it and break
[4132] Fix | Delete
[4133] Fix | Delete
[4134] Fix | Delete
//2. Split the text in that position
[4135] Fix | Delete
var subTexts = showdown.helper.splitAtIndex(text, opTagPos),
[4136] Fix | Delete
//3. Match recursively
[4137] Fix | Delete
newSubText1 = showdown.helper.replaceRecursiveRegExp(subTexts[1], repFunc, patLeft, patRight, 'im');
[4138] Fix | Delete
[4139] Fix | Delete
// prevent an infinite loop
[4140] Fix | Delete
if (newSubText1 === subTexts[1]) {
[4141] Fix | Delete
break;
[4142] Fix | Delete
}
[4143] Fix | Delete
text = subTexts[0].concat(newSubText1);
[4144] Fix | Delete
}
[4145] Fix | Delete
}
[4146] Fix | Delete
// HR SPECIAL CASE
[4147] Fix | Delete
text = text.replace(/(\n {0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g,
[4148] Fix | Delete
showdown.subParser('hashElement')(text, options, globals));
[4149] Fix | Delete
[4150] Fix | Delete
// Special case for standalone HTML comments
[4151] Fix | Delete
text = showdown.helper.replaceRecursiveRegExp(text, function (txt) {
[4152] Fix | Delete
return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
[4153] Fix | Delete
}, '^ {0,3}<!--', '-->', 'gm');
[4154] Fix | Delete
[4155] Fix | Delete
// PHP and ASP-style processor instructions (<?...?> and <%...%>)
[4156] Fix | Delete
text = text.replace(/(?:\n\n)( {0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g,
[4157] Fix | Delete
showdown.subParser('hashElement')(text, options, globals));
[4158] Fix | Delete
[4159] Fix | Delete
text = globals.converter._dispatch('hashHTMLBlocks.after', text, options, globals);
[4160] Fix | Delete
return text;
[4161] Fix | Delete
});
[4162] Fix | Delete
[4163] Fix | Delete
/**
[4164] Fix | Delete
* Hash span elements that should not be parsed as markdown
[4165] Fix | Delete
*/
[4166] Fix | Delete
showdown.subParser('hashHTMLSpans', function (text, options, globals) {
[4167] Fix | Delete
'use strict';
[4168] Fix | Delete
text = globals.converter._dispatch('hashHTMLSpans.before', text, options, globals);
[4169] Fix | Delete
[4170] Fix | Delete
function hashHTMLSpan (html) {
[4171] Fix | Delete
return '¨C' + (globals.gHtmlSpans.push(html) - 1) + 'C';
[4172] Fix | Delete
}
[4173] Fix | Delete
[4174] Fix | Delete
// Hash Self Closing tags
[4175] Fix | Delete
text = text.replace(/<[^>]+?\/>/gi, function (wm) {
[4176] Fix | Delete
return hashHTMLSpan(wm);
[4177] Fix | Delete
});
[4178] Fix | Delete
[4179] Fix | Delete
// Hash tags without properties
[4180] Fix | Delete
text = text.replace(/<([^>]+?)>[\s\S]*?<\/\1>/g, function (wm) {
[4181] Fix | Delete
return hashHTMLSpan(wm);
[4182] Fix | Delete
});
[4183] Fix | Delete
[4184] Fix | Delete
// Hash tags with properties
[4185] Fix | Delete
text = text.replace(/<([^>]+?)\s[^>]+?>[\s\S]*?<\/\1>/g, function (wm) {
[4186] Fix | Delete
return hashHTMLSpan(wm);
[4187] Fix | Delete
});
[4188] Fix | Delete
[4189] Fix | Delete
// Hash self closing tags without />
[4190] Fix | Delete
text = text.replace(/<[^>]+?>/gi, function (wm) {
[4191] Fix | Delete
return hashHTMLSpan(wm);
[4192] Fix | Delete
});
[4193] Fix | Delete
[4194] Fix | Delete
/*showdown.helper.matchRecursiveRegExp(text, '<code\\b[^>]*>', '</code>', 'gi');*/
[4195] Fix | Delete
[4196] Fix | Delete
text = globals.converter._dispatch('hashHTMLSpans.after', text, options, globals);
[4197] Fix | Delete
return text;
[4198] Fix | Delete
});
[4199] Fix | Delete
[4200] Fix | Delete
/**
[4201] Fix | Delete
* Unhash HTML spans
[4202] Fix | Delete
*/
[4203] Fix | Delete
showdown.subParser('unhashHTMLSpans', function (text, options, globals) {
[4204] Fix | Delete
'use strict';
[4205] Fix | Delete
text = globals.converter._dispatch('unhashHTMLSpans.before', text, options, globals);
[4206] Fix | Delete
[4207] Fix | Delete
for (var i = 0; i < globals.gHtmlSpans.length; ++i) {
[4208] Fix | Delete
var repText = globals.gHtmlSpans[i],
[4209] Fix | Delete
// limiter to prevent infinite loop (assume 10 as limit for recurse)
[4210] Fix | Delete
limit = 0;
[4211] Fix | Delete
[4212] Fix | Delete
while (/¨C(\d+)C/.test(repText)) {
[4213] Fix | Delete
var num = RegExp.$1;
[4214] Fix | Delete
repText = repText.replace('¨C' + num + 'C', globals.gHtmlSpans[num]);
[4215] Fix | Delete
if (limit === 10) {
[4216] Fix | Delete
console.error('maximum nesting of 10 spans reached!!!');
[4217] Fix | Delete
break;
[4218] Fix | Delete
}
[4219] Fix | Delete
++limit;
[4220] Fix | Delete
}
[4221] Fix | Delete
text = text.replace('¨C' + i + 'C', repText);
[4222] Fix | Delete
}
[4223] Fix | Delete
[4224] Fix | Delete
text = globals.converter._dispatch('unhashHTMLSpans.after', text, options, globals);
[4225] Fix | Delete
return text;
[4226] Fix | Delete
});
[4227] Fix | Delete
[4228] Fix | Delete
/**
[4229] Fix | Delete
* Hash and escape <pre><code> elements that should not be parsed as markdown
[4230] Fix | Delete
*/
[4231] Fix | Delete
showdown.subParser('hashPreCodeTags', function (text, options, globals) {
[4232] Fix | Delete
'use strict';
[4233] Fix | Delete
text = globals.converter._dispatch('hashPreCodeTags.before', text, options, globals);
[4234] Fix | Delete
[4235] Fix | Delete
var repFunc = function (wholeMatch, match, left, right) {
[4236] Fix | Delete
// encode html entities
[4237] Fix | Delete
var codeblock = left + showdown.subParser('encodeCode')(match, options, globals) + right;
[4238] Fix | Delete
return '\n\n¨G' + (globals.ghCodeBlocks.push({text: wholeMatch, codeblock: codeblock}) - 1) + 'G\n\n';
[4239] Fix | Delete
};
[4240] Fix | Delete
[4241] Fix | Delete
// Hash <pre><code>
[4242] Fix | Delete
text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}<pre\\b[^>]*>\\s*<code\\b[^>]*>', '^ {0,3}</code>\\s*</pre>', 'gim');
[4243] Fix | Delete
[4244] Fix | Delete
text = globals.converter._dispatch('hashPreCodeTags.after', text, options, globals);
[4245] Fix | Delete
return text;
[4246] Fix | Delete
});
[4247] Fix | Delete
[4248] Fix | Delete
showdown.subParser('headers', function (text, options, globals) {
[4249] Fix | Delete
'use strict';
[4250] Fix | Delete
[4251] Fix | Delete
text = globals.converter._dispatch('headers.before', text, options, globals);
[4252] Fix | Delete
[4253] Fix | Delete
var headerLevelStart = (isNaN(parseInt(options.headerLevelStart))) ? 1 : parseInt(options.headerLevelStart),
[4254] Fix | Delete
[4255] Fix | Delete
// Set text-style headers:
[4256] Fix | Delete
// Header 1
[4257] Fix | Delete
// ========
[4258] Fix | Delete
//
[4259] Fix | Delete
// Header 2
[4260] Fix | Delete
// --------
[4261] Fix | Delete
//
[4262] Fix | Delete
setextRegexH1 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n={2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n=+[ \t]*\n+/gm,
[4263] Fix | Delete
setextRegexH2 = (options.smoothLivePreview) ? /^(.+)[ \t]*\n-{2,}[ \t]*\n+/gm : /^(.+)[ \t]*\n-+[ \t]*\n+/gm;
[4264] Fix | Delete
[4265] Fix | Delete
text = text.replace(setextRegexH1, function (wholeMatch, m1) {
[4266] Fix | Delete
[4267] Fix | Delete
var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
[4268] Fix | Delete
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
[4269] Fix | Delete
hLevel = headerLevelStart,
[4270] Fix | Delete
hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
[4271] Fix | Delete
return showdown.subParser('hashBlock')(hashBlock, options, globals);
[4272] Fix | Delete
});
[4273] Fix | Delete
[4274] Fix | Delete
text = text.replace(setextRegexH2, function (matchFound, m1) {
[4275] Fix | Delete
var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
[4276] Fix | Delete
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
[4277] Fix | Delete
hLevel = headerLevelStart + 1,
[4278] Fix | Delete
hashBlock = '<h' + hLevel + hID + '>' + spanGamut + '</h' + hLevel + '>';
[4279] Fix | Delete
return showdown.subParser('hashBlock')(hashBlock, options, globals);
[4280] Fix | Delete
});
[4281] Fix | Delete
[4282] Fix | Delete
// atx-style headers:
[4283] Fix | Delete
// # Header 1
[4284] Fix | Delete
// ## Header 2
[4285] Fix | Delete
// ## Header 2 with closing hashes ##
[4286] Fix | Delete
// ...
[4287] Fix | Delete
// ###### Header 6
[4288] Fix | Delete
//
[4289] Fix | Delete
var atxStyle = (options.requireSpaceBeforeHeadingText) ? /^(#{1,6})[ \t]+(.+?)[ \t]*#*\n+/gm : /^(#{1,6})[ \t]*(.+?)[ \t]*#*\n+/gm;
[4290] Fix | Delete
[4291] Fix | Delete
text = text.replace(atxStyle, function (wholeMatch, m1, m2) {
[4292] Fix | Delete
var hText = m2;
[4293] Fix | Delete
if (options.customizedHeaderId) {
[4294] Fix | Delete
hText = m2.replace(/\s?\{([^{]+?)}\s*$/, '');
[4295] Fix | Delete
}
[4296] Fix | Delete
[4297] Fix | Delete
var span = showdown.subParser('spanGamut')(hText, options, globals),
[4298] Fix | Delete
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m2) + '"',
[4299] Fix | Delete
hLevel = headerLevelStart - 1 + m1.length,
[4300] Fix | Delete
header = '<h' + hLevel + hID + '>' + span + '</h' + hLevel + '>';
[4301] Fix | Delete
[4302] Fix | Delete
return showdown.subParser('hashBlock')(header, options, globals);
[4303] Fix | Delete
});
[4304] Fix | Delete
[4305] Fix | Delete
function headerId (m) {
[4306] Fix | Delete
var title,
[4307] Fix | Delete
prefix;
[4308] Fix | Delete
[4309] Fix | Delete
// It is separate from other options to allow combining prefix and customized
[4310] Fix | Delete
if (options.customizedHeaderId) {
[4311] Fix | Delete
var match = m.match(/\{([^{]+?)}\s*$/);
[4312] Fix | Delete
if (match && match[1]) {
[4313] Fix | Delete
m = match[1];
[4314] Fix | Delete
}
[4315] Fix | Delete
}
[4316] Fix | Delete
[4317] Fix | Delete
title = m;
[4318] Fix | Delete
[4319] Fix | Delete
// Prefix id to prevent causing inadvertent pre-existing style matches.
[4320] Fix | Delete
if (showdown.helper.isString(options.prefixHeaderId)) {
[4321] Fix | Delete
prefix = options.prefixHeaderId;
[4322] Fix | Delete
} else if (options.prefixHeaderId === true) {
[4323] Fix | Delete
prefix = 'section-';
[4324] Fix | Delete
} else {
[4325] Fix | Delete
prefix = '';
[4326] Fix | Delete
}
[4327] Fix | Delete
[4328] Fix | Delete
if (!options.rawPrefixHeaderId) {
[4329] Fix | Delete
title = prefix + title;
[4330] Fix | Delete
}
[4331] Fix | Delete
[4332] Fix | Delete
if (options.ghCompatibleHeaderId) {
[4333] Fix | Delete
title = title
[4334] Fix | Delete
.replace(/ /g, '-')
[4335] Fix | Delete
// replace previously escaped chars (&, ¨ and $)
[4336] Fix | Delete
.replace(/&amp;/g, '')
[4337] Fix | Delete
.replace(/¨T/g, '')
[4338] Fix | Delete
.replace(/¨D/g, '')
[4339] Fix | Delete
// replace rest of the chars (&~$ are repeated as they might have been escaped)
[4340] Fix | Delete
// borrowed from github's redcarpet (some they should produce similar results)
[4341] Fix | Delete
.replace(/[&+$,\/:;=?@"#{}|^¨~\[\]`\\*)(%.!'<>]/g, '')
[4342] Fix | Delete
.toLowerCase();
[4343] Fix | Delete
} else if (options.rawHeaderId) {
[4344] Fix | Delete
title = title
[4345] Fix | Delete
.replace(/ /g, '-')
[4346] Fix | Delete
// replace previously escaped chars (&, ¨ and $)
[4347] Fix | Delete
.replace(/&amp;/g, '&')
[4348] Fix | Delete
.replace(/¨T/g, '¨')
[4349] Fix | Delete
.replace(/¨D/g, '$')
[4350] Fix | Delete
// replace " and '
[4351] Fix | Delete
.replace(/["']/g, '-')
[4352] Fix | Delete
.toLowerCase();
[4353] Fix | Delete
} else {
[4354] Fix | Delete
title = title
[4355] Fix | Delete
.replace(/[^\w]/g, '')
[4356] Fix | Delete
.toLowerCase();
[4357] Fix | Delete
}
[4358] Fix | Delete
[4359] Fix | Delete
if (options.rawPrefixHeaderId) {
[4360] Fix | Delete
title = prefix + title;
[4361] Fix | Delete
}
[4362] Fix | Delete
[4363] Fix | Delete
if (globals.hashLinkCounts[title]) {
[4364] Fix | Delete
title = title + '-' + (globals.hashLinkCounts[title]++);
[4365] Fix | Delete
} else {
[4366] Fix | Delete
globals.hashLinkCounts[title] = 1;
[4367] Fix | Delete
}
[4368] Fix | Delete
return title;
[4369] Fix | Delete
}
[4370] Fix | Delete
[4371] Fix | Delete
text = globals.converter._dispatch('headers.after', text, options, globals);
[4372] Fix | Delete
return text;
[4373] Fix | Delete
});
[4374] Fix | Delete
[4375] Fix | Delete
/**
[4376] Fix | Delete
* Turn Markdown link shortcuts into XHTML <a> tags.
[4377] Fix | Delete
*/
[4378] Fix | Delete
showdown.subParser('horizontalRule', function (text, options, globals) {
[4379] Fix | Delete
'use strict';
[4380] Fix | Delete
text = globals.converter._dispatch('horizontalRule.before', text, options, globals);
[4381] Fix | Delete
[4382] Fix | Delete
var key = showdown.subParser('hashBlock')('<hr />', options, globals);
[4383] Fix | Delete
text = text.replace(/^ {0,2}( ?-){3,}[ \t]*$/gm, key);
[4384] Fix | Delete
text = text.replace(/^ {0,2}( ?\*){3,}[ \t]*$/gm, key);
[4385] Fix | Delete
text = text.replace(/^ {0,2}( ?_){3,}[ \t]*$/gm, key);
[4386] Fix | Delete
[4387] Fix | Delete
text = globals.converter._dispatch('horizontalRule.after', text, options, globals);
[4388] Fix | Delete
return text;
[4389] Fix | Delete
});
[4390] Fix | Delete
[4391] Fix | Delete
/**
[4392] Fix | Delete
* Turn Markdown image shortcuts into <img> tags.
[4393] Fix | Delete
*/
[4394] Fix | Delete
showdown.subParser('images', function (text, options, globals) {
[4395] Fix | Delete
'use strict';
[4396] Fix | Delete
[4397] Fix | Delete
text = globals.converter._dispatch('images.before', text, options, globals);
[4398] Fix | Delete
[4399] Fix | Delete
var inlineRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?([\S]+?(?:\([\S]*?\)[\S]*?)?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
[4400] Fix | Delete
crazyRegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<([^>]*)>(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(?:(["'])([^"]*?)\6))?[ \t]?\)/g,
[4401] Fix | Delete
base64RegExp = /!\[([^\]]*?)][ \t]*()\([ \t]?<?(data:.+?\/.+?;base64,[A-Za-z0-9+/=\n]+?)>?(?: =([*\d]+[A-Za-z%]{0,4})x([*\d]+[A-Za-z%]{0,4}))?[ \t]*(?:(["'])([^"]*?)\6)?[ \t]?\)/g,
[4402] Fix | Delete
referenceRegExp = /!\[([^\]]*?)] ?(?:\n *)?\[([\s\S]*?)]()()()()()/g,
[4403] Fix | Delete
refShortcutRegExp = /!\[([^\[\]]+)]()()()()()/g;
[4404] Fix | Delete
[4405] Fix | Delete
function writeImageTagBase64 (wholeMatch, altText, linkId, url, width, height, m5, title) {
[4406] Fix | Delete
url = url.replace(/\s/g, '');
[4407] Fix | Delete
return writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title);
[4408] Fix | Delete
}
[4409] Fix | Delete
[4410] Fix | Delete
function writeImageTag (wholeMatch, altText, linkId, url, width, height, m5, title) {
[4411] Fix | Delete
[4412] Fix | Delete
var gUrls = globals.gUrls,
[4413] Fix | Delete
gTitles = globals.gTitles,
[4414] Fix | Delete
gDims = globals.gDimensions;
[4415] Fix | Delete
[4416] Fix | Delete
linkId = linkId.toLowerCase();
[4417] Fix | Delete
[4418] Fix | Delete
if (!title) {
[4419] Fix | Delete
title = '';
[4420] Fix | Delete
}
[4421] Fix | Delete
// Special case for explicit empty url
[4422] Fix | Delete
if (wholeMatch.search(/\(<?\s*>? ?(['"].*['"])?\)$/m) > -1) {
[4423] Fix | Delete
url = '';
[4424] Fix | Delete
[4425] Fix | Delete
} else if (url === '' || url === null) {
[4426] Fix | Delete
if (linkId === '' || linkId === null) {
[4427] Fix | Delete
// lower-case and turn embedded newlines into spaces
[4428] Fix | Delete
linkId = altText.toLowerCase().replace(/ ?\n/g, ' ');
[4429] Fix | Delete
}
[4430] Fix | Delete
url = '#' + linkId;
[4431] Fix | Delete
[4432] Fix | Delete
if (!showdown.helper.isUndefined(gUrls[linkId])) {
[4433] Fix | Delete
url = gUrls[linkId];
[4434] Fix | Delete
if (!showdown.helper.isUndefined(gTitles[linkId])) {
[4435] Fix | Delete
title = gTitles[linkId];
[4436] Fix | Delete
}
[4437] Fix | Delete
if (!showdown.helper.isUndefined(gDims[linkId])) {
[4438] Fix | Delete
width = gDims[linkId].width;
[4439] Fix | Delete
height = gDims[linkId].height;
[4440] Fix | Delete
}
[4441] Fix | Delete
} else {
[4442] Fix | Delete
return wholeMatch;
[4443] Fix | Delete
}
[4444] Fix | Delete
}
[4445] Fix | Delete
[4446] Fix | Delete
altText = altText
[4447] Fix | Delete
.replace(/"/g, '&quot;')
[4448] Fix | Delete
//altText = showdown.helper.escapeCharacters(altText, '*_', false);
[4449] Fix | Delete
.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
[4450] Fix | Delete
//url = showdown.helper.escapeCharacters(url, '*_', false);
[4451] Fix | Delete
url = url.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
[4452] Fix | Delete
var result = '<img src="' + url + '" alt="' + altText + '"';
[4453] Fix | Delete
[4454] Fix | Delete
if (title && showdown.helper.isString(title)) {
[4455] Fix | Delete
title = title
[4456] Fix | Delete
.replace(/"/g, '&quot;')
[4457] Fix | Delete
//title = showdown.helper.escapeCharacters(title, '*_', false);
[4458] Fix | Delete
.replace(showdown.helper.regexes.asteriskDashAndColon, showdown.helper.escapeCharactersCallback);
[4459] Fix | Delete
result += ' title="' + title + '"';
[4460] Fix | Delete
}
[4461] Fix | Delete
[4462] Fix | Delete
if (width && height) {
[4463] Fix | Delete
width = (width === '*') ? 'auto' : width;
[4464] Fix | Delete
height = (height === '*') ? 'auto' : height;
[4465] Fix | Delete
[4466] Fix | Delete
result += ' width="' + width + '"';
[4467] Fix | Delete
result += ' height="' + height + '"';
[4468] Fix | Delete
}
[4469] Fix | Delete
[4470] Fix | Delete
result += ' />';
[4471] Fix | Delete
[4472] Fix | Delete
return result;
[4473] Fix | Delete
}
[4474] Fix | Delete
[4475] Fix | Delete
// First, handle reference-style labeled images: ![alt text][id]
[4476] Fix | Delete
text = text.replace(referenceRegExp, writeImageTag);
[4477] Fix | Delete
[4478] Fix | Delete
// Next, handle inline images: ![alt text](url =<width>x<height> "optional title")
[4479] Fix | Delete
[4480] Fix | Delete
// base64 encoded images
[4481] Fix | Delete
text = text.replace(base64RegExp, writeImageTagBase64);
[4482] Fix | Delete
[4483] Fix | Delete
// cases with crazy urls like ./image/cat1).png
[4484] Fix | Delete
text = text.replace(crazyRegExp, writeImageTag);
[4485] Fix | Delete
[4486] Fix | Delete
// normal cases
[4487] Fix | Delete
text = text.replace(inlineRegExp, writeImageTag);
[4488] Fix | Delete
[4489] Fix | Delete
// handle reference-style shortcuts: ![img text]
[4490] Fix | Delete
text = text.replace(refShortcutRegExp, writeImageTag);
[4491] Fix | Delete
[4492] Fix | Delete
text = globals.converter._dispatch('images.after', text, options, globals);
[4493] Fix | Delete
return text;
[4494] Fix | Delete
});
[4495] Fix | Delete
[4496] Fix | Delete
showdown.subParser('italicsAndBold', function (text, options, globals) {
[4497] Fix | Delete
'use strict';
[4498] Fix | Delete
[4499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function