Skip to content

Commit e5642c4

Browse files
committed
Use the decoded and unescaped label in associations
1 parent 2bf8976 commit e5642c4

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

index.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,11 @@ function compiler(options) {
419419

420420
function onexitdefinitionlabelstring(token) {
421421
// Discard label, use the source content instead.
422-
resume()
423-
var data = this.sliceSerialize(token)
424-
stack[stack.length - 1].label = data
425-
stack[stack.length - 1].identifier = normalizeIdentifier(data).toLowerCase()
422+
var label = resume()
423+
stack[stack.length - 1].label = label
424+
stack[stack.length - 1].identifier = normalizeIdentifier(
425+
this.sliceSerialize(token)
426+
).toLowerCase()
426427
}
427428

428429
function onexitdefinitiontitlestring() {
@@ -562,13 +563,14 @@ function compiler(options) {
562563
}
563564

564565
function onexitlabeltext(token) {
565-
var data = this.sliceSerialize(token)
566566
var ctx =
567567
stack[stack.length - 1].type === 'fragment'
568568
? stack[stack.length - 2]
569569
: stack[stack.length - 1]
570-
ctx.label = data
571-
ctx.identifier = normalizeIdentifier(data).toLowerCase()
570+
ctx.label = toString(stack[stack.length - 1])
571+
ctx.identifier = normalizeIdentifier(
572+
this.sliceSerialize(token)
573+
).toLowerCase()
572574
}
573575

574576
function onexitlabel() {
@@ -603,10 +605,11 @@ function compiler(options) {
603605
}
604606

605607
function onexitreferencestring(token) {
606-
resume()
607-
var data = this.sliceSerialize(token)
608-
stack[stack.length - 1].label = data
609-
stack[stack.length - 1].identifier = normalizeIdentifier(data).toLowerCase()
608+
var label = resume()
609+
stack[stack.length - 1].label = label
610+
stack[stack.length - 1].identifier = normalizeIdentifier(
611+
this.sliceSerialize(token)
612+
).toLowerCase()
610613
referenceType = 'full'
611614
}
612615

0 commit comments

Comments
 (0)