@@ -190,7 +190,7 @@ for (let l in lines) {
190
190
191
191
// remove TOC from older spec versions, respec will generate a new one
192
192
if ( line . startsWith ( '## Table of Contents' ) ) inTOC = true ;
193
- if ( line . startsWith ( '<!-- /TOC ' ) ) inTOC = false ;
193
+ else if ( line . startsWith ( '# ' ) ) inTOC = false ;
194
194
if ( inTOC ) line = '' ;
195
195
196
196
// special formatting for Definitions section
@@ -209,7 +209,7 @@ for (let l in lines) {
209
209
line = line . replace ( '<a name="parameterAllowEmptyValue"/>' , '<span id="parameterAllowEmptyValue"></span>' ) ;
210
210
}
211
211
212
- // replace deprecated <a name="..."></a> with <span id="..."></span>
212
+ // replace deprecated <a name="..."></a> with <span id="..."></span> - needed for older specs
213
213
line = line . replace ( / < a n a m e = " ( [ ^ " ] + ) " > < \/ a > / g, '<span id="$1"></span>' ) ;
214
214
215
215
line = line . split ( '\\|' ) . join ( '|' ) ; // was ¦
@@ -271,12 +271,14 @@ for (let l in lines) {
271
271
272
272
// fix relative links (to examples)
273
273
if ( ! inCodeBlock && line . indexOf ( '](../examples/' ) >= 0 ) {
274
+ // links to examples go to learn site, links to yaml files go to wrapper html
274
275
line = line . replace ( / \( \. \. \/ e x a m p l e s \/ ( [ ^ ) ] + ) \) / g, function ( match , group1 ) {
275
276
console . warn ( "example link" , group1 ) ;
276
- //TODO: group1 = group1.replace('.yaml','.html');
277
+ group1 = group1 . replace ( '.yaml' , '.html' ) ;
277
278
return `(https://learn.openapis.org/examples/${ group1 } )` ;
278
279
} )
279
280
} else if ( ! inCodeBlock && line . indexOf ( '](../' ) >= 0 ) {
281
+ // links to other sibling files go to github
280
282
const regExp = / \( ( \. \. [ ^ ) ] + ) \) / g;
281
283
line = line . replace ( regExp , function ( match , group1 ) {
282
284
console . warn ( 'relative link' , group1 ) ;
0 commit comments