@@ -66,7 +66,8 @@ function compiler(options) {
66
66
htmlFlowData : onenterdata ,
67
67
htmlText : opener ( html , buffer ) ,
68
68
htmlTextData : onenterdata ,
69
- image : opener ( image , onenterimage ) ,
69
+ image : opener ( image ) ,
70
+ label : buffer ,
70
71
link : opener ( link ) ,
71
72
listItem : opener ( listItem ) ,
72
73
listItemValue : onenterlistitemvalue ,
@@ -538,10 +539,6 @@ function compiler(options) {
538
539
this . stack [ this . stack . length - 1 ] . value = data
539
540
}
540
541
541
- function onenterimage ( ) {
542
- this . buffer ( )
543
- }
544
-
545
542
function onexitlink ( ) {
546
543
var context = this . stack [ this . stack . length - 1 ]
547
544
@@ -579,26 +576,24 @@ function compiler(options) {
579
576
}
580
577
581
578
function onexitlabeltext ( token ) {
582
- var ctx =
583
- this . stack [ this . stack . length - 1 ] . type === 'fragment'
584
- ? this . stack [ this . stack . length - 2 ]
585
- : this . stack [ this . stack . length - 1 ]
586
- ctx . label = toString ( this . stack [ this . stack . length - 1 ] )
587
- ctx . identifier = normalizeIdentifier (
579
+ this . stack [ this . stack . length - 2 ] . identifier = normalizeIdentifier (
588
580
this . sliceSerialize ( token )
589
581
) . toLowerCase ( )
590
582
}
591
583
592
584
function onexitlabel ( ) {
593
- var data
585
+ var fragment = this . stack [ this . stack . length - 1 ]
586
+ var value = this . resume ( )
587
+
588
+ this . stack [ this . stack . length - 1 ] . label = value
594
589
595
590
// Assume a reference.
596
591
setData ( 'inReference' , true )
597
592
598
- // If we’re in a fragment, we’re in an image and buffering.
599
- if ( this . stack [ this . stack . length - 1 ] . type === ' fragment' ) {
600
- data = this . resume ( )
601
- this . stack [ this . stack . length - 1 ] . alt = data
593
+ if ( this . stack [ this . stack . length - 1 ] . type === 'link' ) {
594
+ this . stack [ this . stack . length - 1 ] . children = fragment . children
595
+ } else {
596
+ this . stack [ this . stack . length - 1 ] . alt = value
602
597
}
603
598
}
604
599
0 commit comments