@@ -145,6 +145,8 @@ function convert(infile, outfile) {
145
145
}
146
146
147
147
// Replace <span> with the inner <code> or a new <a>.
148
+ // TODO: align more closely with Wattsi:
149
+ // https://github.com/whatwg/wattsi/blob/b9c28036a2a174f7f87315164f001120596a95f1/src/wattsi.pas#L1454-L1487
148
150
const spans = document . querySelectorAll ( 'span' ) ;
149
151
for ( const [ i , span ] of Object . entries ( spans ) ) {
150
152
// Don't touch any span with a descendent span.
@@ -231,6 +233,30 @@ function convert(infile, outfile) {
231
233
a . appendChild ( span . firstChild ) ;
232
234
}
233
235
span . replaceWith ( a ) ;
236
+
237
+ // TODO: ensure that Bikeshed will identify the same <dfn> as Wattsi.
238
+ }
239
+
240
+ // Wrap <i data-x="..."> with <a>. Wattsi handling is here:
241
+ // https://github.com/whatwg/wattsi/blob/b9c28036a2a174f7f87315164f001120596a95f1/src/wattsi.pas#L1454-L1487
242
+ for ( const i of document . querySelectorAll ( 'i[data-x]' ) ) {
243
+ if ( i . closest ( 'dfn' ) ) {
244
+ continue ;
245
+ }
246
+
247
+ const topic = getTopic ( i ) ;
248
+ const dfn = crossRefs . get ( topic ) ;
249
+ if ( ! dfn ) {
250
+ continue ;
251
+ // TODO: vet these cases for any that should actually be linked
252
+ // console.log(i.outerHTML);
253
+ }
254
+
255
+ const a = document . createElement ( 'a' ) ;
256
+ i . parentNode . insertBefore ( a , i ) ;
257
+ a . appendChild ( i ) ;
258
+
259
+ // TODO: ensure that Bikeshed will identify the same <dfn> as Wattsi.
234
260
}
235
261
236
262
for ( const code of document . querySelectorAll ( 'pre > code' ) ) {
@@ -300,6 +326,8 @@ function convert(infile, outfile) {
300
326
}
301
327
code . replaceWith ( a ) ;
302
328
a . appendChild ( code ) ;
329
+
330
+ // TODO: ensure that Bikeshed will identify the same <dfn> as Wattsi.
303
331
}
304
332
305
333
// Rewrite data-lt to lt.
0 commit comments