From a38878aed94dcbed1e7de0752304ae7554b349bd Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 10 Oct 2024 12:07:41 -0500 Subject: [PATCH 1/3] CLDR-18001 site: add or fix link to redundant title - if the first H1 is the same as the title, change the href in the ToC to go to the entire page - If there isn't a redundant H1 , synthesize an entry in the ToC --- docs/site/assets/js/cldrsite.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/site/assets/js/cldrsite.js b/docs/site/assets/js/cldrsite.js index ff04052cd93..ef5c4bcece0 100644 --- a/docs/site/assets/js/cldrsite.js +++ b/docs/site/assets/js/cldrsite.js @@ -441,7 +441,13 @@ if (myPath === "sitemap.html") { mounted() { const t = this; siteDataPromise.then( - (d) => (t.tree.value = d), + (d) => { + t.tree.value = d; + // set style on first header if redundant + if (this.anchorElements[0]?.textContent === this.ourTitle) { + this.anchorElements[0].className = "redundantTitle"; + } + }, (e) => (t.status = e) ); }, @@ -475,7 +481,7 @@ if (myPath === "sitemap.html") { contents() { // For now we generate a flat map // this - const objects = this.anchorElements?.map( + let objects = this.anchorElements?.map( ({ textContent, id, tagName }) => ({ title: textContent, href: `#${id}`, @@ -484,6 +490,22 @@ if (myPath === "sitemap.html") { }) ); if (!objects?.length) return null; + if (objects[0].title === this.ourTitle) { + // redundant title - change the link to go to the entire page + objects[0].style = "headingH1 topTitle"; + objects[0].href = ""; + } else { + // synthesize a title entry in the ToC + objects = [ + { + title: this.ourTitle, + href: "", + children: null, + style: "headingH1 topTitle", + }, + ...objects, + ]; + } return objects; }, ourTitle() { From d55f4a5532b8ef62c33fb183b95f7a89007ee34b Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 10 Oct 2024 12:08:01 -0500 Subject: [PATCH 2/3] CLDR-18001 site: fix incorrect frontmatter --- docs/site/cldr-tc.md | 2 +- docs/site/development/development-process.md | 2 +- .../design-proposals/bcp-47-changes-draft.md | 2 +- ...and-other-calendar-support-intercalary-months-year-cycles.md | 2 +- .../design-proposals/delimiter-quotation-mark-proposal.md | 2 +- .../json-packaging-approved-by-the-cldr-tc-on-2015-03-25.md | 2 +- docs/site/development/updating-codes/un-literacy.md | 2 +- .../translation/displaynames/countryregion-territory-names.md | 2 +- docs/site/translation/displaynames/locale-option-names-key.md | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/site/cldr-tc.md b/docs/site/cldr-tc.md index 9d6c3422524..9f5e0c60993 100644 --- a/docs/site/cldr-tc.md +++ b/docs/site/cldr-tc.md @@ -1,5 +1,5 @@ --- -title: CLDR Technical Committee (TC) +title: "CLDR Technical Committee (TC)" --- # CLDR Technical Committee (TC) diff --git a/docs/site/development/development-process.md b/docs/site/development/development-process.md index 21df193f016..237666532fe 100644 --- a/docs/site/development/development-process.md +++ b/docs/site/development/development-process.md @@ -1,5 +1,5 @@ --- -title: Handling Tickets (bugs/enhancements) +title: 'Handling Tickets (bugs/enhancements)' --- # Handling Tickets (bugs/enhancements) diff --git a/docs/site/development/development-process/design-proposals/bcp-47-changes-draft.md b/docs/site/development/development-process/design-proposals/bcp-47-changes-draft.md index 4a619cb4c1f..513fca31aa3 100644 --- a/docs/site/development/development-process/design-proposals/bcp-47-changes-draft.md +++ b/docs/site/development/development-process/design-proposals/bcp-47-changes-draft.md @@ -1,5 +1,5 @@ --- -title: BCP 47 Changes (DRAFT) +title: 'BCP 47 Changes (DRAFT)' --- # BCP 47 Changes (DRAFT) diff --git a/docs/site/development/development-process/design-proposals/chinese-and-other-calendar-support-intercalary-months-year-cycles.md b/docs/site/development/development-process/design-proposals/chinese-and-other-calendar-support-intercalary-months-year-cycles.md index 5de16d1889b..cfe40ad77d1 100644 --- a/docs/site/development/development-process/design-proposals/chinese-and-other-calendar-support-intercalary-months-year-cycles.md +++ b/docs/site/development/development-process/design-proposals/chinese-and-other-calendar-support-intercalary-months-year-cycles.md @@ -1,5 +1,5 @@ --- -title: Chinese (and other) calendar support, intercalary months, year cycles +title: 'Chinese (and other) calendar support, intercalary months, year cycles' --- # Chinese (and other) calendar support, intercalary months, year cycles diff --git a/docs/site/development/development-process/design-proposals/delimiter-quotation-mark-proposal.md b/docs/site/development/development-process/design-proposals/delimiter-quotation-mark-proposal.md index f4a374605fd..6ed981f57bf 100644 --- a/docs/site/development/development-process/design-proposals/delimiter-quotation-mark-proposal.md +++ b/docs/site/development/development-process/design-proposals/delimiter-quotation-mark-proposal.md @@ -1,5 +1,5 @@ --- -title: Delimiter (Quotation Mark) Proposal +title: 'Delimiter (Quotation Mark) Proposal' --- # Delimiter (Quotation Mark) Proposal diff --git a/docs/site/development/development-process/design-proposals/json-packaging-approved-by-the-cldr-tc-on-2015-03-25.md b/docs/site/development/development-process/design-proposals/json-packaging-approved-by-the-cldr-tc-on-2015-03-25.md index 651182e390b..1e1355fd98c 100644 --- a/docs/site/development/development-process/design-proposals/json-packaging-approved-by-the-cldr-tc-on-2015-03-25.md +++ b/docs/site/development/development-process/design-proposals/json-packaging-approved-by-the-cldr-tc-on-2015-03-25.md @@ -1,5 +1,5 @@ --- -title: JSON Packaging (Approved by the CLDR TC on 2015-03-25) +title: 'JSON Packaging (Approved by the CLDR TC on 2015-03-25)' --- # JSON Packaging (Approved by the CLDR TC on 2015-03-25) diff --git a/docs/site/development/updating-codes/un-literacy.md b/docs/site/development/updating-codes/un-literacy.md index fa22b378a6d..fd9ef89d93a 100644 --- a/docs/site/development/updating-codes/un-literacy.md +++ b/docs/site/development/updating-codes/un-literacy.md @@ -1,5 +1,5 @@ --- -title: UN Literacy Data (CLDR BRS) +title: 'UN Literacy Data (CLDR BRS)' --- # UN Literacy Data (CLDR BRS) diff --git a/docs/site/translation/displaynames/countryregion-territory-names.md b/docs/site/translation/displaynames/countryregion-territory-names.md index 8fc00f01567..6ca70225484 100644 --- a/docs/site/translation/displaynames/countryregion-territory-names.md +++ b/docs/site/translation/displaynames/countryregion-territory-names.md @@ -1,5 +1,5 @@ --- -title: Country/Region (Territory) Names +title: 'Country/Region (Territory) Names' --- # Country/Region (Territory) Names diff --git a/docs/site/translation/displaynames/locale-option-names-key.md b/docs/site/translation/displaynames/locale-option-names-key.md index 256495b9dcf..daf9d3dc716 100644 --- a/docs/site/translation/displaynames/locale-option-names-key.md +++ b/docs/site/translation/displaynames/locale-option-names-key.md @@ -1,5 +1,5 @@ --- -title: Locale Option Names (Key) +title: 'Locale Option Names (Key)' --- # Locale Option Names (Key) From b41632c08043935ce87cb1ffafe7772513170eff Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 10 Oct 2024 12:58:50 -0500 Subject: [PATCH 3/3] CLDR-18001 site: updates to top title - related to CLDR-18017 - suppress redundant h1 (#), but add centered title - suppress title from ToC. Hide ToC if empty. --- docs/site/assets/css/page.css | 26 ++++++++++++++++++-------- docs/site/assets/js/cldrsite.js | 31 +++++++------------------------ 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/docs/site/assets/css/page.css b/docs/site/assets/css/page.css index 1cc5c4aa015..6f228830317 100644 --- a/docs/site/assets/css/page.css +++ b/docs/site/assets/css/page.css @@ -808,23 +808,21 @@ body.page .subpages a.hasChildren:after { } /* these are the ToC entries in the sidebar, according to what element they came from originally. */ -.pagecontents .headingH1 { - margin-left: 0em; -} +.pagecontents .headingH1, .pagecontents .headingH2 { - margin-left: 1em; + margin-left: 0em; } .pagecontents .headingH3 { - margin-left: 2em; + margin-left: 1em; } .pagecontents .headingH4 { - margin-left: 3em; + margin-left: 2em; } .pagecontents .headingH5 { - margin-left: 4em; + margin-left: 3em; } .pagecontents .headingH6 { - margin-left: 5em; + margin-left: 4em; } header { @@ -908,6 +906,10 @@ div.sitemap { padding-left: 0.25em; } +.topTitle { + display: none; +} + div.sitemap { height: 90%; } @@ -1010,6 +1012,14 @@ div > header { display: none !important; } +section.body h1.title { + text-align: center; +} + +section.body h1.redundantTitle { + display: none; +} + section.body h1 { font-size: 2em; line-height: 1.2; diff --git a/docs/site/assets/js/cldrsite.js b/docs/site/assets/js/cldrsite.js index ef5c4bcece0..686974d8902 100644 --- a/docs/site/assets/js/cldrsite.js +++ b/docs/site/assets/js/cldrsite.js @@ -330,14 +330,7 @@ const app = Vue.createApp( -
{{ ourTitle }}
- -
- - {{ ourTitle }} - -
- Site Map + Site Map `, }, @@ -489,23 +482,10 @@ if (myPath === "sitemap.html") { style: `heading${tagName}`, }) ); - if (!objects?.length) return null; - if (objects[0].title === this.ourTitle) { - // redundant title - change the link to go to the entire page - objects[0].style = "headingH1 topTitle"; - objects[0].href = ""; - } else { - // synthesize a title entry in the ToC - objects = [ - { - title: this.ourTitle, - href: "", - children: null, - style: "headingH1 topTitle", - }, - ...objects, - ]; + if (objects[0]?.title === this.ourTitle) { + objects = objects.slice(1); } + if (!objects?.length) return null; return objects; }, ourTitle() { @@ -521,9 +501,12 @@ if (myPath === "sitemap.html") { }, }, template: ` +
+

{{ ourTitle }}

`, }, {