From 386a0ae74fa42dc3b7fa72063f1edc4a047630e5 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Tue, 3 Sep 2024 14:52:07 -0500 Subject: [PATCH 1/3] CLDR-17803 docs/site: wip on generation --- .github/workflows/site.yml | 2 + docs/site/.gitignore | 2 + docs/site/_layouts/page.html | 1 + docs/site/assets/js/build.mjs | 60 +++++++++++++++ docs/site/package-lock.json | 120 +++++++++++++++++++++++++++++ docs/site/package.json | 18 +++++ tools/scripts/web/docker/README.md | 4 + 7 files changed, 207 insertions(+) create mode 100644 docs/site/.gitignore create mode 100644 docs/site/assets/js/build.mjs create mode 100644 docs/site/package-lock.json create mode 100644 docs/site/package.json diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml index 87f2021f978..3f7946caf03 100644 --- a/.github/workflows/site.yml +++ b/.github/workflows/site.yml @@ -34,6 +34,8 @@ jobs: bundler-cache: true - name: Setup Jekyll run: 'gem install bundler jekyll kramdown-parser-gfm webrick' + - name: Setup assets + run: 'cd docs/site/assets && npm ci && npm run build' - name: Build cldr.pages.dev run: 'cd docs/site && jekyll build' - name: Pre-install Wrangler diff --git a/docs/site/.gitignore b/docs/site/.gitignore new file mode 100644 index 00000000000..9fbbb2c6f27 --- /dev/null +++ b/docs/site/.gitignore @@ -0,0 +1,2 @@ +/node_modules +/assets/json diff --git a/docs/site/_layouts/page.html b/docs/site/_layouts/page.html index adff46349b0..dd97e1fa7bd 100644 --- a/docs/site/_layouts/page.html +++ b/docs/site/_layouts/page.html @@ -31,6 +31,7 @@ + + diff --git a/docs/site/assets/css/page.css b/docs/site/assets/css/page.css index e0f982f007a..2c6a3403a17 100644 --- a/docs/site/assets/css/page.css +++ b/docs/site/assets/css/page.css @@ -17,14 +17,23 @@ header > div { display: table-cell; } -header > div.nav { - display: block !important; -} - header > div.icon { flex-grow: 1; } +header .title { + color: white; + font-size: 1.5em; +} + +header .nav, header .nav > div { + display: inline; +} + +header .nav a, header .nav .title { + color: white; +} + footer { width: 100%; margin-left: auto; diff --git a/docs/site/assets/js/cldrsite.js b/docs/site/assets/js/cldrsite.js new file mode 100644 index 00000000000..623a7cbaaa2 --- /dev/null +++ b/docs/site/assets/js/cldrsite.js @@ -0,0 +1,207 @@ +const { ref } = Vue; + +// site management + +/** replace a/b/c.md with a/b */ +function path2dir(p) { + const dir = p.split('/').slice(0,-1).join('/'); + return dir; +} + +/** replace a/b/c.md with a/b/c.html */ +function md2html(p) { + return (p.replace(/\.md$/,'.html')); +} + +/** replace a/b/c.html with a/b/c.md */ +function html2md(p) { + return (p.replace(/\.html$/,'.md')); +} + +/** load and cook the site data */ +async function siteData() { + // load the json + const d = await fetch('/assets/json/tree.json'); + const j = await d.json(); + const { all } = j; + + // 'all' is an array of { title, fullPath } entries. + // Flat list of paths + const allPaths = all.map(({fullPath})=>(fullPath)); + // Find all 'directories' (ending with /) + const allDirs = new Set(); + allPaths.forEach(p => { + const segs = p.split('/').slice(0,-1); // ['', 'dir1'] + for(let n=0; n<=segs.length; n++) { + // add all parent paths, so: '', dir1, dir1/dir2 etc. + const subpath = segs.slice(0,n).join('/'); + allDirs.add(subpath); + } + }); + j.allDirs = {}; + j.allIndexes = []; + // allDirs: '', index, downloads, etc… + allDirs.forEach(dir => { + // presumed index page: /downloads -> /downloads.md + // also / -> /index.md + const dirIndex = `${dir || 'index'}.md`; + // console.dir({dir, dirIndex}); + if (allPaths.indexOf(dirIndex) !== -1) { + j.allDirs[dir] = {index: dirIndex}; + j.allIndexes.push(dirIndex); + } else { + console.error(`No index page: ${dirIndex}`); + j.allDirs[dir] = {}; + } + j.allDirs[dir].pages = []; + }); + allPaths.forEach(p => { + const dir = path2dir(p); + j.allDirs[dir].pages.push(p); + }); + // map md -> title + j.title = {}; + all.forEach(({title, fullPath}) => j.title[fullPath] = title); + return j; +} + + +const app = Vue.createApp({ + setup(props) { + const tree = ref({}); + const status = ref(null); + + return { + tree, + status, + } + }, + mounted() { + const t = this; + siteData().then(d => t.tree.value = d, e => t.status = e); + }, + props: { + path: String, + }, + computed: { + mdPath() { + if(this.path) { + return html2md(this.path) + } + return null; + }, + ourDir() { + if(this.path) { + return path2dir(this.path); + } + return ''; + }, + ourIndex() { + if(this.tree?.value) { + // first ARE we an index page? + if (this.tree.value.allIndexes.indexOf(this.mdPath) != -1) { + return this.mdPath; // we are an index + } + return this.tree.value.allDirs[this.ourDir].index; + } + return null; + }, + ourIndexHtml() { + if (this.ourIndex) { + return md2html(this.ourIndex); + } else { + return null; + } + }, + ourIndexTitle() { + if (this.ourIndex && this.tree?.value) { + return this.tree.value.title[this.ourIndex] || this.ourIndex; + } else { + return null; + } + }, + ourTitle() { + if (this.tree?.value) { + if (this.path === '') return this.rootTitle; + return this.tree.value.title[html2md(this.path)]; + } + }, + // title of root + rootTitle() { + return this.tree?.value?.title['index.md']; + }, + // list of pages for siblings of this dir + siblingPages() { + if (!this.tree?.value) return []; + const dirForPage = this.ourDir; + let thePages = this.tree?.value?.allDirs[dirForPage].pages ?? []; + if (dirForPage === '') { + thePages = [...thePages, ...this.tree?.value?.allDirs['index'].pages]; + } + const c = new Intl.Collator([]); + return ( thePages ) + .map((path) => ({ + path, + html: md2html(path), + title: this.tree.value.title[path] ?? path, + })) + .sort((a, b) => c.compare(a.title, b.title)); + }, + }, + template: `
+
{{ status }}
+
Loading…
+ + {{ rootTitle }} | + + + + + {{ ourIndexTitle }} + + | + + {{ ourTitle }} + +
` +}, { + // path of / goes to /index.html + path: (window.location.pathname.slice(1) || 'index.html'), +}); + +app.component( + 'CldrPage', + { + setup() { + + }, + template: `

Hello

+ ` + } +); + +app.component( + 'CldrList', + { + setup() { + + }, + template: ` +

Hullo

+ ` + } +); + + +app.mount('#nav'); diff --git a/docs/site/development.md b/docs/site/development.md new file mode 100644 index 00000000000..3a7243a90f9 --- /dev/null +++ b/docs/site/development.md @@ -0,0 +1,5 @@ +--- +title: CLDR Development +--- + +Development pages diff --git a/docs/site/development/development-process.md b/docs/site/development/development-process.md new file mode 100644 index 00000000000..93787983a16 --- /dev/null +++ b/docs/site/development/development-process.md @@ -0,0 +1,5 @@ +--- +title: CLDR Development Process +--- + +Pages related to our development process diff --git a/docs/site/downloads.md b/docs/site/downloads.md new file mode 100644 index 00000000000..c0ba26dd517 --- /dev/null +++ b/docs/site/downloads.md @@ -0,0 +1,4 @@ +--- +title: CLDR Downloads +--- + diff --git a/docs/site/index/corrigenda.md b/docs/site/index/corrigenda.md index 1359fe007ae..7da7241fe63 100644 --- a/docs/site/index/corrigenda.md +++ b/docs/site/index/corrigenda.md @@ -1,5 +1,5 @@ --- -title: CLDR Releases/Downloads +title: Corrigenda and Errata --- # Corrigenda and Errata @@ -15,4 +15,4 @@ At this time, there is only one Corrigendum: Each release of CLDR is a stable release and may be used as reference material or cited as a normative reference by other specifications. Each version, once published, is absolutely stable and will never change. However, implementations may - and are encouraged to - apply fixes for corrigenda and errata to their use of an appropriate version. For example, an implementation may claim conformance to "CLDR 1.3, as amended by Corrigendum 1". -![Unicode copyright](https://www.unicode.org/img/hb_notice.gif) \ No newline at end of file +![Unicode copyright](https://www.unicode.org/img/hb_notice.gif) diff --git a/docs/site/package-lock.json b/docs/site/package-lock.json index dc1b0fdd488..61e53a3ef3b 100644 --- a/docs/site/package-lock.json +++ b/docs/site/package-lock.json @@ -10,9 +10,148 @@ "license": "Unicode-3.0", "dependencies": { "gray-matter": "^4.0.3", - "petite-vue": "^0.4.1" + "vue": "^3.5.0" } }, + "node_modules/@babel/helper-string-parser": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", + "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.6.tgz", + "integrity": "sha512-trGdfBdbD0l1ZPmcJ83eNxB9rbEax4ALFTF7fN386TMYbeCQbyme5cOEXQhbGXKebwGaB/J52w1mrklMcbgy6Q==", + "dependencies": { + "@babel/types": "^7.25.6" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.25.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.6.tgz", + "integrity": "sha512-/l42B1qxpG6RdfYf343Uw1vmDjeNhneUXtzhojE7pDgfpEypmRhI6j1kr17XCVv4Cgl9HdAiQY2x0GwKm7rWCw==", + "dependencies": { + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==" + }, + "node_modules/@vue/compiler-core": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.0.tgz", + "integrity": "sha512-ja7cpqAOfw4tyFAxgBz70Z42miNDeaqTxExTsnXDLomRpqfyCgyvZvFp482fmsElpfvsoMJUsvzULhvxUTW6Iw==", + "dependencies": { + "@babel/parser": "^7.25.3", + "@vue/shared": "3.5.0", + "entities": "^4.5.0", + "estree-walker": "^2.0.2", + "source-map-js": "^1.2.0" + } + }, + "node_modules/@vue/compiler-dom": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.0.tgz", + "integrity": "sha512-xYjUybWZXl+1R/toDy815i4PbeehL2hThiSGkcpmIOCy2HoYyeeC/gAWK/Y/xsoK+GSw198/T5O31bYuQx5uvQ==", + "dependencies": { + "@vue/compiler-core": "3.5.0", + "@vue/shared": "3.5.0" + } + }, + "node_modules/@vue/compiler-sfc": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.0.tgz", + "integrity": "sha512-B9DgLtrqok2GLuaFjLlSL15ZG3ZDBiitUH1ecex9guh/ZcA5MCdwuVE6nsfQxktuZY/QY0awJ35/ripIviCQTQ==", + "dependencies": { + "@babel/parser": "^7.25.3", + "@vue/compiler-core": "3.5.0", + "@vue/compiler-dom": "3.5.0", + "@vue/compiler-ssr": "3.5.0", + "@vue/shared": "3.5.0", + "estree-walker": "^2.0.2", + "magic-string": "^0.30.11", + "postcss": "^8.4.44", + "source-map-js": "^1.2.0" + } + }, + "node_modules/@vue/compiler-ssr": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.0.tgz", + "integrity": "sha512-E263QZmA1dqRd7c3u/sWTLRMpQOT0aZ8av/L9SoD/v/BVMZaWFHPUUBswS+bzrfvG2suJF8vSLKx6k6ba5SUdA==", + "dependencies": { + "@vue/compiler-dom": "3.5.0", + "@vue/shared": "3.5.0" + } + }, + "node_modules/@vue/reactivity": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.0.tgz", + "integrity": "sha512-Ew3F5riP3B3ZDGjD3ZKb9uZylTTPSqt8hAf4sGbvbjrjDjrFb3Jm15Tk1/w7WwTE5GbQ2Qhwxx1moc9hr8A/OQ==", + "dependencies": { + "@vue/shared": "3.5.0" + } + }, + "node_modules/@vue/runtime-core": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.0.tgz", + "integrity": "sha512-mQyW0F9FaNRdt8ghkAs+BMG3iQ7LGgWKOpkzUzR5AI5swPNydHGL5hvVTqFaeMzwecF1g0c86H4yFQsSxJhH1w==", + "dependencies": { + "@vue/reactivity": "3.5.0", + "@vue/shared": "3.5.0" + } + }, + "node_modules/@vue/runtime-dom": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.0.tgz", + "integrity": "sha512-NQQXjpdXgyYVJ2M56FJ+lSJgZiecgQ2HhxhnQBN95FymXegRNY/N2htI7vOTwpP75pfxhIeYOJ8mE8sW8KAW6A==", + "dependencies": { + "@vue/reactivity": "3.5.0", + "@vue/runtime-core": "3.5.0", + "@vue/shared": "3.5.0", + "csstype": "^3.1.3" + } + }, + "node_modules/@vue/server-renderer": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.0.tgz", + "integrity": "sha512-HyDIFUg+l7L4PKrEnJlCYWHUOlm6NxZhmSxIefZ5MTYjkIPfDfkwhX7hqxAQHfgIAE1uLMLQZwuNR/ozI0NhZg==", + "dependencies": { + "@vue/compiler-ssr": "3.5.0", + "@vue/shared": "3.5.0" + }, + "peerDependencies": { + "vue": "3.5.0" + } + }, + "node_modules/@vue/shared": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.0.tgz", + "integrity": "sha512-m9IgiteBpCkFaMNwCOBkFksA7z8QiKc30ooRuoXWUFRDu0mGyNPlFHmbncF0/Kra1RlX8QrmBbRaIxVvikaR0Q==" + }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -21,6 +160,22 @@ "sprintf-js": "~1.0.2" } }, + "node_modules/csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -33,6 +188,11 @@ "node": ">=4" } }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" + }, "node_modules/extend-shallow": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", @@ -86,10 +246,62 @@ "node": ">=0.10.0" } }, - "node_modules/petite-vue": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/petite-vue/-/petite-vue-0.4.1.tgz", - "integrity": "sha512-/gtYKQe9r1OV4IEwn2RsPXAHgFTe1nVq4QhldAP6/l8DSe9I754K6Oe1+Ff6dbnT5P8X2XP7PTUZkGRz5uFnFQ==" + "node_modules/magic-string": { + "version": "0.30.11", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.11.tgz", + "integrity": "sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.0.tgz", + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==" + }, + "node_modules/postcss": { + "version": "8.4.44", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.44.tgz", + "integrity": "sha512-Aweb9unOEpQ3ezu4Q00DPvvM2ZTUitJdNKeP/+uQgr1IBIqu574IaZoURId7BKtWMREwzKa9OgzPzezWGPWFQw==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.0.1", + "source-map-js": "^1.2.0" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } }, "node_modules/section-matter": { "version": "1.0.0", @@ -103,6 +315,14 @@ "node": ">=4" } }, + "node_modules/source-map-js": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", + "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -115,6 +335,34 @@ "engines": { "node": ">=0.10.0" } + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "engines": { + "node": ">=4" + } + }, + "node_modules/vue": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.0.tgz", + "integrity": "sha512-1t70favYoFijwfWJ7g81aTd32obGaAnKYE9FNyMgnEzn3F4YncRi/kqAHHKloG0VXTD8vBYMhbgLKCA+Sk6QDw==", + "dependencies": { + "@vue/compiler-dom": "3.5.0", + "@vue/compiler-sfc": "3.5.0", + "@vue/runtime-dom": "3.5.0", + "@vue/server-renderer": "3.5.0", + "@vue/shared": "3.5.0" + }, + "peerDependencies": { + "typescript": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } } } } diff --git a/docs/site/package.json b/docs/site/package.json index 455523af7a1..f4095933d42 100644 --- a/docs/site/package.json +++ b/docs/site/package.json @@ -13,6 +13,6 @@ "private": true, "dependencies": { "gray-matter": "^4.0.3", - "petite-vue": "^0.4.1" + "vue": "^3.5.0" } }