@rr0/cms 0.3.29 → 0.3.31
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/dist/CMSGenerator.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export declare class CMSGenerator implements CMSContext {
|
|
|
86
86
|
timeElementFactory: TimeElementFactory;
|
|
87
87
|
timeReplacer: TimeReplacer;
|
|
88
88
|
};
|
|
89
|
-
protected
|
|
89
|
+
protected setupPeople(context: RR0ContextImpl, peopleRenderer: PeopleHtmlRenderer, copies: string[]): Promise<{
|
|
90
90
|
peopleService: PeopleService;
|
|
91
91
|
peopleSteps: import("./people/PeopleDirectoryStep.js").PeopleDirectoryStep[];
|
|
92
92
|
copies: string[];
|
package/dist/CMSGenerator.js
CHANGED
|
@@ -88,9 +88,19 @@ export class CMSGenerator {
|
|
|
88
88
|
const timeRenderer = this.timeRenderer;
|
|
89
89
|
const timeFormat = this.options.timeFormat;
|
|
90
90
|
const { timeFiles, timeElementFactory, timeReplacer } = this.setupTime(context);
|
|
91
|
+
const orgFactory = dataService.factories.find(f => f.type === "org");
|
|
92
|
+
if (orgFactory) {
|
|
93
|
+
const orgFiles = await orgFactory.getFiles();
|
|
94
|
+
context.setVar("orgFilesCount", orgFiles.length);
|
|
95
|
+
}
|
|
96
|
+
const placeFactory = dataService.factories.find(f => f.type === "place");
|
|
97
|
+
if (placeFactory) {
|
|
98
|
+
const placeFiles = await placeFactory.getFiles();
|
|
99
|
+
context.setVar("placeFilesCount", placeFiles.length);
|
|
100
|
+
}
|
|
91
101
|
const { caseService, ufoCasesStep } = await this.setupCases(timeElementFactory);
|
|
92
102
|
const peopleRenderer = new PeopleHtmlRenderer();
|
|
93
|
-
const { peopleService, peopleSteps } = await this.
|
|
103
|
+
const { peopleService, peopleSteps } = await this.setupPeople(context, peopleRenderer, this.options.copies);
|
|
94
104
|
const timeTextBuilder = this.timeTextBuilder;
|
|
95
105
|
const searchVisitor = new SearchVisitor({ notIndexedUrls: ["404.html", "Referencement.html"], indexWords: false }, timeTextBuilder);
|
|
96
106
|
const { sourceRenderer, sourceFactory, sourceReplacerFactory } = this.setupSources(timeTextBuilder, timeFormat);
|
|
@@ -221,7 +231,7 @@ export class CMSGenerator {
|
|
|
221
231
|
const timeReplacer = new TimeReplacer(timeElementFactory);
|
|
222
232
|
return { timeFiles, timeElementFactory, timeReplacer };
|
|
223
233
|
}
|
|
224
|
-
async
|
|
234
|
+
async setupPeople(context, peopleRenderer, copies) {
|
|
225
235
|
const peopleFiles = await this.peopleFactory.getFiles();
|
|
226
236
|
const peopleService = new PeopleService(this.dataService, this.peopleFactory, { files: peopleFiles, rootDir: "people" });
|
|
227
237
|
const peopleList = await peopleService.getAll();
|
|
@@ -65,7 +65,6 @@ export class DataContentVisitor {
|
|
|
65
65
|
const doc = context.file.document;
|
|
66
66
|
const contents = doc.querySelector(".contents");
|
|
67
67
|
if (contents) {
|
|
68
|
-
const side = context.people ? "left" : "right";
|
|
69
68
|
const imgEl = contents.querySelector("img");
|
|
70
69
|
const caption = imageData.name;
|
|
71
70
|
const src = imageData.url;
|
|
@@ -77,7 +76,6 @@ export class DataContentVisitor {
|
|
|
77
76
|
figcaptionEl.innerHTML = caption;
|
|
78
77
|
await this.eventRenderer.renderEnd(context, imageData, figcaptionEl);
|
|
79
78
|
const figureEl = doc.createElement("figure");
|
|
80
|
-
figureEl.classList.add(side, "side");
|
|
81
79
|
figureEl.append(imgEl);
|
|
82
80
|
figureEl.append(figcaptionEl);
|
|
83
81
|
const insertEl = contents.querySelector("*");
|
|
@@ -8,7 +8,9 @@ describe("PeopleReplacer", () => {
|
|
|
8
8
|
const rootDir = rr0TestUtil.filePath("people");
|
|
9
9
|
const files = [
|
|
10
10
|
path.join(rootDir, "b/BeauJerome"),
|
|
11
|
-
path.join(rootDir, "h/HynekJosefAllen")
|
|
11
|
+
path.join(rootDir, "h/HynekJosefAllen"),
|
|
12
|
+
path.join(rootDir, "r/ReaganRonald"),
|
|
13
|
+
path.join(rootDir, "v/VertongenJeanLuc")
|
|
12
14
|
];
|
|
13
15
|
const peopleFactory = new PeopleFactory(new RR0EventFactory());
|
|
14
16
|
function createPeopleElement(context, content, title) {
|
|
@@ -42,10 +44,15 @@ describe("PeopleReplacer", () => {
|
|
|
42
44
|
const peopleRenderer = new PeopleHtmlRenderer();
|
|
43
45
|
const replacer = new PeopleReplacer(peopleService, peopleRenderer);
|
|
44
46
|
const context = rr0TestUtil.time.newHtmlContext("1/9/9/0/08/index.html", "");
|
|
47
|
+
{
|
|
48
|
+
const peopleWithTitle = createPeopleElement(context, "Jean-Luc Vertongen");
|
|
49
|
+
const replacement = await replacer.replacement(context, peopleWithTitle);
|
|
50
|
+
expect(replacement.outerHTML).toBe(`<span class="peopl" translate="no"><a href="/src/people/v/VertongenJeanLuc/">Jean-Luc Vertongen</a></span>`);
|
|
51
|
+
}
|
|
45
52
|
{
|
|
46
53
|
const peopleWithTitle = createPeopleElement(context, "Ronald Reagan", "Ronald Wilson Reagan");
|
|
47
|
-
|
|
48
|
-
expect(replacement.outerHTML).toBe(`<span translate="no"><a href="/src/people/r/ReaganRonald/">Ronald Reagan</a></span>`);
|
|
54
|
+
const replacement = await replacer.replacement(context, peopleWithTitle);
|
|
55
|
+
expect(replacement.outerHTML).toBe(`<span class="peopl" translate="no"><a href="/src/people/r/ReaganRonald/">Ronald Reagan</a></span>`);
|
|
49
56
|
}
|
|
50
57
|
{
|
|
51
58
|
const peopleWithFullName = createPeopleElement(context, "Jérôme Beau");
|
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.31",
|
|
6
6
|
"description": "RR0 Content Management System (CMS)",
|
|
7
7
|
"exports": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@javarome/fileutil": "^0.3.7",
|
|
32
32
|
"@rr0/common": "^1.1.3",
|
|
33
|
-
"@rr0/data": "^0.3.
|
|
33
|
+
"@rr0/data": "^0.3.27",
|
|
34
34
|
"@rr0/lang": "^0.1.12",
|
|
35
35
|
"@rr0/place": "^0.5.3",
|
|
36
36
|
"@rr0/time": "^0.11.0",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"glob": "^11.0.1",
|
|
40
40
|
"image-size": "^2.0.1",
|
|
41
41
|
"jsdom": "^26.0.0",
|
|
42
|
-
"netlify-cli": "^19.0.3",
|
|
43
42
|
"selenium-webdriver": "^4.30.0",
|
|
44
43
|
"ssg-api": "^1.16.15"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
46
|
+
"netlify-cli": "^19.1.4",
|
|
47
47
|
"@javarome/testscript": "^0.13.1",
|
|
48
48
|
"@types/jsdom": "^21.1.7",
|
|
49
49
|
"@types/node": "^22.13.11",
|