@rr0/cms 0.3.47 → 0.3.49
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.
|
@@ -66,14 +66,14 @@ export class DataContentVisitor {
|
|
|
66
66
|
const contents = doc.querySelector(".contents");
|
|
67
67
|
if (contents) {
|
|
68
68
|
const imgEl = contents.querySelector("img");
|
|
69
|
-
const
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
69
|
+
const eventCaption = event.name;
|
|
70
|
+
const eventSsrc = event.url;
|
|
71
|
+
if (imgEl && ![imgEl.src, path.join("/", path.dirname(context.file.name), imgEl.src)].includes(eventSsrc)) {
|
|
72
72
|
const imgEl = doc.createElement("img");
|
|
73
|
-
imgEl.src =
|
|
73
|
+
imgEl.src = eventSsrc;
|
|
74
74
|
imgEl.alt = event.title;
|
|
75
75
|
const figcaptionEl = doc.createElement("figcaption");
|
|
76
|
-
figcaptionEl.innerHTML =
|
|
76
|
+
figcaptionEl.innerHTML = eventCaption;
|
|
77
77
|
await this.eventRenderer.renderEnd(context, event, figcaptionEl);
|
|
78
78
|
const figureEl = doc.createElement("figure");
|
|
79
79
|
figureEl.append(imgEl);
|
|
@@ -61,6 +61,7 @@ export const countryMessageList_en = {
|
|
|
61
61
|
kr: southKorea_en,
|
|
62
62
|
ma: CountryMessages.create("Morocco"),
|
|
63
63
|
mx: CountryMessages.create("Mexico"),
|
|
64
|
+
my: CountryMessages.create("Malaysia"),
|
|
64
65
|
mz: mozambique_en,
|
|
65
66
|
nl: CountryMessages.create("Netherlands"),
|
|
66
67
|
no: CountryMessages.create("Norway"),
|
|
@@ -64,6 +64,7 @@ export const countryMessageList_fr = {
|
|
|
64
64
|
kr: southKorea_fr,
|
|
65
65
|
ma: CountryMessages.create("Maroc"),
|
|
66
66
|
mx: CountryMessages.create("Mexique"),
|
|
67
|
+
my: CountryMessages.create("Malaisie"),
|
|
67
68
|
mz: mozambique_fr,
|
|
68
69
|
nl: CountryMessages.create("Pays-Bas"),
|
|
69
70
|
no: CountryMessages.create("Norvège"),
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { HtmlRR0Context } from "../RR0Context.js";
|
|
2
2
|
import { CountryCode, Occupation, People } from "@rr0/data";
|
|
3
3
|
export declare class PeopleHtmlRenderer {
|
|
4
|
-
protected defaultPreviewFileNames: string[];
|
|
5
|
-
constructor(defaultPreviewFileNames?: string[]);
|
|
6
4
|
renderLink(context: HtmlRR0Context, people: People, pseudoPeopleList: People[], allCountries: Set<CountryCode>, occupations: Set<Occupation>, filterOccupations?: Occupation[], content?: string): HTMLElement;
|
|
7
5
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { Gender } from "@rr0/common";
|
|
3
|
+
import { AbstractDataFactory } from "@rr0/data";
|
|
3
4
|
export class PeopleHtmlRenderer {
|
|
4
|
-
constructor(defaultPreviewFileNames = ["portrait.jpg", "portrait.gif", "portrait.png", "portrait.webp"]) {
|
|
5
|
-
this.defaultPreviewFileNames = defaultPreviewFileNames;
|
|
6
|
-
}
|
|
7
5
|
renderLink(context, people, pseudoPeopleList, allCountries, occupations, filterOccupations = [], content) {
|
|
8
6
|
var _a, _b, _c;
|
|
9
7
|
const dirName = people.dirName;
|
|
@@ -73,7 +71,7 @@ export class PeopleHtmlRenderer {
|
|
|
73
71
|
let portraitUrl = people.image;
|
|
74
72
|
const imageEvents = events.filter(event => event.eventType === "image");
|
|
75
73
|
if (!portraitUrl) {
|
|
76
|
-
const portraitEvent = imageEvents.find(event =>
|
|
74
|
+
const portraitEvent = imageEvents.find(event => AbstractDataFactory.defaultPreviewFileNames.includes(event.url));
|
|
77
75
|
if (portraitEvent) {
|
|
78
76
|
portraitUrl = path.join("/", people.dirName, portraitEvent.url);
|
|
79
77
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@rr0/cms",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"author": "Jérôme Beau <rr0@rr0.org> (https://rr0.org)",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.49",
|
|
6
6
|
"description": "RR0 Content Management System (CMS)",
|
|
7
7
|
"exports": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"preview": "vite preview --host",
|
|
24
24
|
"build": "rm -Rf dist && tsc --project tsconfig.prod.json",
|
|
25
25
|
"circular-deps": "dpdm src",
|
|
26
|
-
"prepublishOnly": "npm run build && npm run test-ci",
|
|
27
26
|
"test": "testscript",
|
|
28
27
|
"test-one": "rm -Rf out && tsx src/CMSGenerator.test.ts",
|
|
29
28
|
"test-ci": "rm -Rf out && testscript"
|
|
@@ -31,7 +30,7 @@
|
|
|
31
30
|
"dependencies": {
|
|
32
31
|
"@javarome/fileutil": "^0.3.7",
|
|
33
32
|
"@rr0/common": "^1.1.3",
|
|
34
|
-
"@rr0/data": "^0.3.
|
|
33
|
+
"@rr0/data": "^0.3.37",
|
|
35
34
|
"@rr0/lang": "^0.1.12",
|
|
36
35
|
"@rr0/place": "^0.5.3",
|
|
37
36
|
"@rr0/time": "^0.11.1",
|
|
@@ -46,10 +45,10 @@
|
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"@javarome/testscript": "^0.13.1",
|
|
48
47
|
"@types/jsdom": "^21.1.7",
|
|
49
|
-
"@types/node": "^22.
|
|
50
|
-
"tsx": "4.19.
|
|
51
|
-
"typescript": "^5.8.
|
|
52
|
-
"vite": "^6.
|
|
48
|
+
"@types/node": "^22.15.30",
|
|
49
|
+
"tsx": "4.19.4",
|
|
50
|
+
"typescript": "^5.8.3",
|
|
51
|
+
"vite": "^6.3.5"
|
|
53
52
|
},
|
|
54
53
|
"keywords": [
|
|
55
54
|
"cms",
|