diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-09-03 17:24:21 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-09-03 17:24:21 -0300 |
commit | 402e792e28a2fd872e7581c8e005ebb35a3eab36 (patch) | |
tree | 0557eb38620ae65df3ed6b913684ba6e16d7ae6b | |
parent | c7f6383e34c30b63e0e0b86f320f42f2c9a0bdb7 (diff) |
data: WikiInfo.canonicalMediaBase
-rw-r--r-- | src/data/composite/wiki-properties/canonicalBase.js | 16 | ||||
-rw-r--r-- | src/data/composite/wiki-properties/index.js | 1 | ||||
-rw-r--r-- | src/data/things/wiki-info.js | 17 |
3 files changed, 21 insertions, 13 deletions
diff --git a/src/data/composite/wiki-properties/canonicalBase.js b/src/data/composite/wiki-properties/canonicalBase.js new file mode 100644 index 00000000..81740d6c --- /dev/null +++ b/src/data/composite/wiki-properties/canonicalBase.js @@ -0,0 +1,16 @@ +import {isURL} from '#validators'; + +export default function() { + return { + flags: {update: true, expose: true}, + update: {validate: isURL}, + expose: { + transform: (value) => + (value === null + ? null + : value.endsWith('/') + ? value + : value + '/'), + }, + }; +} diff --git a/src/data/composite/wiki-properties/index.js b/src/data/composite/wiki-properties/index.js index e8f109d3..57a2b8f2 100644 --- a/src/data/composite/wiki-properties/index.js +++ b/src/data/composite/wiki-properties/index.js @@ -4,6 +4,7 @@ // #composite/data, and #composite/wiki-data. export {default as annotatedReferenceList} from './annotatedReferenceList.js'; +export {default as canonicalBase} from './canonicalBase.js'; export {default as color} from './color.js'; export {default as commentatorArtists} from './commentatorArtists.js'; export {default as constitutibleArtwork} from './constitutibleArtwork.js'; diff --git a/src/data/things/wiki-info.js b/src/data/things/wiki-info.js index b6057735..7fb6a350 100644 --- a/src/data/things/wiki-info.js +++ b/src/data/things/wiki-info.js @@ -10,12 +10,12 @@ import { isContributionPresetList, isLanguageCode, isName, - isURL, } from '#validators'; import {exitWithoutDependency, exposeConstant} from '#composite/control-flow'; import { + canonicalBase, contentString, fileExtension, flag, @@ -64,18 +64,8 @@ export class WikiInfo extends Thing { update: {validate: isLanguageCode}, }, - canonicalBase: { - flags: {update: true, expose: true}, - update: {validate: isURL}, - expose: { - transform: (value) => - (value === null - ? null - : value.endsWith('/') - ? value - : value + '/'), - }, - }, + canonicalBase: canonicalBase(), + canonicalMediaBase: canonicalBase(), wikiWallpaperFileExtension: fileExtension('jpg'), wikiWallpaperStyle: simpleString(), @@ -143,6 +133,7 @@ export class WikiInfo extends Thing { 'Default Language': {property: 'defaultLanguage'}, 'Canonical Base': {property: 'canonicalBase'}, + 'Canonical Media Base': {property: 'canonicalMediaBase'}, 'Wiki Wallpaper File Extension': {property: 'wikiWallpaperFileExtension'}, |