diff options
-rw-r--r-- | js/lib/blocks.js | 10 | ||||
-rw-r--r-- | js/lib/html-renderer.js | 16 | ||||
-rw-r--r-- | js/lib/inlines.js | 12 |
3 files changed, 19 insertions, 19 deletions
diff --git a/js/lib/blocks.js b/js/lib/blocks.js index 98ad9e0..7518fef 100644 --- a/js/lib/blocks.js +++ b/js/lib/blocks.js @@ -330,7 +330,7 @@ var incorporateLine = function(ln, line_number) { container.t !== 'IndentedCode' && container.t !== 'HtmlBlock' && // this is a little performance optimization: - matchAt(/^[ #`~*+_=<>0-9-]/,ln,offset) !== -1) { + matchAt(/^[ #`~*+_=<>0-9-]/, ln, offset) !== -1) { match = matchAt(/[^ ]/, ln, offset); if (match === -1) { @@ -370,7 +370,7 @@ var incorporateLine = function(ln, line_number) { container.level = match[0].trim().length; // number of #s // remove trailing ###s: container.strings = - [ln.slice(offset).replace(/^ *#+ *$/, '').replace(/ +#+ *$/,'')]; + [ln.slice(offset).replace(/^ *#+ *$/, '').replace(/ +#+ *$/, '')]; break; } else if ((match = ln.slice(first_nonspace).match(/^`{3,}(?!.*`)|^~{3,}(?!.*~)/))) { @@ -545,7 +545,7 @@ var finalize = function(block, line_number) { switch (block.t) { case 'Paragraph': - block.string_content = block.strings.join('\n').replace(/^ {2,}/m,''); + block.string_content = block.strings.join('\n').replace(/^ {2,}/m, ''); // delete block.strings; // try parsing the beginning as link reference definitions: @@ -566,7 +566,7 @@ var finalize = function(block, line_number) { break; case 'IndentedCode': - block.string_content = block.strings.join('\n').replace(/(\n *)*$/,'\n'); + block.string_content = block.strings.join('\n').replace(/(\n *)*$/, '\n'); block.t = 'CodeBlock'; break; @@ -667,7 +667,7 @@ var parse = function(input) { this.doc = makeBlock('Document', 1, 1); this.tip = this.doc; this.refmap = {}; - var lines = input.replace(/\n$/,'').split(/\r\n|\n|\r/); + var lines = input.replace(/\n$/, '').split(/\r\n|\n|\r/); var len = lines.length; for (var i = 0; i < len; i++) { this.incorporateLine(lines[i], i + 1); diff --git a/js/lib/html-renderer.js b/js/lib/html-renderer.js index 455da22..ed19624 100644 --- a/js/lib/html-renderer.js +++ b/js/lib/html-renderer.js @@ -45,7 +45,7 @@ var renderInline = function(inline) { attrs = [['src', this.escape(inline.destination, true)], ['alt', this.renderInlines(inline.label). replace(/\<[^>]*alt="([^"]*)"[^>]*\>/g, '$1'). - replace(/\<[^>]*\>/g,'')]]; + replace(/\<[^>]*\>/g, '')]]; if (inline.title) { attrs.push(['title', this.escape(inline.title, true)]); } @@ -146,15 +146,15 @@ function HtmlRenderer(){ // set to " " if you want to ignore line wrapping in source escape: function(s, preserve_entities) { if (preserve_entities) { - return s.replace(/[&](?![#](x[a-f0-9]{1,8}|[0-9]{1,8});|[a-z][a-z0-9]{1,31};)/gi,'&') - .replace(/[<]/g,'<') - .replace(/[>]/g,'>') - .replace(/["]/g,'"'); + return s.replace(/[&](?![#](x[a-f0-9]{1,8}|[0-9]{1,8});|[a-z][a-z0-9]{1,31};)/gi, '&') + .replace(/[<]/g, '<') + .replace(/[>]/g, '>') + .replace(/["]/g, '"'); } else { return s.replace(/[&]/g,'&') - .replace(/[<]/g,'<') - .replace(/[>]/g,'>') - .replace(/["]/g,'"'); + .replace(/[<]/g, '<') + .replace(/[>]/g, '>') + .replace(/["]/g, '"'); } }, renderInline: renderInline, diff --git a/js/lib/inlines.js b/js/lib/inlines.js index 846ed20..e97ea5d 100644 --- a/js/lib/inlines.js +++ b/js/lib/inlines.js @@ -81,7 +81,7 @@ var unescapeString = function(s) { // to single space, remove leading/trailing whitespace, case fold. var normalizeReference = function(s) { return s.trim() - .replace(/\s+/,' ') + .replace(/\s+/, ' ') .toUpperCase(); }; @@ -137,7 +137,7 @@ var parseBackticks = function(inlines) { if (matched === ticks) { inlines.push({ t: 'Code', c: this.subject.slice(afterOpenTicks, this.pos - ticks.length) - .replace(/[ \n]+/g,' ') + .replace(/[ \n]+/g, ' ') .trim() }); return true; } @@ -153,7 +153,7 @@ var parseBackticks = function(inlines) { // or a literal backslash to the 'inlines' list. var parseBackslash = function(inlines) { var subj = this.subject, - pos = this.pos; + pos = this.pos; if (subj.charCodeAt(pos) === C_BACKSLASH) { if (subj.charAt(pos + 1) === '\n') { this.pos = this.pos + 2; @@ -176,14 +176,14 @@ var parseAutolink = function(inlines) { var m; var dest; if ((m = this.match(/^<([a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)>/))) { // email autolink - dest = m.slice(1,-1); + dest = m.slice(1, -1); inlines.push( {t: 'Link', label: [{ t: 'Text', c: dest }], destination: 'mailto:' + encodeURI(unescape(dest)) }); return true; } else if ((m = this.match(/^<(?:coap|doi|javascript|aaa|aaas|about|acap|cap|cid|crid|data|dav|dict|dns|file|ftp|geo|go|gopher|h323|http|https|iax|icap|im|imap|info|ipp|iris|iris.beep|iris.xpc|iris.xpcs|iris.lwz|ldap|mailto|mid|msrp|msrps|mtqp|mupdate|news|nfs|ni|nih|nntp|opaquelocktoken|pop|pres|rtsp|service|session|shttp|sieve|sip|sips|sms|snmp|soap.beep|soap.beeps|tag|tel|telnet|tftp|thismessage|tn3270|tip|tv|urn|vemmi|ws|wss|xcon|xcon-userid|xmlrpc.beep|xmlrpc.beeps|xmpp|z39.50r|z39.50s|adiumxtra|afp|afs|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|chrome|chrome-extension|com-eventbrite-attendee|content|cvs|dlna-playsingle|dlna-playcontainer|dtn|dvb|ed2k|facetime|feed|finger|fish|gg|git|gizmoproject|gtalk|hcp|icon|ipn|irc|irc6|ircs|itms|jar|jms|keyparc|lastfm|ldaps|magnet|maps|market|message|mms|ms-help|msnim|mumble|mvn|notes|oid|palm|paparazzi|platform|proxy|psyc|query|res|resource|rmi|rsync|rtmp|secondlife|sftp|sgn|skype|smb|soldat|spotify|ssh|steam|svn|teamspeak|things|udp|unreal|ut2004|ventrilo|view-source|webcal|wtai|wyciwyg|xfire|xri|ymsgr):[^<>\x00-\x20]*>/i))) { - dest = m.slice(1,-1); + dest = m.slice(1, -1); inlines.push({ t: 'Link', label: [{ t: 'Text', c: dest }], @@ -260,7 +260,7 @@ var Str = function(s) { }; // Attempt to parse emphasis or strong emphasis. -var parseEmphasis = function(cc,inlines) { +var parseEmphasis = function(cc, inlines) { var res = this.scanDelims(cc); var numdelims = res.numdelims; |