@museumwnf/viewer-core 2.24.0 → 2.24.1
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 +9 -4
- package/src/legacySites.js +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@museumwnf/viewer-core",
|
|
3
|
-
"version": "2.24.
|
|
3
|
+
"version": "2.24.1",
|
|
4
4
|
"description": "Application engine for MWNF websites: turns a dataset.config.js into a mounted Vue application.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -42,10 +42,15 @@
|
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@vitejs/plugin-vue": "^6.0.10",
|
|
44
44
|
"@vue/test-utils": "^2.5.1",
|
|
45
|
-
"jsdom": "^
|
|
46
|
-
"vite": "^8.3.
|
|
45
|
+
"jsdom": "^31.0.0",
|
|
46
|
+
"vite": "^8.3.6",
|
|
47
47
|
"vitest": "^5.1.0",
|
|
48
|
-
"vue": "^3.5.
|
|
48
|
+
"vue": "^3.5.46",
|
|
49
49
|
"vue-router": "^5.4.0"
|
|
50
|
+
},
|
|
51
|
+
"overrides": {
|
|
52
|
+
"glob": "^14.0.7",
|
|
53
|
+
"editorconfig": "^4.0.2",
|
|
54
|
+
"minimatch": "^11.0.10"
|
|
50
55
|
}
|
|
51
56
|
}
|
package/src/legacySites.js
CHANGED
|
@@ -168,6 +168,16 @@ function publicationsRoute(path, url) {
|
|
|
168
168
|
return null
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
// A legacy address writes its language as legacy MWNF wrote it; the sites
|
|
172
|
+
// offer it as ISO 639-1. The two differ only for Swedish, Chinese and
|
|
173
|
+
// Slovenian; the other legacy codes are ISO already.
|
|
174
|
+
const LEGACY_LANGUAGES = { se: 'sv', ch: 'zh', si: 'sl' }
|
|
175
|
+
function isoLanguage(code) {
|
|
176
|
+
if (!/^[a-z]{2}$/i.test(code ?? '')) return null
|
|
177
|
+
const lang = code.toLowerCase()
|
|
178
|
+
return LEGACY_LANGUAGES[lang] ?? lang
|
|
179
|
+
}
|
|
180
|
+
|
|
171
181
|
// Legacy travels.museumwnf.org's Exhibition Trails: a country's or a theme's
|
|
172
182
|
// trails, a trail (`?id=<project>;<country>;<number>;<language>`) and an
|
|
173
183
|
// itinerary (`?id=<project>;<country>;<roman number>;<language>;<trail>`),
|
|
@@ -183,7 +193,8 @@ const TRAIL_TABS = ['desc', 'its', 'cur']
|
|
|
183
193
|
const ITINERARY_TABS = ['des', 'vl']
|
|
184
194
|
function travelsQuery(url, tabs, language) {
|
|
185
195
|
const tab = (url.searchParams.get('fl') ?? '').toLowerCase()
|
|
186
|
-
const
|
|
196
|
+
const lang = isoLanguage(language)
|
|
197
|
+
const query = [tabs.includes(tab) ? `tab=${tab}` : null, lang ? `lang=${lang}` : null]
|
|
187
198
|
const kept = query.filter(Boolean)
|
|
188
199
|
return kept.length ? `?${kept.join('&')}` : ''
|
|
189
200
|
}
|
|
@@ -252,7 +263,7 @@ function routeFor(row, url) {
|
|
|
252
263
|
if (RECORD_PAGES[row.family]) return RECORD_PAGES[row.family](path, url)
|
|
253
264
|
if (row.family === 'exhibition') {
|
|
254
265
|
const rest = path.split('/').filter(Boolean).slice(1)
|
|
255
|
-
const lang = /^[a-z]{2}$/.test(rest[0] ?? '') ? rest.shift() : null
|
|
266
|
+
const lang = /^[a-z]{2}$/.test(rest[0] ?? '') ? isoLanguage(rest.shift()) : null
|
|
256
267
|
return `/${rest.join('/')}${lang ? `?lang=${lang}` : ''}`
|
|
257
268
|
}
|
|
258
269
|
if (row.family === 'islamicart') {
|