@@ -24,7 +24,7 @@ var reHtmlBlockOpen = [
24
24
/ ^ < [ ? ] / ,
25
25
/ ^ < ! [ A - Z ] / ,
26
26
/ ^ < ! \[ C D A T A \[ / ,
27
- / ^ < [ / ] ? (?: a d d r e s s | a r t i c l e | a s i d e | b a s e | b a s e f o n t | b l o c k q u o t e | b o d y | c a p t i o n | c e n t e r | c o l | c o l g r o u p | d d | d e t a i l s | d i a l o g | d i r | d i v | d l | d t | f i e l d s e t | f i g c a p t i o n | f i g u r e | f o o t e r | f o r m | f r a m e | f r a m e s e t | h [ 1 2 3 4 5 6 ] | h e a d | h e a d e r | h r | h t m l | i f r a m e | l e g e n d | l i | l i n k | m a i n | m e n u | m e n u i t e m | n a v | n o f r a m e s | o l | o p t g r o u p | o p t i o n | p | p a r a m | s e c t i o n | s o u r c e | t i t l e | s u m m a r y | t a b l e | t b o d y | t d | t f o o t | t h | t h e a d | t i t l e | t r | t r a c k | u l ) (?: \s | [ / ] ? [ > ] | $ ) / i,
27
+ / ^ < [ / ] ? (?: a d d r e s s | a r t i c l e | a s i d e | b a s e | b a s e f o n t | b l o c k q u o t e | b o d y | c a p t i o n | c e n t e r | c o l | c o l g r o u p | d d | d e t a i l s | d i a l o g | d i r | d i v | d l | d t | f i e l d s e t | f i g c a p t i o n | f i g u r e | f o o t e r | f o r m | f r a m e | f r a m e s e t | h [ 1 2 3 4 5 6 ] | h e a d | h e a d e r | h r | h t m l | i f r a m e | l e g e n d | l i | l i n k | m a i n | m e n u | m e n u i t e m | n a v | n o f r a m e s | o l | o p t g r o u p | o p t i o n | p | p a r a m | s e c t i o n | s o u r c e | s u m m a r y | t a b l e | t b o d y | t d | t f o o t | t h | t h e a d | t i t l e | t r | t r a c k | u l ) (?: \s | [ / ] ? [ > ] | $ ) / i,
28
28
new RegExp ( '^(?:' + OPENTAG + '|' + CLOSETAG + ')\\s*$' , 'i' )
29
29
] ;
30
30
@@ -326,6 +326,7 @@ var blocks = {
326
326
ln . slice ( parser . nextNonspace ) . match ( reClosingCodeFence ) ) ;
327
327
if ( match && match [ 0 ] . length >= container . _fenceLength ) {
328
328
// closing fence - we're at end of line, so we can return
329
+ parser . lastLineLength = match [ 0 ] . length ;
329
330
parser . finalize ( container , parser . lineNumber ) ;
330
331
return 2 ;
331
332
} else {
@@ -674,7 +675,6 @@ var incorporateLine = function(ln) {
674
675
all_matched = false ;
675
676
break ;
676
677
case 2 : // we've hit end of line for fenced code close and can return
677
- this . lastLineLength = ln . length ;
678
678
return ;
679
679
default :
680
680
throw 'continue returned illegal value, must be 0, 1, or 2' ;
@@ -770,6 +770,7 @@ var incorporateLine = function(ln) {
770
770
container . _htmlBlockType >= 1 &&
771
771
container . _htmlBlockType <= 5 &&
772
772
reHtmlBlockClose [ container . _htmlBlockType ] . test ( this . currentLine . slice ( this . offset ) ) ) {
773
+ this . lastLineLength = ln . length ;
773
774
this . finalize ( container , this . lineNumber ) ;
774
775
}
775
776
@@ -896,7 +897,6 @@ module.exports = Parser;
896
897
"use strict" ;
897
898
898
899
var encode = require ( 'mdurl/encode' ) ;
899
- var decode = require ( 'mdurl/decode' ) ;
900
900
901
901
var C_BACKSLASH = 92 ;
902
902
@@ -951,7 +951,7 @@ var unescapeString = function(s) {
951
951
952
952
var normalizeURI = function ( uri ) {
953
953
try {
954
- return encode ( decode ( uri ) ) ;
954
+ return encode ( uri ) ;
955
955
}
956
956
catch ( err ) {
957
957
return uri ;
@@ -991,7 +991,7 @@ module.exports = { unescapeString: unescapeString,
991
991
ESCAPABLE : ESCAPABLE
992
992
} ;
993
993
994
- } , { "entities" :11 , "mdurl/decode" : 19 , "mdurl/ encode" :20 } ] , 3 :[ function ( require , module , exports ) {
994
+ } , { "entities" :11 , "mdurl/encode" :19 } ] , 3 :[ function ( require , module , exports ) {
995
995
"use strict" ;
996
996
997
997
// derived from https://github.com/mathiasbynens/String.fromCodePoint
@@ -1068,10 +1068,11 @@ if (String.fromCodePoint) {
1068
1068
1069
1069
module . exports . Node = require ( './node' ) ;
1070
1070
module . exports . Parser = require ( './blocks' ) ;
1071
+ module . exports . Renderer = require ( './render/renderer' ) ;
1071
1072
module . exports . HtmlRenderer = require ( './render/html' ) ;
1072
1073
module . exports . XmlRenderer = require ( './render/xml' ) ;
1073
1074
1074
- } , { "./blocks" :1 , "./node" :6 , "./render/html" :8 , "./render/xml" :10 } ] , 5 :[ function ( require , module , exports ) {
1075
+ } , { "./blocks" :1 , "./node" :6 , "./render/html" :8 , "./render/renderer" : 9 , "./render/ xml" :10 } ] , 5 :[ function ( require , module , exports ) {
1075
1076
"use strict" ;
1076
1077
1077
1078
var Node = require ( './node' ) ;
@@ -1110,7 +1111,7 @@ var ESCAPED_CHAR = '\\\\' + ESCAPABLE;
1110
1111
var ENTITY = common . ENTITY ;
1111
1112
var reHtmlTag = common . reHtmlTag ;
1112
1113
1113
- var rePunctuation = new RegExp ( / [ ! " # $ % & ' ( ) * + , \- . / : ; < = > ? @ \[ \] ^ _ ` { | } ~ \xA1 \xA7 \xAB \xB6 \xB7 \xBB \xBF \u037E \u0387 \u055A - \u055F \u0589 \u058A \u05BE \u05C0 \u05C3 \u05C6 \u05F3 \u05F4 \u0609 \u060A \u060C \u060D \u061B \u061E \u061F \u066A - \u066D \u06D4 \u0700 - \u070D \u07F7 - \u07F9 \u0830 - \u083E \u085E \u0964 \u0965 \u0970 \u0AF0 \u0DF4 \u0E4F \u0E5A \u0E5B \u0F04 - \u0F12 \u0F14 \u0F3A - \u0F3D \u0F85 \u0FD0 - \u0FD4 \u0FD9 \u0FDA \u104A - \u104F \u10FB \u1360 - \u1368 \u1400 \u166D \u166E \u169B \u169C \u16EB - \u16ED \u1735 \u1736 \u17D4 - \u17D6 \u17D8 - \u17DA \u1800 - \u180A \u1944 \u1945 \u1A1E \u1A1F \u1AA0 - \u1AA6 \u1AA8 - \u1AAD \u1B5A - \u1B60 \u1BFC - \u1BFF \u1C3B - \u1C3F \u1C7E \u1C7F \u1CC0 - \u1CC7 \u1CD3 \u2010 - \u2027 \u2030 - \u2043 \u2045 - \u2051 \u2053 - \u205E \u207D \u207E \u208D \u208E \u2308 - \u230B \u2329 \u232A \u2768 - \u2775 \u27C5 \u27C6 \u27E6 - \u27EF \u2983 - \u2998 \u29D8 - \u29DB \u29FC \u29FD \u2CF9 - \u2CFC \u2CFE \u2CFF \u2D70 \u2E00 - \u2E2E \u2E30 - \u2E42 \u3001 - \u3003 \u3008 - \u3011 \u3014 - \u301F \u3030 \u303D \u30A0 \u30FB \uA4FE \uA4FF \uA60D - \uA60F \uA673 \uA67E \uA6F2 - \uA6F7 \uA874 - \uA877 \uA8CE \uA8CF \uA8F8 - \uA8FA \uA8FC \uA92E \uA92F \uA95F \uA9C1 - \uA9CD \uA9DE \uA9DF \uAA5C - \uAA5F \uAADE \uAADF \uAAF0 \uAAF1 \uABEB \uFD3E \uFD3F \uFE10 - \uFE19 \uFE30 - \uFE52 \uFE54 - \uFE61 \uFE63 \uFE68 \uFE6A \uFE6B \uFF01 - \uFF03 \uFF05 - \uFF0A \uFF0C - \uFF0F \uFF1A \uFF1B \uFF1F \uFF20 \uFF3B - \uFF3D \uFF3F \uFF5B \uFF5D \uFF5F - \uFF65 ] | \uD800 [ \uDD00 - \uDD02 \uDF9F \uDFD0 ] | \uD801 \uDD6F | \uD802 [ \uDC57 \uDD1F \uDD3F \uDE50 - \uDE58 \uDE7F \uDEF0 - \uDEF6 \uDF39 - \uDF3F \uDF99 - \uDF9C ] | \uD804 [ \uDC47 - \uDC4D \uDCBB \uDCBC \uDCBE - \uDCC1 \uDD40 - \uDD43 \uDD74 \uDD75 \uDDC5 - \uDDC9 \uDDCD \uDDDB \uDDDD - \uDDDF \uDE38 - \uDE3D \uDEA9 ] | \uD805 [ \uDCC6 \uDDC1 - \uDDD7 \uDE41 - \uDE43 \uDF3C - \uDF3E ] | \uD809 [ \uDC70 - \uDC74 ] | \uD81A [ \uDE6E \uDE6F \uDEF5 \uDF37 - \uDF3B \uDF44 ] | \uD82F \uDC9F | \uD836 [ \uDE87 - \uDE8B ] / ) ;
1114
+ var rePunctuation = new RegExp ( / [ ! " # $ % & ' ( ) * + , \- . / : ; < = > ? @ \[ \] \\ ^ _ ` { | } ~ \xA1 \xA7 \xAB \xB6 \xB7 \xBB \xBF \u037E \u0387 \u055A - \u055F \u0589 \u058A \u05BE \u05C0 \u05C3 \u05C6 \u05F3 \u05F4 \u0609 \u060A \u060C \u060D \u061B \u061E \u061F \u066A - \u066D \u06D4 \u0700 - \u070D \u07F7 - \u07F9 \u0830 - \u083E \u085E \u0964 \u0965 \u0970 \u0AF0 \u0DF4 \u0E4F \u0E5A \u0E5B \u0F04 - \u0F12 \u0F14 \u0F3A - \u0F3D \u0F85 \u0FD0 - \u0FD4 \u0FD9 \u0FDA \u104A - \u104F \u10FB \u1360 - \u1368 \u1400 \u166D \u166E \u169B \u169C \u16EB - \u16ED \u1735 \u1736 \u17D4 - \u17D6 \u17D8 - \u17DA \u1800 - \u180A \u1944 \u1945 \u1A1E \u1A1F \u1AA0 - \u1AA6 \u1AA8 - \u1AAD \u1B5A - \u1B60 \u1BFC - \u1BFF \u1C3B - \u1C3F \u1C7E \u1C7F \u1CC0 - \u1CC7 \u1CD3 \u2010 - \u2027 \u2030 - \u2043 \u2045 - \u2051 \u2053 - \u205E \u207D \u207E \u208D \u208E \u2308 - \u230B \u2329 \u232A \u2768 - \u2775 \u27C5 \u27C6 \u27E6 - \u27EF \u2983 - \u2998 \u29D8 - \u29DB \u29FC \u29FD \u2CF9 - \u2CFC \u2CFE \u2CFF \u2D70 \u2E00 - \u2E2E \u2E30 - \u2E42 \u3001 - \u3003 \u3008 - \u3011 \u3014 - \u301F \u3030 \u303D \u30A0 \u30FB \uA4FE \uA4FF \uA60D - \uA60F \uA673 \uA67E \uA6F2 - \uA6F7 \uA874 - \uA877 \uA8CE \uA8CF \uA8F8 - \uA8FA \uA8FC \uA92E \uA92F \uA95F \uA9C1 - \uA9CD \uA9DE \uA9DF \uAA5C - \uAA5F \uAADE \uAADF \uAAF0 \uAAF1 \uABEB \uFD3E \uFD3F \uFE10 - \uFE19 \uFE30 - \uFE52 \uFE54 - \uFE61 \uFE63 \uFE68 \uFE6A \uFE6B \uFF01 - \uFF03 \uFF05 - \uFF0A \uFF0C - \uFF0F \uFF1A \uFF1B \uFF1F \uFF20 \uFF3B - \uFF3D \uFF3F \uFF5B \uFF5D \uFF5F - \uFF65 ] | \uD800 [ \uDD00 - \uDD02 \uDF9F \uDFD0 ] | \uD801 \uDD6F | \uD802 [ \uDC57 \uDD1F \uDD3F \uDE50 - \uDE58 \uDE7F \uDEF0 - \uDEF6 \uDF39 - \uDF3F \uDF99 - \uDF9C ] | \uD804 [ \uDC47 - \uDC4D \uDCBB \uDCBC \uDCBE - \uDCC1 \uDD40 - \uDD43 \uDD74 \uDD75 \uDDC5 - \uDDC9 \uDDCD \uDDDB \uDDDD - \uDDDF \uDE38 - \uDE3D \uDEA9 ] | \uD805 [ \uDCC6 \uDDC1 - \uDDD7 \uDE41 - \uDE43 \uDF3C - \uDF3E ] | \uD809 [ \uDC70 - \uDC74 ] | \uD81A [ \uDE6E \uDE6F \uDEF5 \uDF37 - \uDF3B \uDF44 ] | \uD82F \uDC9F | \uD836 [ \uDE87 - \uDE8B ] / ) ;
1114
1115
1115
1116
var reLinkTitle = new RegExp (
1116
1117
'^(?:"(' + ESCAPED_CHAR + '|[^"\\x00])*"' +
@@ -1141,8 +1142,6 @@ var reSpnl = /^ *(?:\n *)?/;
1141
1142
1142
1143
var reWhitespaceChar = / ^ [ \t \n \x0b \x0c \x0d ] / ;
1143
1144
1144
- var reWhitespace = / [ \t \n \x0b \x0c \x0d ] + / g;
1145
-
1146
1145
var reUnicodeWhitespaceChar = / ^ \s / ;
1147
1146
1148
1147
var reFinalSpace = / * $ / ;
@@ -1378,16 +1377,19 @@ var handleDelim = function(cc, block) {
1378
1377
block . appendChild ( node ) ;
1379
1378
1380
1379
// Add entry to stack for this opener
1381
- this . delimiters = { cc : cc ,
1382
- numdelims : numdelims ,
1383
- origdelims : numdelims ,
1384
- node : node ,
1385
- previous : this . delimiters ,
1386
- next : null ,
1387
- can_open : res . can_open ,
1388
- can_close : res . can_close } ;
1389
- if ( this . delimiters . previous !== null ) {
1380
+ if ( ( res . can_open || res . can_close ) &&
1381
+ ( this . options . smart || cc !== C_SINGLEQUOTE || cc !== C_DOUBLEQUOTE ) ) {
1382
+ this . delimiters = { cc : cc ,
1383
+ numdelims : numdelims ,
1384
+ origdelims : numdelims ,
1385
+ node : node ,
1386
+ previous : this . delimiters ,
1387
+ next : null ,
1388
+ can_open : res . can_open ,
1389
+ can_close : res . can_close } ;
1390
+ if ( this . delimiters . previous !== null ) {
1390
1391
this . delimiters . previous . next = this . delimiters ;
1392
+ }
1391
1393
}
1392
1394
1393
1395
return true ;
@@ -1420,14 +1422,15 @@ var processEmphasis = function(stack_bottom) {
1420
1422
var use_delims ;
1421
1423
var tmp , next ;
1422
1424
var opener_found ;
1423
- var openers_bottom = [ ] ;
1425
+ var openers_bottom = [ [ ] , [ ] , [ ] ] ;
1424
1426
var odd_match = false ;
1425
1427
1426
- openers_bottom [ C_UNDERSCORE ] = stack_bottom ;
1427
- openers_bottom [ C_ASTERISK ] = stack_bottom ;
1428
- openers_bottom [ C_SINGLEQUOTE ] = stack_bottom ;
1429
- openers_bottom [ C_DOUBLEQUOTE ] = stack_bottom ;
1430
-
1428
+ for ( var i = 0 ; i < 3 ; i ++ ) {
1429
+ openers_bottom [ i ] [ C_UNDERSCORE ] = stack_bottom ;
1430
+ openers_bottom [ i ] [ C_ASTERISK ] = stack_bottom ;
1431
+ openers_bottom [ i ] [ C_SINGLEQUOTE ] = stack_bottom ;
1432
+ openers_bottom [ i ] [ C_DOUBLEQUOTE ] = stack_bottom ;
1433
+ }
1431
1434
// find first closer above stack_bottom:
1432
1435
closer = this . delimiters ;
1433
1436
while ( closer !== null && closer . previous !== stack_bottom ) {
@@ -1443,7 +1446,7 @@ var processEmphasis = function(stack_bottom) {
1443
1446
opener = closer . previous ;
1444
1447
opener_found = false ;
1445
1448
while ( opener !== null && opener !== stack_bottom &&
1446
- opener !== openers_bottom [ closercc ] ) {
1449
+ opener !== openers_bottom [ closer . origdelims % 3 ] [ closercc ] ) {
1447
1450
odd_match = ( closer . can_open || opener . can_close ) &&
1448
1451
closer . origdelims % 3 !== 0 &&
1449
1452
( opener . origdelims + closer . origdelims ) % 3 === 0 ;
@@ -1522,13 +1525,9 @@ var processEmphasis = function(stack_bottom) {
1522
1525
closer = closer . next ;
1523
1526
1524
1527
}
1525
- if ( ! opener_found && ! odd_match ) {
1528
+ if ( ! opener_found ) {
1526
1529
// Set lower bound for future searches for openers:
1527
- // We don't do this with odd_match because a **
1528
- // that doesn't match an earlier * might turn into
1529
- // an opener, and the * might be matched by something
1530
- // else.
1531
- openers_bottom [ closercc ] = old_closer . previous ;
1530
+ openers_bottom [ old_closer . origdelims % 3 ] [ closercc ] = old_closer . previous ;
1532
1531
if ( ! old_closer . can_open ) {
1533
1532
// We can remove a closer that can't be an opener,
1534
1533
// once we've seen there's no matching opener:
@@ -1595,6 +1594,9 @@ var parseLinkDestination = function() {
1595
1594
if ( this . pos === savepos && c !== C_CLOSE_PAREN ) {
1596
1595
return null ;
1597
1596
}
1597
+ if ( openparens !== 0 ) {
1598
+ return null ;
1599
+ }
1598
1600
res = this . subject . substr ( savepos , this . pos - savepos ) ;
1599
1601
return normalizeURI ( unescapeString ( res ) ) ;
1600
1602
} else { // chop off surrounding <..>:
@@ -2037,7 +2039,7 @@ function InlineParser(options){
2037
2039
2038
2040
module . exports = InlineParser ;
2039
2041
2040
- } , { "./common" :2 , "./from-code-point.js" :3 , "./node" :6 , "./normalize-reference" :7 , "entities" :11 , "string.prototype.repeat" :21 } ] , 6 :[ function ( require , module , exports ) {
2042
+ } , { "./common" :2 , "./from-code-point.js" :3 , "./node" :6 , "./normalize-reference" :7 , "entities" :11 , "string.prototype.repeat" :20 } ] , 6 :[ function ( require , module , exports ) {
2041
2043
"use strict" ;
2042
2044
2043
2045
function isContainer ( node ) {
@@ -2420,10 +2422,10 @@ function link(node, entering) {
2420
2422
var attrs = this . attrs ( node ) ;
2421
2423
if ( entering ) {
2422
2424
if ( ! ( this . options . safe && potentiallyUnsafe ( node . destination ) ) ) {
2423
- attrs . push ( [ 'href' , this . esc ( node . destination , false ) ] ) ;
2425
+ attrs . push ( [ 'href' , this . esc ( node . destination ) ] ) ;
2424
2426
}
2425
2427
if ( node . title ) {
2426
- attrs . push ( [ 'title' , this . esc ( node . title , false ) ] ) ;
2428
+ attrs . push ( [ 'title' , this . esc ( node . title ) ] ) ;
2427
2429
}
2428
2430
this . tag ( 'a' , attrs ) ;
2429
2431
} else {
@@ -2437,7 +2439,7 @@ function image(node, entering) {
2437
2439
if ( this . options . safe && potentiallyUnsafe ( node . destination ) ) {
2438
2440
this . lit ( '<img src="" alt="' ) ;
2439
2441
} else {
2440
- this . lit ( '<img src="' + this . esc ( node . destination , false ) +
2442
+ this . lit ( '<img src="' + this . esc ( node . destination ) +
2441
2443
'" alt="' ) ;
2442
2444
}
2443
2445
}
@@ -2446,7 +2448,7 @@ function image(node, entering) {
2446
2448
this . disableTags -= 1 ;
2447
2449
if ( this . disableTags === 0 ) {
2448
2450
if ( node . title ) {
2449
- this . lit ( '" title="' + this . esc ( node . title , false ) ) ;
2451
+ this . lit ( '" title="' + this . esc ( node . title ) ) ;
2450
2452
}
2451
2453
this . lit ( '" />' ) ;
2452
2454
}
@@ -2501,7 +2503,7 @@ function code_block(node) {
2501
2503
var info_words = node . info ? node . info . split ( / \s + / ) : [ ]
2502
2504
, attrs = this . attrs ( node ) ;
2503
2505
if ( info_words . length > 0 && info_words [ 0 ] . length > 0 ) {
2504
- attrs . push ( [ 'class' , 'language-' + this . esc ( info_words [ 0 ] , false ) ] ) ;
2506
+ attrs . push ( [ 'class' , 'language-' + this . esc ( info_words [ 0 ] ) ] ) ;
2505
2507
}
2506
2508
this . cr ( ) ;
2507
2509
this . tag ( 'pre' ) ;
@@ -2600,7 +2602,7 @@ function custom_block(node, entering) {
2600
2602
/* Helper methods */
2601
2603
2602
2604
function out ( s ) {
2603
- this . lit ( this . esc ( s , false ) ) ;
2605
+ this . lit ( this . esc ( s ) ) ;
2604
2606
}
2605
2607
2606
2608
function attrs ( node ) {
@@ -3133,130 +3135,6 @@ module.exports={"amp":"&","apos":"'","gt":">","lt":"<","quot":"\""}
3133
3135
'use strict' ;
3134
3136
3135
3137
3136
- /* eslint-disable no-bitwise */
3137
-
3138
- var decodeCache = { } ;
3139
-
3140
- function getDecodeCache ( exclude ) {
3141
- var i , ch , cache = decodeCache [ exclude ] ;
3142
- if ( cache ) { return cache ; }
3143
-
3144
- cache = decodeCache [ exclude ] = [ ] ;
3145
-
3146
- for ( i = 0 ; i < 128 ; i ++ ) {
3147
- ch = String . fromCharCode ( i ) ;
3148
- cache . push ( ch ) ;
3149
- }
3150
-
3151
- for ( i = 0 ; i < exclude . length ; i ++ ) {
3152
- ch = exclude . charCodeAt ( i ) ;
3153
- cache [ ch ] = '%' + ( '0' + ch . toString ( 16 ) . toUpperCase ( ) ) . slice ( - 2 ) ;
3154
- }
3155
-
3156
- return cache ;
3157
- }
3158
-
3159
-
3160
- // Decode percent-encoded string.
3161
- //
3162
- function decode ( string , exclude ) {
3163
- var cache ;
3164
-
3165
- if ( typeof exclude !== 'string' ) {
3166
- exclude = decode . defaultChars ;
3167
- }
3168
-
3169
- cache = getDecodeCache ( exclude ) ;
3170
-
3171
- return string . replace ( / ( % [ a - f 0 - 9 ] { 2 } ) + / gi, function ( seq ) {
3172
- var i , l , b1 , b2 , b3 , b4 , chr ,
3173
- result = '' ;
3174
-
3175
- for ( i = 0 , l = seq . length ; i < l ; i += 3 ) {
3176
- b1 = parseInt ( seq . slice ( i + 1 , i + 3 ) , 16 ) ;
3177
-
3178
- if ( b1 < 0x80 ) {
3179
- result += cache [ b1 ] ;
3180
- continue ;
3181
- }
3182
-
3183
- if ( ( b1 & 0xE0 ) === 0xC0 && ( i + 3 < l ) ) {
3184
- // 110xxxxx 10xxxxxx
3185
- b2 = parseInt ( seq . slice ( i + 4 , i + 6 ) , 16 ) ;
3186
-
3187
- if ( ( b2 & 0xC0 ) === 0x80 ) {
3188
- chr = ( ( b1 << 6 ) & 0x7C0 ) | ( b2 & 0x3F ) ;
3189
-
3190
- if ( chr < 0x80 ) {
3191
- result += '\ufffd\ufffd' ;
3192
- } else {
3193
- result += String . fromCharCode ( chr ) ;
3194
- }
3195
-
3196
- i += 3 ;
3197
- continue ;
3198
- }
3199
- }
3200
-
3201
- if ( ( b1 & 0xF0 ) === 0xE0 && ( i + 6 < l ) ) {
3202
- // 1110xxxx 10xxxxxx 10xxxxxx
3203
- b2 = parseInt ( seq . slice ( i + 4 , i + 6 ) , 16 ) ;
3204
- b3 = parseInt ( seq . slice ( i + 7 , i + 9 ) , 16 ) ;
3205
-
3206
- if ( ( b2 & 0xC0 ) === 0x80 && ( b3 & 0xC0 ) === 0x80 ) {
3207
- chr = ( ( b1 << 12 ) & 0xF000 ) | ( ( b2 << 6 ) & 0xFC0 ) | ( b3 & 0x3F ) ;
3208
-
3209
- if ( chr < 0x800 || ( chr >= 0xD800 && chr <= 0xDFFF ) ) {
3210
- result += '\ufffd\ufffd\ufffd' ;
3211
- } else {
3212
- result += String . fromCharCode ( chr ) ;
3213
- }
3214
-
3215
- i += 6 ;
3216
- continue ;
3217
- }
3218
- }
3219
-
3220
- if ( ( b1 & 0xF8 ) === 0xF0 && ( i + 9 < l ) ) {
3221
- // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx
3222
- b2 = parseInt ( seq . slice ( i + 4 , i + 6 ) , 16 ) ;
3223
- b3 = parseInt ( seq . slice ( i + 7 , i + 9 ) , 16 ) ;
3224
- b4 = parseInt ( seq . slice ( i + 10 , i + 12 ) , 16 ) ;
3225
-
3226
- if ( ( b2 & 0xC0 ) === 0x80 && ( b3 & 0xC0 ) === 0x80 && ( b4 & 0xC0 ) === 0x80 ) {
3227
- chr = ( ( b1 << 18 ) & 0x1C0000 ) | ( ( b2 << 12 ) & 0x3F000 ) | ( ( b3 << 6 ) & 0xFC0 ) | ( b4 & 0x3F ) ;
3228
-
3229
- if ( chr < 0x10000 || chr > 0x10FFFF ) {
3230
- result += '\ufffd\ufffd\ufffd\ufffd' ;
3231
- } else {
3232
- chr -= 0x10000 ;
3233
- result += String . fromCharCode ( 0xD800 + ( chr >> 10 ) , 0xDC00 + ( chr & 0x3FF ) ) ;
3234
- }
3235
-
3236
- i += 9 ;
3237
- continue ;
3238
- }
3239
- }
3240
-
3241
- result += '\ufffd' ;
3242
- }
3243
-
3244
- return result ;
3245
- } ) ;
3246
- }
3247
-
3248
-
3249
- decode . defaultChars = ';/?:@&=+$,#' ;
3250
- decode . componentChars = '' ;
3251
-
3252
-
3253
- module . exports = decode ;
3254
-
3255
- } , { } ] , 20 :[ function ( require , module , exports ) {
3256
-
3257
- 'use strict' ;
3258
-
3259
-
3260
3138
var encodeCache = { } ;
3261
3139
3262
3140
@@ -3352,7 +3230,7 @@ encode.componentChars = "-_.!~*'()";
3352
3230
3353
3231
module . exports = encode ;
3354
3232
3355
- } , { } ] , 21 :[ function ( require , module , exports ) {
3233
+ } , { } ] , 20 :[ function ( require , module , exports ) {
3356
3234
/*! http://mths.be/repeat v0.2.0 by @mathias */
3357
3235
if ( ! String . prototype . repeat ) {
3358
3236
( function ( ) {
0 commit comments