File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -86,21 +86,21 @@ export default function () {
86
86
let href = nodeid ;
87
87
88
88
if ( parentSection ) {
89
- let alternateIds = [ ] ;
89
+ const ids = [ ] ;
90
90
let id ;
91
91
92
92
const heading = parentSection . heading ;
93
93
if ( heading . id ) {
94
94
id = heading . id ;
95
95
href = getAbsoluteUrl ( heading , { singlePage } ) ;
96
- alternateIds . push ( id ) ;
96
+ ids . push ( id ) ;
97
97
}
98
98
else {
99
99
const anchor = heading . querySelector ( 'a[name]' ) ;
100
100
if ( anchor ) {
101
101
id = anchor . getAttribute ( 'name' ) ;
102
102
href = getAbsoluteUrl ( anchor , { singlePage, attribute : 'name' } ) ;
103
- alternateIds . push ( id ) ;
103
+ ids . push ( id ) ;
104
104
}
105
105
}
106
106
@@ -115,13 +115,16 @@ export default function () {
115
115
116
116
const mapping = { } ;
117
117
if ( id ) {
118
- mapping . id = id ;
118
+ ids . push ( id ) ;
119
+
120
+ }
121
+ if ( ids . length ) {
122
+ mapping . id = ids . pop ( ) ;
119
123
}
120
- alternateIds = alternateIds . filter ( id => id !== mapping . id ) ;
121
124
mapping . href = href ;
122
125
mapping . title = trimmedText . replace ( reNumber , '' ) ;
123
- if ( alternateIds . length ) {
124
- mapping . alternateIds = alternateIds ;
126
+ if ( ids . length ) {
127
+ mapping . alternateIds = ids ;
125
128
}
126
129
mappingTable [ nodeid ] = mapping ;
127
130
You can’t perform that action at this time.
0 commit comments