@@ -45,6 +45,12 @@ module.exports = class Xref extends Builder {
45
45
case 'note' :
46
46
buildFigureLink ( this . spec , xref , entry . entry , 'Note' ) ;
47
47
break ;
48
+ case 'table' :
49
+ buildFigureLink ( this . spec , xref , entry . entry , 'Table' ) ;
50
+ break ;
51
+ case 'figure' :
52
+ buildFigureLink ( this . spec , xref , entry . entry , 'Figure' ) ;
53
+ break ;
48
54
default :
49
55
console . log ( 'Warning: found unknown biblio entry (this is a bug, please file it)' ) ;
50
56
}
@@ -92,21 +98,25 @@ function buildAOLink(xref, entry) {
92
98
93
99
function buildFigureLink ( spec , xref , entry , type ) {
94
100
if ( xref . textContent . trim ( ) === '' ) {
95
- // first need to find the associated clause
96
- const clauseEntry = spec . lookupBiblioEntryById ( entry . clauseId ) ;
97
- if ( clauseEntry . type !== 'clause' ) {
98
- console . log ( 'Warning: could not find parent clause for ' + type + ' id ' + entry . id ) ;
99
- }
101
+ if ( entry . clauseId ) {
102
+ // first need to find the associated clause
103
+ const clauseEntry = spec . lookupBiblioEntryById ( entry . clauseId ) ;
104
+ if ( clauseEntry . type !== 'clause' ) {
105
+ console . log ( 'Warning: could not find parent clause for ' + type + ' id ' + entry . id ) ;
106
+ }
100
107
101
- const parentClause = utils . parent ( xref , [ 'EMU-CLAUSE' , 'EMU-INTRO' , 'EMU-ANNEX' ] ) ;
102
- if ( parentClause && parentClause . id === clauseEntry . entry . id ) {
103
- xref . innerHTML = buildXrefLink ( entry , type + ' ' + entry . number ) ;
104
- } else {
105
- if ( xref . hasAttribute ( 'title' ) ) {
106
- xref . innerHTML = buildXrefLink ( entry , clauseEntry . entry . title + ' ' + type + ' ' + entry . number ) ;
108
+ const parentClause = utils . parent ( xref , [ 'EMU-CLAUSE' , 'EMU-INTRO' , 'EMU-ANNEX' ] ) ;
109
+ if ( parentClause && parentClause . id === clauseEntry . entry . id ) {
110
+ xref . innerHTML = buildXrefLink ( entry , type + ' ' + entry . number ) ;
107
111
} else {
108
- xref . innerHTML = buildXrefLink ( entry , clauseEntry . entry . number + ' ' + type + ' ' + entry . number ) ;
112
+ if ( xref . hasAttribute ( 'title' ) ) {
113
+ xref . innerHTML = buildXrefLink ( entry , clauseEntry . entry . title + ' ' + type + ' ' + entry . number ) ;
114
+ } else {
115
+ xref . innerHTML = buildXrefLink ( entry , clauseEntry . entry . number + ' ' + type + ' ' + entry . number ) ;
116
+ }
109
117
}
118
+ } else {
119
+ xref . innerHTML = buildXrefLink ( entry , type + ' ' + entry . number ) ;
110
120
}
111
121
} else {
112
122
xref . innerHTML = buildXrefLink ( entry , xref . innerHTML ) ;
0 commit comments