@@ -86,8 +86,18 @@ function preface(title,options) {
8686 ] ,
8787 } ,
8888 ] ,
89- //TODO: remove localBiblio once Specref PR https://github.com/tobie/specref/pulls/ralfhandl is merged
9089 localBiblio : {
90+ "OpenAPI-Learn" : {
91+ title : "OpenAPI - Getting started, and the specification explained" ,
92+ href : "https://learn.openapis.org/" ,
93+ publisher : "OpenAPI Initiative"
94+ } ,
95+ "OpenAPI-Registry" : {
96+ title : "OpenAPI Initiative Registry" ,
97+ href : "https://spec.openapis.org/registry/index.html" ,
98+ publisher : "OpenAPI Initiative"
99+ } ,
100+ //TODO: remove localBiblio once Specref PRs https://github.com/tobie/specref/pulls/ralfhandl are merged
91101 CommonMark : {
92102 title : "CommonMark Spec" ,
93103 href : "https://spec.commonmark.org/" ,
@@ -96,7 +106,70 @@ function preface(title,options) {
96106 title : "CommonMark Spec Version 0.27" ,
97107 href : "https://spec.commonmark.org/0.27/" ,
98108 date : "2016-11-18" ,
99- authors : [ "John MacFarlane" ]
109+ authors : [ "John MacFarlane" ]
110+ } ,
111+ "IANA-HTTP-AUTHSCHEMES" : {
112+ href : "https://www.iana.org/assignments/http-authschemes/" ,
113+ title : "Hypertext Transfer Protocol (HTTP) Authentication Scheme Registry" ,
114+ publisher : "IANA"
115+ } ,
116+ "IANA-HTTP-STATUS-CODES" : {
117+ href : "https://www.iana.org/assignments/http-status-codes/" ,
118+ title : "Hypertext Transfer Protocol (HTTP) Status Code Registry" ,
119+ publisher : "IANA"
120+ } ,
121+ "JSON-Schema-Validation-04" : {
122+ authors : [ "Kris Zyp" , "Francis Galiegue" , "Gary Court" ] ,
123+ href : "https://datatracker.ietf.org/doc/html/draft-fge-json-schema-validation-00" ,
124+ publisher : "Internet Engineering Task Force (IETF)" ,
125+ status : "Internet-Draft" ,
126+ title : "JSON Schema: interactive and non interactive validation. Draft 4" ,
127+ date : "1 February 2013"
128+ } ,
129+ "JSON-Schema-05" : {
130+ authors : [ "Austin Wright" ] ,
131+ href : "https://datatracker.ietf.org/doc/html/draft-wright-json-schema-00" ,
132+ publisher : "Internet Engineering Task Force (IETF)" ,
133+ status : "Internet-Draft" ,
134+ title : "JSON Schema: A Media Type for Describing JSON Documents. Draft 5" ,
135+ date : "13 October 2016"
136+ } ,
137+ "JSON-Schema-Validation-05" : {
138+ authors : [ "Austin Wright" , "G. Luff" ] ,
139+ href : "https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00" ,
140+ publisher : "Internet Engineering Task Force (IETF)" ,
141+ status : "Internet-Draft" ,
142+ title : "JSON Schema Validation: A Vocabulary for Structural Validation of JSON. Draft 5" ,
143+ date : "13 October 2016"
144+ } ,
145+ "JSON-Schema-Validation-2020-12" : {
146+ authors : [ "Austin Wright" , "Henry Andrews" , "Ben Hutton" ] ,
147+ href : "https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00" ,
148+ publisher : "Internet Engineering Task Force (IETF)" ,
149+ status : "Internet-Draft" ,
150+ title : "JSON Schema Validation: A Vocabulary for Structural Validation of JSON. Draft 2020-12" ,
151+ date : "8 December 2020"
152+ } ,
153+ "OpenID Connect Core" : {
154+ authors : [ "N. Sakimura" , "J. Bradley" , "M. Jones" , "B. de Medeiros" , "C. Mortimore" ] ,
155+ title : "OpenID Connect Core 1.0 incorporating errata set 2" ,
156+ href : "https://openid.net/specs/openid-connect-core-1_0.html" ,
157+ publisher : "OpenID Foundation" ,
158+ status : "Final" ,
159+ date : "15 December 2023"
160+ } ,
161+ "OpenID Connect Discovery" : {
162+ authors : [ "N. Sakimura" , "J. Bradley" , "M. Jones" , "E. Jay" ] ,
163+ title : "OpenID Connect Discovery 1.0 incorporating errata set 2" ,
164+ href : "https://openid.net/specs/openid-connect-discovery-1_0.html" ,
165+ publisher : "OpenID Foundation" ,
166+ status : "Final" ,
167+ date : "15 December 2023"
168+ } ,
169+ "SPDX" : {
170+ href : "https://spdx.org/licenses/" ,
171+ title : "SPDX License List" ,
172+ publisher : "Linux Foundation"
100173 }
101174 }
102175 } ;
@@ -128,6 +201,7 @@ function preface(title,options) {
128201 preface += 'table tr:nth-child(2n) { background-color: #f6f8fa; }' ;
129202 preface += 'pre { background-color: #f6f8fa !important; }' ;
130203 preface += 'code { color: #c83500 } th code { color: inherit }' ;
204+ preface += 'a.bibref { text-decoration: underline;}' ;
131205 preface += fs . readFileSync ( path . resolve ( __dirname , 'gist.css' ) , 'utf8' ) . split ( '\n' ) . join ( ' ' ) ;
132206 preface += '</style>' ;
133207 preface += `<h1 id="title">${ title . split ( '|' ) [ 0 ] } </h1>` ;
@@ -284,31 +358,14 @@ for (let l in lines) {
284358 line = line . replace ( '[JSON Pointer]' , 'JSON Pointer [RFC6901]' ) ; // only in 2.0.md
285359 line = line . replace ( '[media type range](https://tools.ietf.org/html/rfc7231#appendix-D) ' , 'media type range, see [RFC7231](https://tools.ietf.org/html/rfc7231#appendix-D), ' ) ;
286360
287- if ( line . indexOf ( '[RFC' ) >= 0 ) {
288- // also detect [RFC4648 §3.2] etc. in 3.0.4.md and 3.1.1.md
289- //TODO: TDC decision: fix in source markdown
290- line = line . replace ( / \[ R F C ? ( [ 0 - 9 ] { 1 , 5 } ) ( § [ 0 - 9 . - ] + ) ? \] / g, function ( match , group1 ) {
291- //TODO: use string pattern with $1 instead of function
292- return '[[RFC' + group1 + ']]' ;
293- } ) ;
294- }
295-
296- //TODO: TDC decision: fix unconventional references to RFCs in 3.0.4 and 3.1.1, for example
297- // [RFC3986 §5.1.2 – 5.1.4](https://tools.ietf.org/html/rfc3986#section-5.1.2)
298- // RFC6570 [mentions](https://www.rfc-editor.org/rfc/rfc6570.html#section-2.4.2)
299- // [are not](https://datatracker.ietf.org/doc/html/rfc3986#appendix-A)
300- // [special behavior](https://www.rfc-editor.org/rfc/rfc1866#section-8.2.1)
301- // [RFC6570 considers to be _undefined_](https://datatracker.ietf.org/doc/html/rfc6570#section-2.3)
302-
303- //TODO: TDC decision: fix non-link mentions of RFCs etc. in 3.0.4 and 3.1.1, for example
304- // RFC3986's definition of [reserved](https://datatracker.ietf.org/doc/html/rfc3986#section-2.2)
361+ line = line . replace ( / \[ R F C ? ( [ 0 - 9 ] { 1 , 5 } ) \] \( / g, '[[RFC$1]](' ) ;
305362
306363 // harmonize RFC URLs
307364 //TODO: harmonize to https://www.rfc-editor.org/rfc/rfc*
308365 line = line . replaceAll ( '](http://' , '](https://' ) ;
309366 line = line . replace ( 'https://www.ietf.org/rfc/rfc2119.txt' , 'https://tools.ietf.org/html/rfc2119' ) ; // only in 2.0.md
310367 line = line . replace ( / h t t p s : \/ \/ w w w .r f c - e d i t o r .o r g \/ r f c \/ r f c ( [ 0 - 9 ] { 1 , 5 } ) ( \. h t m l ) ? / g, 'https://tools.ietf.org/html/rfc$1' ) ;
311- line = line . replaceAll ( 'https://datatracker.ietf.org/doc/html/rfc ' , 'https://tools.ietf.org/html/rfc ' ) ;
368+ line = line . replaceAll ( 'https://datatracker.ietf.org/doc/html/' , 'https://tools.ietf.org/html/' ) ;
312369
313370 // handle url fragments in RFC links and construct section links as well as RFC links
314371 line = line . replace ( / \] \] \( h t t p s : \/ \/ t o o l s .i e t f .o r g \/ h t m l \/ r f c ( [ 0 - 9 ] { 1 , 5 } ) \/ ? ( \# [ ^ ) ] * ) ? \) / g, function ( match , rfcNumber , fragment ) {
@@ -328,9 +385,23 @@ for (let l in lines) {
328385 line = line . replace ( '[CommonMark 0.27](https://spec.commonmark.org/0.27/)' , '[[CommonMark-0.27]]' ) ;
329386 line = line . replace ( '[CommonMark syntax](https://spec.commonmark.org/)' , '[[CommonMark]] syntax' ) ;
330387 line = line . replace ( 'CommonMark markdown formatting' , '[[CommonMark]] markdown formatting' ) ;
331- line = line . replace ( 'consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4)' , 'consult [[html401]] [Section 17.13.4](http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4)' ) ;
332- //TODO
333- line = line . replace ( / Y A M L v e r s i o n \[ 1 \. 2 \] \( h t t p s : \/ \/ ( w w w \. ) ? y a m l \. o r g \/ s p e c \/ 1 \. 2 \/ s p e c \. h t m l \) / , '[[YAML]] version 1.2' ) ;
388+ line = line . replace ( 'consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4)' , 'consult [[HTML401]] [Section 17.13.4](http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4)' ) ;
389+ line = line . replace ( '[IANA Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)' , '[[IANA-HTTP-STATUS-CODES|IANA Status Code Registry]]' ) ;
390+ line = line . replace ( '[IANA Authentication Scheme registry](https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml)' , '[[IANA-HTTP-AUTHSCHEMES]]' ) ;
391+ line = line . replace ( '[JSON Schema Specification Draft 4](https://json-schema.org/)' , '[[JSON-Schema-04|JSON Schema Specification Draft 4]]' ) ;
392+ line = line . replace ( '[JSON Schema Core](https://tools.ietf.org/html/draft-zyp-json-schema-04)' , '[[JSON-Schema-04|JSON Schema Core]]' ) ;
393+ line = line . replace ( '[JSON Schema Validation](https://tools.ietf.org/html/draft-fge-json-schema-validation-00)' , '[[JSON-Schema-Validation-04|JSON Schema Validation]]' ) ;
394+ line = line . replace ( '[JSON Schema Specification Wright Draft 00](https://json-schema.org/)' , '[[JSON-Schema-05|JSON Schema Specification Wright Draft 00]]' ) ;
395+ line = line . replace ( '[JSON Schema Core](https://tools.ietf.org/html/draft-wright-json-schema-00)' , '[[JSON-Schema-05|JSON Schema Core]]' ) ;
396+ line = line . replace ( '[JSON Schema Validation](https://tools.ietf.org/html/draft-wright-json-schema-validation-00)' , '[[JSON-Schema-Validation-05|JSON Schema Validation]]' ) ;
397+ line = line . replace ( '[JSON Schema Specification Draft 2020-12](https://tools.ietf.org/html/draft-bhutton-json-schema-00)' , '[[JSON-Schema-2020-12|JSON Schema Specification Draft 2020-12]]' ) ;
398+ line = line . replace ( '[JSON Schema Core](https://tools.ietf.org/html/draft-bhutton-json-schema-00)' , '[[JSON-Schema-2020-12|JSON Schema Core]]' ) ;
399+ line = line . replace ( '[JSON Schema Validation](https://tools.ietf.org/html/draft-bhutton-json-schema-validation-00)' , '[[JSON-Schema-Validation-2020-12|JSON Schema Validation]]' ) ;
400+ line = line . replace ( '[SPDX](https://spdx.org/licenses/)' , '[[SPDX]]' ) ;
401+ line = line . replace ( '[XML namespaces](https://www.w3.org/TR/xml-names11/)' , '[[xml-names11|XML namespaces]]' ) ;
402+ line = line . replace ( 'JSON standards. YAML,' , '[[RFC7159|JSON]] standards. [[YAML|YAML]],' ) ; // 2.0.md only
403+ line = line . replace ( 'JSON or YAML format.' , '[[RFC7159|JSON]] or [[YAML|YAML]] format.' ) ;
404+ line = line . replace ( / Y A M L v e r s i o n \[ 1 \. 2 \] \( h t t p s : \/ \/ ( w w w \. ) ? y a m l \. o r g \/ s p e c \/ 1 \. 2 \/ s p e c \. h t m l \) / , '[[YAML|YAML version 1.2]]' ) ;
334405 }
335406
336407 if ( ! inCodeBlock && line . indexOf ( '](../' ) >= 0 ) {
@@ -378,8 +449,6 @@ for (let l in lines) {
378449
379450s = preface ( `OpenAPI Specification v${ argv . subtitle } | Introduction, Definitions, & More` , argv ) + '\n\n' + lines . join ( '\n' ) ;
380451let out = md . render ( s ) ;
381- out = out . replace ( / \[ ( [ R G B ] ) \] / g, function ( match , group1 ) {
382- console . warn ( 'Fixing' , match , group1 ) ;
383- return '[' + group1 + ']' ;
384- } ) ;
452+ out = out . replace ( / \[ ( [ R G B ] ) \] / g, '[$1]' ) ;
453+ out = out . replace ( '[[IANA-HTTP-AUTHSCHEMES]]' , '[[IANA-HTTP-AUTHSCHEMES|IANA Authentication Scheme registry]]' ) ;
385454console . log ( out ) ;
0 commit comments