22// Module core/render-biblio
33// renders the biblio data pre-processed in core/biblio
44
5- import { addId , getIntlData , showError , toId } from "./utils.js" ;
5+ import { addId , getIntlData , showError , toId , xmlEscape } from "./utils.js" ;
66import { biblio } from "./biblio.js" ;
77import { html } from "./import-maps.js" ;
88
@@ -34,6 +34,12 @@ const localizationStrings = {
3434 references : "Referencias" ,
3535 reference_not_found : "Referencia no encontrada." ,
3636 } ,
37+ fr : {
38+ info_references : "Références informatives" ,
39+ norm_references : "Références normatives" ,
40+ references : "Références" ,
41+ reference_not_found : "Référence non trouvée." ,
42+ } ,
3743 ja : {
3844 info_references : "参照用参考文献" ,
3945 norm_references : "規範的参考文献" ,
@@ -69,8 +75,6 @@ const REF_STATUSES = new Map([
6975 [ "WD" , "W3C Working Draft" ] ,
7076] ) ;
7177
72- const endWithDot = endNormalizer ( "." ) ;
73-
7478/** @param {Conf } conf */
7579export function run ( conf ) {
7680 const informs = Array . from ( conf . informativeReferences ) ;
@@ -225,19 +229,6 @@ function showRef(reference) {
225229 return result ;
226230}
227231
228- /**
229- * @param {string } endStr
230- * @returns {(str: string) => string }
231- */
232- function endNormalizer ( endStr ) {
233- return str => {
234- const trimmed = str . trim ( ) ;
235- const result =
236- ! trimmed || trimmed . endsWith ( endStr ) ? trimmed : trimmed + endStr ;
237- return result ;
238- } ;
239- }
240-
241232/** @param {BiblioData|string } ref */
242233function stringifyReference ( ref ) {
243234 if ( typeof ref === "string" ) return ref ;
@@ -259,7 +250,13 @@ function stringifyReference(ref) {
259250 }
260251 }
261252 if ( ref . publisher ) {
262- output = `${ output } ${ endWithDot ( ref . publisher ) } ` ;
253+ const pub = ref . publisher . trim ( ) . replace ( / \. $ / , "" ) ;
254+ output += ` ${ pub } ` ;
255+ if ( ref . pages ) output += `, pp. ${ xmlEscape ( ref . pages ) } ` ;
256+ if ( ! output . endsWith ( "." ) ) output += "." ;
257+ output += " " ;
258+ } else if ( ref . pages ) {
259+ output += `pp. ${ xmlEscape ( ref . pages ) } . ` ;
263260 }
264261 if ( ref . date ) output += `${ ref . date } . ` ;
265262 if ( ref . status ) output += `${ REF_STATUSES . get ( ref . status ) || ref . status } . ` ;
0 commit comments