@@ -25,7 +25,7 @@ var reHtmlBlockOpen = [
25
25
/ ^ < [ ? ] / ,
26
26
/ ^ < ! [ A - Z ] / ,
27
27
/ ^ < ! \[ C D A T A \[ / ,
28
- / ^ < [ / ] ? (?: 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,
28
+ / ^ < [ / ] ? (?: 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,
29
29
new RegExp ( '^(?:' + OPENTAG + '|' + CLOSETAG + ')\\s*$' , 'i' )
30
30
] ;
31
31
@@ -327,6 +327,7 @@ var blocks = {
327
327
ln . slice ( parser . nextNonspace ) . match ( reClosingCodeFence ) ) ;
328
328
if ( match && match [ 0 ] . length >= container . _fenceLength ) {
329
329
// closing fence - we're at end of line, so we can return
330
+ parser . lastLineLength = match [ 0 ] . length ;
330
331
parser . finalize ( container , parser . lineNumber ) ;
331
332
return 2 ;
332
333
} else {
@@ -675,7 +676,6 @@ var incorporateLine = function(ln) {
675
676
all_matched = false ;
676
677
break ;
677
678
case 2 : // we've hit end of line for fenced code close and can return
678
- this . lastLineLength = ln . length ;
679
679
return ;
680
680
default :
681
681
throw 'continue returned illegal value, must be 0, 1, or 2' ;
@@ -771,6 +771,7 @@ var incorporateLine = function(ln) {
771
771
container . _htmlBlockType >= 1 &&
772
772
container . _htmlBlockType <= 5 &&
773
773
reHtmlBlockClose [ container . _htmlBlockType ] . test ( this . currentLine . slice ( this . offset ) ) ) {
774
+ this . lastLineLength = ln . length ;
774
775
this . finalize ( container , this . lineNumber ) ;
775
776
}
776
777
@@ -897,7 +898,6 @@ module.exports = Parser;
897
898
"use strict" ;
898
899
899
900
var encode = require ( 'mdurl/encode' ) ;
900
- var decode = require ( 'mdurl/decode' ) ;
901
901
902
902
var C_BACKSLASH = 92 ;
903
903
@@ -952,7 +952,7 @@ var unescapeString = function(s) {
952
952
953
953
var normalizeURI = function ( uri ) {
954
954
try {
955
- return encode ( decode ( uri ) ) ;
955
+ return encode ( uri ) ;
956
956
}
957
957
catch ( err ) {
958
958
return uri ;
@@ -992,7 +992,7 @@ module.exports = { unescapeString: unescapeString,
992
992
ESCAPABLE : ESCAPABLE
993
993
} ;
994
994
995
- } , { "entities" :11 , "mdurl/decode" : 19 , "mdurl/ encode" :20 } ] , 3 :[ function ( require , module , exports ) {
995
+ } , { "entities" :11 , "mdurl/encode" :19 } ] , 3 :[ function ( require , module , exports ) {
996
996
"use strict" ;
997
997
998
998
// derived from https://github.com/mathiasbynens/String.fromCodePoint
@@ -1069,10 +1069,11 @@ if (String.fromCodePoint) {
1069
1069
1070
1070
module . exports . Node = require ( './node' ) ;
1071
1071
module . exports . Parser = require ( './blocks' ) ;
1072
+ module . exports . Renderer = require ( './render/renderer' ) ;
1072
1073
module . exports . HtmlRenderer = require ( './render/html' ) ;
1073
1074
module . exports . XmlRenderer = require ( './render/xml' ) ;
1074
1075
1075
- } , { "./blocks" :1 , "./node" :6 , "./render/html" :8 , "./render/xml" :10 } ] , 5 :[ function ( require , module , exports ) {
1076
+ } , { "./blocks" :1 , "./node" :6 , "./render/html" :8 , "./render/renderer" : 9 , "./render/ xml" :10 } ] , 5 :[ function ( require , module , exports ) {
1076
1077
"use strict" ;
1077
1078
1078
1079
var Node = require ( './node' ) ;
@@ -1111,7 +1112,7 @@ var ESCAPED_CHAR = '\\\\' + ESCAPABLE;
1111
1112
var ENTITY = common . ENTITY ;
1112
1113
var reHtmlTag = common . reHtmlTag ;
1113
1114
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 ] / ) ;
1115
+ 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 ] / ) ;
1115
1116
1116
1117
var reLinkTitle = new RegExp (
1117
1118
'^(?:"(' + ESCAPED_CHAR + '|[^"\\x00])*"' +
@@ -1142,8 +1143,6 @@ var reSpnl = /^ *(?:\n *)?/;
1142
1143
1143
1144
var reWhitespaceChar = / ^ [ \t \n \x0b \x0c \x0d ] / ;
1144
1145
1145
- var reWhitespace = / [ \t \n \x0b \x0c \x0d ] + / g;
1146
-
1147
1146
var reUnicodeWhitespaceChar = / ^ \s / ;
1148
1147
1149
1148
var reFinalSpace = / * $ / ;
@@ -1379,16 +1378,19 @@ var handleDelim = function(cc, block) {
1379
1378
block . appendChild ( node ) ;
1380
1379
1381
1380
// Add entry to stack for this opener
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 ) {
1381
+ if ( ( res . can_open || res . can_close ) &&
1382
+ ( this . options . smart || cc !== C_SINGLEQUOTE || cc !== C_DOUBLEQUOTE ) ) {
1383
+ this . delimiters = { cc : cc ,
1384
+ numdelims : numdelims ,
1385
+ origdelims : numdelims ,
1386
+ node : node ,
1387
+ previous : this . delimiters ,
1388
+ next : null ,
1389
+ can_open : res . can_open ,
1390
+ can_close : res . can_close } ;
1391
+ if ( this . delimiters . previous !== null ) {
1391
1392
this . delimiters . previous . next = this . delimiters ;
1393
+ }
1392
1394
}
1393
1395
1394
1396
return true ;
@@ -1421,14 +1423,15 @@ var processEmphasis = function(stack_bottom) {
1421
1423
var use_delims ;
1422
1424
var tmp , next ;
1423
1425
var opener_found ;
1424
- var openers_bottom = [ ] ;
1426
+ var openers_bottom = [ [ ] , [ ] , [ ] ] ;
1425
1427
var odd_match = false ;
1426
1428
1427
- openers_bottom [ C_UNDERSCORE ] = stack_bottom ;
1428
- openers_bottom [ C_ASTERISK ] = stack_bottom ;
1429
- openers_bottom [ C_SINGLEQUOTE ] = stack_bottom ;
1430
- openers_bottom [ C_DOUBLEQUOTE ] = stack_bottom ;
1431
-
1429
+ for ( var i = 0 ; i < 3 ; i ++ ) {
1430
+ openers_bottom [ i ] [ C_UNDERSCORE ] = stack_bottom ;
1431
+ openers_bottom [ i ] [ C_ASTERISK ] = stack_bottom ;
1432
+ openers_bottom [ i ] [ C_SINGLEQUOTE ] = stack_bottom ;
1433
+ openers_bottom [ i ] [ C_DOUBLEQUOTE ] = stack_bottom ;
1434
+ }
1432
1435
// find first closer above stack_bottom:
1433
1436
closer = this . delimiters ;
1434
1437
while ( closer !== null && closer . previous !== stack_bottom ) {
@@ -1444,7 +1447,7 @@ var processEmphasis = function(stack_bottom) {
1444
1447
opener = closer . previous ;
1445
1448
opener_found = false ;
1446
1449
while ( opener !== null && opener !== stack_bottom &&
1447
- opener !== openers_bottom [ closercc ] ) {
1450
+ opener !== openers_bottom [ closer . origdelims % 3 ] [ closercc ] ) {
1448
1451
odd_match = ( closer . can_open || opener . can_close ) &&
1449
1452
closer . origdelims % 3 !== 0 &&
1450
1453
( opener . origdelims + closer . origdelims ) % 3 === 0 ;
@@ -1523,13 +1526,9 @@ var processEmphasis = function(stack_bottom) {
1523
1526
closer = closer . next ;
1524
1527
1525
1528
}
1526
- if ( ! opener_found && ! odd_match ) {
1529
+ if ( ! opener_found ) {
1527
1530
// Set lower bound for future searches for openers:
1528
- // We don't do this with odd_match because a **
1529
- // that doesn't match an earlier * might turn into
1530
- // an opener, and the * might be matched by something
1531
- // else.
1532
- openers_bottom [ closercc ] = old_closer . previous ;
1531
+ openers_bottom [ old_closer . origdelims % 3 ] [ closercc ] = old_closer . previous ;
1533
1532
if ( ! old_closer . can_open ) {
1534
1533
// We can remove a closer that can't be an opener,
1535
1534
// once we've seen there's no matching opener:
@@ -1596,6 +1595,9 @@ var parseLinkDestination = function() {
1596
1595
if ( this . pos === savepos && c !== C_CLOSE_PAREN ) {
1597
1596
return null ;
1598
1597
}
1598
+ if ( openparens !== 0 ) {
1599
+ return null ;
1600
+ }
1599
1601
res = this . subject . substr ( savepos , this . pos - savepos ) ;
1600
1602
return normalizeURI ( unescapeString ( res ) ) ;
1601
1603
} else { // chop off surrounding <..>:
@@ -2038,7 +2040,7 @@ function InlineParser(options){
2038
2040
2039
2041
module . exports = InlineParser ;
2040
2042
2041
- } , { "./common" :2 , "./from-code-point.js" :3 , "./node" :6 , "./normalize-reference" :7 , "entities" :11 , "string.prototype.repeat" :21 } ] , 6 :[ function ( require , module , exports ) {
2043
+ } , { "./common" :2 , "./from-code-point.js" :3 , "./node" :6 , "./normalize-reference" :7 , "entities" :11 , "string.prototype.repeat" :20 } ] , 6 :[ function ( require , module , exports ) {
2042
2044
"use strict" ;
2043
2045
2044
2046
function isContainer ( node ) {
@@ -2421,10 +2423,10 @@ function link(node, entering) {
2421
2423
var attrs = this . attrs ( node ) ;
2422
2424
if ( entering ) {
2423
2425
if ( ! ( this . options . safe && potentiallyUnsafe ( node . destination ) ) ) {
2424
- attrs . push ( [ 'href' , this . esc ( node . destination , false ) ] ) ;
2426
+ attrs . push ( [ 'href' , this . esc ( node . destination ) ] ) ;
2425
2427
}
2426
2428
if ( node . title ) {
2427
- attrs . push ( [ 'title' , this . esc ( node . title , false ) ] ) ;
2429
+ attrs . push ( [ 'title' , this . esc ( node . title ) ] ) ;
2428
2430
}
2429
2431
this . tag ( 'a' , attrs ) ;
2430
2432
} else {
@@ -2438,7 +2440,7 @@ function image(node, entering) {
2438
2440
if ( this . options . safe && potentiallyUnsafe ( node . destination ) ) {
2439
2441
this . lit ( '<img src="" alt="' ) ;
2440
2442
} else {
2441
- this . lit ( '<img src="' + this . esc ( node . destination , false ) +
2443
+ this . lit ( '<img src="' + this . esc ( node . destination ) +
2442
2444
'" alt="' ) ;
2443
2445
}
2444
2446
}
@@ -2447,7 +2449,7 @@ function image(node, entering) {
2447
2449
this . disableTags -= 1 ;
2448
2450
if ( this . disableTags === 0 ) {
2449
2451
if ( node . title ) {
2450
- this . lit ( '" title="' + this . esc ( node . title , false ) ) ;
2452
+ this . lit ( '" title="' + this . esc ( node . title ) ) ;
2451
2453
}
2452
2454
this . lit ( '" />' ) ;
2453
2455
}
@@ -2502,7 +2504,7 @@ function code_block(node) {
2502
2504
var info_words = node . info ? node . info . split ( / \s + / ) : [ ]
2503
2505
, attrs = this . attrs ( node ) ;
2504
2506
if ( info_words . length > 0 && info_words [ 0 ] . length > 0 ) {
2505
- attrs . push ( [ 'class' , 'language-' + this . esc ( info_words [ 0 ] , false ) ] ) ;
2507
+ attrs . push ( [ 'class' , 'language-' + this . esc ( info_words [ 0 ] ) ] ) ;
2506
2508
}
2507
2509
this . cr ( ) ;
2508
2510
this . tag ( 'pre' ) ;
@@ -2601,7 +2603,7 @@ function custom_block(node, entering) {
2601
2603
/* Helper methods */
2602
2604
2603
2605
function out ( s ) {
2604
- this . lit ( this . esc ( s , false ) ) ;
2606
+ this . lit ( this . esc ( s ) ) ;
2605
2607
}
2606
2608
2607
2609
function attrs ( node ) {
@@ -3134,130 +3136,6 @@ module.exports={"amp":"&","apos":"'","gt":">","lt":"<","quot":"\""}
3134
3136
'use strict' ;
3135
3137
3136
3138
3137
- /* eslint-disable no-bitwise */
3138
-
3139
- var decodeCache = { } ;
3140
-
3141
- function getDecodeCache ( exclude ) {
3142
- var i , ch , cache = decodeCache [ exclude ] ;
3143
- if ( cache ) { return cache ; }
3144
-
3145
- cache = decodeCache [ exclude ] = [ ] ;
3146
-
3147
- for ( i = 0 ; i < 128 ; i ++ ) {
3148
- ch = String . fromCharCode ( i ) ;
3149
- cache . push ( ch ) ;
3150
- }
3151
-
3152
- for ( i = 0 ; i < exclude . length ; i ++ ) {
3153
- ch = exclude . charCodeAt ( i ) ;
3154
- cache [ ch ] = '%' + ( '0' + ch . toString ( 16 ) . toUpperCase ( ) ) . slice ( - 2 ) ;
3155
- }
3156
-
3157
- return cache ;
3158
- }
3159
-
3160
-
3161
- // Decode percent-encoded string.
3162
- //
3163
- function decode ( string , exclude ) {
3164
- var cache ;
3165
-
3166
- if ( typeof exclude !== 'string' ) {
3167
- exclude = decode . defaultChars ;
3168
- }
3169
-
3170
- cache = getDecodeCache ( exclude ) ;
3171
-
3172
- return string . replace ( / ( % [ a - f 0 - 9 ] { 2 } ) + / gi, function ( seq ) {
3173
- var i , l , b1 , b2 , b3 , b4 , chr ,
3174
- result = '' ;
3175
-
3176
- for ( i = 0 , l = seq . length ; i < l ; i += 3 ) {
3177
- b1 = parseInt ( seq . slice ( i + 1 , i + 3 ) , 16 ) ;
3178
-
3179
- if ( b1 < 0x80 ) {
3180
- result += cache [ b1 ] ;
3181
- continue ;
3182
- }
3183
-
3184
- if ( ( b1 & 0xE0 ) === 0xC0 && ( i + 3 < l ) ) {
3185
- // 110xxxxx 10xxxxxx
3186
- b2 = parseInt ( seq . slice ( i + 4 , i + 6 ) , 16 ) ;
3187
-
3188
- if ( ( b2 & 0xC0 ) === 0x80 ) {
3189
- chr = ( ( b1 << 6 ) & 0x7C0 ) | ( b2 & 0x3F ) ;
3190
-
3191
- if ( chr < 0x80 ) {
3192
- result += '\ufffd\ufffd' ;
3193
- } else {
3194
- result += String . fromCharCode ( chr ) ;
3195
- }
3196
-
3197
- i += 3 ;
3198
- continue ;
3199
- }
3200
- }
3201
-
3202
- if ( ( b1 & 0xF0 ) === 0xE0 && ( i + 6 < l ) ) {
3203
- // 1110xxxx 10xxxxxx 10xxxxxx
3204
- b2 = parseInt ( seq . slice ( i + 4 , i + 6 ) , 16 ) ;
3205
- b3 = parseInt ( seq . slice ( i + 7 , i + 9 ) , 16 ) ;
3206
-
3207
- if ( ( b2 & 0xC0 ) === 0x80 && ( b3 & 0xC0 ) === 0x80 ) {
3208
- chr = ( ( b1 << 12 ) & 0xF000 ) | ( ( b2 << 6 ) & 0xFC0 ) | ( b3 & 0x3F ) ;
3209
-
3210
- if ( chr < 0x800 || ( chr >= 0xD800 && chr <= 0xDFFF ) ) {
3211
- result += '\ufffd\ufffd\ufffd' ;
3212
- } else {
3213
- result += String . fromCharCode ( chr ) ;
3214
- }
3215
-
3216
- i += 6 ;
3217
- continue ;
3218
- }
3219
- }
3220
-
3221
- if ( ( b1 & 0xF8 ) === 0xF0 && ( i + 9 < l ) ) {
3222
- // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx
3223
- b2 = parseInt ( seq . slice ( i + 4 , i + 6 ) , 16 ) ;
3224
- b3 = parseInt ( seq . slice ( i + 7 , i + 9 ) , 16 ) ;
3225
- b4 = parseInt ( seq . slice ( i + 10 , i + 12 ) , 16 ) ;
3226
-
3227
- if ( ( b2 & 0xC0 ) === 0x80 && ( b3 & 0xC0 ) === 0x80 && ( b4 & 0xC0 ) === 0x80 ) {
3228
- chr = ( ( b1 << 18 ) & 0x1C0000 ) | ( ( b2 << 12 ) & 0x3F000 ) | ( ( b3 << 6 ) & 0xFC0 ) | ( b4 & 0x3F ) ;
3229
-
3230
- if ( chr < 0x10000 || chr > 0x10FFFF ) {
3231
- result += '\ufffd\ufffd\ufffd\ufffd' ;
3232
- } else {
3233
- chr -= 0x10000 ;
3234
- result += String . fromCharCode ( 0xD800 + ( chr >> 10 ) , 0xDC00 + ( chr & 0x3FF ) ) ;
3235
- }
3236
-
3237
- i += 9 ;
3238
- continue ;
3239
- }
3240
- }
3241
-
3242
- result += '\ufffd' ;
3243
- }
3244
-
3245
- return result ;
3246
- } ) ;
3247
- }
3248
-
3249
-
3250
- decode . defaultChars = ';/?:@&=+$,#' ;
3251
- decode . componentChars = '' ;
3252
-
3253
-
3254
- module . exports = decode ;
3255
-
3256
- } , { } ] , 20 :[ function ( require , module , exports ) {
3257
-
3258
- 'use strict' ;
3259
-
3260
-
3261
3139
var encodeCache = { } ;
3262
3140
3263
3141
@@ -3353,7 +3231,7 @@ encode.componentChars = "-_.!~*'()";
3353
3231
3354
3232
module . exports = encode ;
3355
3233
3356
- } , { } ] , 21 :[ function ( require , module , exports ) {
3234
+ } , { } ] , 20 :[ function ( require , module , exports ) {
3357
3235
/*! http://mths.be/repeat v0.2.0 by @mathias */
3358
3236
if ( ! String . prototype . repeat ) {
3359
3237
( function ( ) {
0 commit comments