@glossarist/concept-browser 0.7.16 → 0.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/generate-data.mjs +20 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glossarist/concept-browser",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.17",
|
|
4
4
|
"description": "Vue SPA for browsing Glossarist terminology datasets with cross-reference resolution, graph visualization, and multi-language support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -1126,21 +1126,32 @@ function processPages(config) {
|
|
|
1126
1126
|
|
|
1127
1127
|
const processedPages = processPages(config);
|
|
1128
1128
|
|
|
1129
|
-
// Auto-generate dataset about pages from {localPath}/about.md
|
|
1129
|
+
// Auto-generate dataset about pages from {localPath}/about-{lang}.md
|
|
1130
1130
|
const _pagesDir = path.join(PUBLIC, 'pages');
|
|
1131
1131
|
for (const ds of config.datasets || []) {
|
|
1132
1132
|
if (!ds.localPath) continue;
|
|
1133
|
-
const
|
|
1134
|
-
|
|
1135
|
-
const raw = fs.readFileSync(aboutSrc, 'utf8');
|
|
1136
|
-
const html = renderMarkdown(stripFrontmatter(raw));
|
|
1133
|
+
const dsDir = path.resolve(ROOT, ds.localPath);
|
|
1134
|
+
const defaultLang = (ds.languages || ['eng'])[0];
|
|
1137
1135
|
const route = `${ds.id}-about`;
|
|
1138
|
-
writeJson(path.join(_pagesDir, `${route}.json`), { title: 'About', html });
|
|
1139
|
-
console.log(` Auto-generated dataset about page: ${route}`);
|
|
1140
|
-
const uiLangs = (config.uiLanguages || []).map(l => l.code).filter(l => l !== 'eng');
|
|
1141
1136
|
const dsTranslations = ds.translations || {};
|
|
1137
|
+
|
|
1138
|
+
// Default-language about page: try about-{defaultLang}.md, fall back to about.md
|
|
1139
|
+
const defaultSrc = [
|
|
1140
|
+
path.join(dsDir, `about-${defaultLang}.md`),
|
|
1141
|
+
path.join(dsDir, 'about.md'),
|
|
1142
|
+
].find(p => fs.existsSync(p));
|
|
1143
|
+
|
|
1144
|
+
if (defaultSrc) {
|
|
1145
|
+
const raw = fs.readFileSync(defaultSrc, 'utf8');
|
|
1146
|
+
const html = renderMarkdown(stripFrontmatter(raw));
|
|
1147
|
+
writeJson(path.join(_pagesDir, `${route}.json`), { title: 'About', html });
|
|
1148
|
+
console.log(` Auto-generated dataset about page: ${route} (from ${path.basename(defaultSrc)})`);
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// Translated about pages for all non-default UI languages
|
|
1152
|
+
const uiLangs = (config.uiLanguages || []).map(l => l.code).filter(l => l !== defaultLang);
|
|
1142
1153
|
for (const lang of uiLangs) {
|
|
1143
|
-
const trAboutSrc = path.
|
|
1154
|
+
const trAboutSrc = path.join(dsDir, `about-${lang}.md`);
|
|
1144
1155
|
if (!fs.existsSync(trAboutSrc)) continue;
|
|
1145
1156
|
const trRaw = fs.readFileSync(trAboutSrc, 'utf8');
|
|
1146
1157
|
const trHtml = renderMarkdown(stripFrontmatter(trRaw));
|