Skip to content

Commit

Permalink
Use the decoded and unescaped label in associations
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 10, 2020
1 parent 2bf8976 commit e5642c4
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,11 @@ function compiler(options) {

function onexitdefinitionlabelstring(token) {
// Discard label, use the source content instead.
resume()
var data = this.sliceSerialize(token)
stack[stack.length - 1].label = data
stack[stack.length - 1].identifier = normalizeIdentifier(data).toLowerCase()
var label = resume()
stack[stack.length - 1].label = label
stack[stack.length - 1].identifier = normalizeIdentifier(
this.sliceSerialize(token)
).toLowerCase()
}

function onexitdefinitiontitlestring() {
Expand Down Expand Up @@ -562,13 +563,14 @@ function compiler(options) {
}

function onexitlabeltext(token) {
var data = this.sliceSerialize(token)
var ctx =
stack[stack.length - 1].type === 'fragment'
? stack[stack.length - 2]
: stack[stack.length - 1]
ctx.label = data
ctx.identifier = normalizeIdentifier(data).toLowerCase()
ctx.label = toString(stack[stack.length - 1])
ctx.identifier = normalizeIdentifier(
this.sliceSerialize(token)
).toLowerCase()
}

function onexitlabel() {
Expand Down Expand Up @@ -603,10 +605,11 @@ function compiler(options) {
}

function onexitreferencestring(token) {
resume()
var data = this.sliceSerialize(token)
stack[stack.length - 1].label = data
stack[stack.length - 1].identifier = normalizeIdentifier(data).toLowerCase()
var label = resume()
stack[stack.length - 1].label = label
stack[stack.length - 1].identifier = normalizeIdentifier(
this.sliceSerialize(token)
).toLowerCase()
referenceType = 'full'
}

Expand Down

0 comments on commit e5642c4

Please sign in to comment.