Skip to content

Commit

Permalink
Merge pull request #567 from SassDoc/hotfix/464-broken-anchor-links
Browse files Browse the repository at this point in the history
Fix broken anchor links (#464, #465)
  • Loading branch information
valeriangalliat authored Apr 19, 2022
2 parents 986e369 + b2093f9 commit 881a89d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/annotation/annotations/alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function alias (env) {

let alias = item.alias
let name = item.context.name
let aliasGroup = item.group

let aliasedItem = Array.find(data, i => i.context.name === alias)

Expand All @@ -27,7 +28,12 @@ export default function alias (env) {
aliasedItem.aliased = []
}

if (!Array.isArray(aliasedItem.aliasedGroup)) {
aliasedItem.aliasedGroup = [];
}

aliasedItem.aliased.push(name)
aliasedItem.aliasedGroup.push({ group: aliasGroup, name: name })
})
},

Expand Down
1 change: 1 addition & 0 deletions src/annotation/annotations/see.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default function see (env) {
return {
description: item.description,
context: item.context,
group: item.group,
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions test/annotations/see.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ describe('#see', function () {
})

it('should rewrite the .toJSON method', function () {
var data = [{ description: 'desc', context: { name: 'name' } }, { see: [see.parse('name')] }]
var data = [{ description: 'desc', context: { name: 'name' }, group: 'test' }, { see: [see.parse('name')] }]
see.resolve(data)
assert.deepEqual(data[1].see.toJSON(), [{ description: 'desc', context: { name: 'name' } }])
assert.deepEqual(data[1].see.toJSON(), [{ description: 'desc', context: { name: 'name' }, group: 'test' }])
})
})
13 changes: 12 additions & 1 deletion test/data/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,14 @@
"aliased": [
"alias-test"
],
"aliasedGroup": [
{
"group": [
"test"
],
"name": "alias-test"
}
],
"usedBy": [
{
"description": "This is a test aiming at testing:\n- autofilled `@requires`\n- autofilled `@error`\n- autofilled `@content`\n",
Expand Down Expand Up @@ -699,7 +707,10 @@
"start": 77,
"end": 77
}
}
},
"group": [
"test"
]
}
],
"since": [
Expand Down

0 comments on commit 881a89d

Please # to comment.