@@ -249,7 +249,7 @@ async function main() {
249
249
const output = new JsonFileWriter ( manifestFiles . httpHeaders ( "de" ) ) ;
250
250
const html = await getText ( "de" , baseUrl ) ;
251
251
const $ = loadHtml ( html ) ;
252
- const handleEnglishRow = ( $row : Cheerio < Element > , type : ManifestItemType ) => {
252
+ const handleGermanRow = ( $row : Cheerio < Element > , type : ManifestItemType ) => {
253
253
const $cols = $row . find ( "td" ) ;
254
254
if ( $cols . length === 0 ) return ;
255
255
const headerNames = normalizeHeaderName ( $cols . eq ( 0 ) . text ( ) ) ;
@@ -269,7 +269,39 @@ async function main() {
269
269
const $rows = element . find ( "tr" ) ;
270
270
for ( let row = 0 ; row < $rows . length ; row ++ ) {
271
271
const $row = $rows . eq ( row ) ;
272
- handleEnglishRow ( $row , ManifestItemType . HttpReqHeader ) ;
272
+ handleGermanRow ( $row , ManifestItemType . HttpReqHeader ) ;
273
+ }
274
+ }
275
+ output . close ( ) ;
276
+ }
277
+
278
+ // pt
279
+ {
280
+ const baseUrl = httpHeadersWikiURLs . pt ;
281
+ const output = new JsonFileWriter ( manifestFiles . httpHeaders ( "pt" ) ) ;
282
+ const html = await getText ( "pt" , baseUrl ) ;
283
+ const $ = loadHtml ( html ) ;
284
+ const handlePortgueseRow = ( $row : Cheerio < Element > , type : ManifestItemType ) => {
285
+ const $cols = $row . find ( "td" ) ;
286
+ if ( $cols . length === 0 ) return ;
287
+ const headerNames = normalizeHeaderName ( $cols . eq ( 0 ) . text ( ) ) ;
288
+ const description = getDescriptionMarkdown ( $cols . eq ( 1 ) , baseUrl ) ;
289
+ if ( ! description ) print . warn ( `header ${ headerNames [ 0 ] } has no description` ) ;
290
+ for ( let j = 0 ; j < headerNames . length ; j ++ ) {
291
+ const headerName = headerNames [ j ] ;
292
+ output . writeItem ( j === 0 ? [ type , headerName , description ] : [ type , headerName , - 1 ] ) ;
293
+ }
294
+ } ;
295
+
296
+ const $reqH2 = $ ( "h2 #Campos_de_resposta" ) ;
297
+ assertLength ( "request fields h2" , $reqH2 , 1 ) ;
298
+ const $tables = getNextTables ( $reqH2 . parent ( ) , "h2" ) ;
299
+ assertLength ( "request fields table" , $tables , 2 ) ;
300
+ for ( const element of $tables ) {
301
+ const $rows = element . find ( "tr" ) ;
302
+ for ( let row = 0 ; row < $rows . length ; row ++ ) {
303
+ const $row = $rows . eq ( row ) ;
304
+ handlePortgueseRow ( $row , ManifestItemType . HttpReqHeader ) ;
273
305
}
274
306
}
275
307
output . close ( ) ;
0 commit comments