@@ -190,7 +190,7 @@ for (let l in lines) {
190190
191191 // remove TOC from older spec versions, respec will generate a new one
192192 if ( line . startsWith ( '## Table of Contents' ) ) inTOC = true ;
193- if ( line . startsWith ( '<!-- /TOC ' ) ) inTOC = false ;
193+ else if ( line . startsWith ( '# ' ) ) inTOC = false ;
194194 if ( inTOC ) line = '' ;
195195
196196 // special formatting for Definitions section
@@ -209,7 +209,7 @@ for (let l in lines) {
209209 line = line . replace ( '<a name="parameterAllowEmptyValue"/>' , '<span id="parameterAllowEmptyValue"></span>' ) ;
210210 }
211211
212- // replace deprecated <a name="..."></a> with <span id="..."></span>
212+ // replace deprecated <a name="..."></a> with <span id="..."></span> - needed for older specs
213213 line = line . replace ( / < a n a m e = " ( [ ^ " ] + ) " > < \/ a > / g, '<span id="$1"></span>' ) ;
214214
215215 line = line . split ( '\\|' ) . join ( '|' ) ; // was ¦
@@ -271,12 +271,14 @@ for (let l in lines) {
271271
272272 // fix relative links (to examples)
273273 if ( ! inCodeBlock && line . indexOf ( '](../examples/' ) >= 0 ) {
274+ // links to examples go to learn site, links to yaml files go to wrapper html
274275 line = line . replace ( / \( \. \. \/ e x a m p l e s \/ ( [ ^ ) ] + ) \) / g, function ( match , group1 ) {
275276 console . warn ( "example link" , group1 ) ;
276- //TODO: group1 = group1.replace('.yaml','.html');
277+ group1 = group1 . replace ( '.yaml' , '.html' ) ;
277278 return `(https://learn.openapis.org/examples/${ group1 } )` ;
278279 } )
279280 } else if ( ! inCodeBlock && line . indexOf ( '](../' ) >= 0 ) {
281+ // links to other sibling files go to github
280282 const regExp = / \( ( \. \. [ ^ ) ] + ) \) / g;
281283 line = line . replace ( regExp , function ( match , group1 ) {
282284 console . warn ( 'relative link' , group1 ) ;
0 commit comments