@rr0/cms 0.1.12 → 0.1.14
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/README.md +2 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/lang/form.js +1 -1
- package/dist/org/au/Australia_en.d.ts +1 -1
- package/dist/org/au/Australia_fr.d.ts +1 -1
- package/dist/org/au/region/index.d.ts +4 -4
- package/dist/org/au/region/index.js +4 -4
- package/dist/org/au/region/nsw/NewSouthWalesMessages_en.d.ts +2 -2
- package/dist/org/au/region/nsw/NewSouthWalesMessages_en.js +2 -2
- package/dist/org/au/region/nsw/NewSouthWalesMessages_fr.d.ts +2 -2
- package/dist/org/au/region/nsw/NewSouthWalesMessages_fr.js +2 -2
- package/dist/org/au/region/nsw/index.d.ts +1 -1
- package/dist/org/au/region/nsw/index.js +1 -1
- package/dist/org/eu/fr/region/idf/77/SeineEtMarneCities.js +1 -1
- package/dist/org/eu/fr/region/idf/77/SeineEtMarneMessages.js +1 -1
- package/dist/org/eu/fr/region/idf/77/SivryCourtry/index.d.ts +2 -0
- package/dist/org/eu/fr/region/idf/77/SivryCourtry/index.js +2 -0
- package/dist/org/eu/fr/region/idf/77/index.d.ts +5 -0
- package/dist/org/eu/fr/region/idf/77/index.js +5 -0
- package/package.json +4 -2
- package/dist/WordFinder.d.ts +0 -1
- package/dist/WordFinder.js +0 -89
- /package/dist/org/eu/fr/region/idf/77/{paris → SivryCourtry}/SivryCourtry.d.ts +0 -0
- /package/dist/org/eu/fr/region/idf/77/{paris → SivryCourtry}/SivryCourtry.js +0 -0
- /package/dist/org/eu/fr/region/idf/77/{paris → SivryCourtry}/SivryCourtryMessages.d.ts +0 -0
- /package/dist/org/eu/fr/region/idf/77/{paris → SivryCourtry}/SivryCourtryMessages.js +0 -0
package/README.md
CHANGED
|
@@ -4,3 +4,5 @@ This is a CMS system based on [ssg-api](https://www.npmjs.com/package/ssg-api).
|
|
|
4
4
|
|
|
5
5
|
While it is especially designed to render UFO-related data as it was designed to render the [RR0 website](https://rr0.org),
|
|
6
6
|
it can also probably be used to generate websites pertaining to other topics, as most of the data types (time, place, event, sources, notes, etc.) are not specific to the ufological domain.
|
|
7
|
+
|
|
8
|
+
- [Data types](src/data/README.md)
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/lang/form.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CountryMessages } from "../country/index.js";
|
|
2
2
|
export declare const australia_en: CountryMessages<{
|
|
3
|
-
nsw: import("../country/index.js").
|
|
3
|
+
nsw: import("../country/index.js").DepartmentMessages<{
|
|
4
4
|
"2529": import("../country/index.js").CityMessages;
|
|
5
5
|
}>;
|
|
6
6
|
sa: import("../country/index.js").RegionMessages<{}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CountryMessages } from "../country/index.js";
|
|
2
2
|
export declare const australia_fr: CountryMessages<{
|
|
3
|
-
nsw: import("../country/index.js").
|
|
3
|
+
nsw: import("../country/index.js").DepartmentMessages<{
|
|
4
4
|
"2529": import("../country/index.js").CityMessages;
|
|
5
5
|
}>;
|
|
6
6
|
sa: import("../country/index.js").RegionMessages<{}>;
|
|
@@ -2,7 +2,7 @@ export * from "./AustraliaCities.js";
|
|
|
2
2
|
export * from "./AustraliaRegion.js";
|
|
3
3
|
export * from "./AustraliaRegionCode.js";
|
|
4
4
|
export * from "./AustraliaRegions.js";
|
|
5
|
-
export * from "./nsw";
|
|
6
|
-
export * from "./sa";
|
|
7
|
-
export * from "./vic";
|
|
8
|
-
export * from "./wa";
|
|
5
|
+
export * from "./nsw/index.js";
|
|
6
|
+
export * from "./sa/index.js";
|
|
7
|
+
export * from "./vic/index.js";
|
|
8
|
+
export * from "./wa/index.js";
|
|
@@ -2,7 +2,7 @@ export * from "./AustraliaCities.js";
|
|
|
2
2
|
export * from "./AustraliaRegion.js";
|
|
3
3
|
export * from "./AustraliaRegionCode.js";
|
|
4
4
|
export * from "./AustraliaRegions.js";
|
|
5
|
-
export * from "./nsw";
|
|
6
|
-
export * from "./sa";
|
|
7
|
-
export * from "./vic";
|
|
8
|
-
export * from "./wa";
|
|
5
|
+
export * from "./nsw/index.js";
|
|
6
|
+
export * from "./sa/index.js";
|
|
7
|
+
export * from "./vic/index.js";
|
|
8
|
+
export * from "./wa/index.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const newSouthWales_en:
|
|
1
|
+
import { DepartmentMessages } from "../../../country/index.js";
|
|
2
|
+
export declare const newSouthWales_en: DepartmentMessages<{
|
|
3
3
|
"2529": import("../../../country/index.js").CityMessages;
|
|
4
4
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dunmoreNswMessages } from "./dunmore/index.js";
|
|
2
2
|
import { NewSouthWalesCityCode } from "./NewSouthWalesCityCode.js";
|
|
3
|
-
import {
|
|
4
|
-
export const newSouthWales_en =
|
|
3
|
+
import { DepartmentMessages } from "../../../country/index.js";
|
|
4
|
+
export const newSouthWales_en = DepartmentMessages.create("New South Wales", {
|
|
5
5
|
[NewSouthWalesCityCode.Dunmore]: dunmoreNswMessages
|
|
6
6
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const newSouthWales_fr:
|
|
1
|
+
import { DepartmentMessages } from "../../../country/index.js";
|
|
2
|
+
export declare const newSouthWales_fr: DepartmentMessages<{
|
|
3
3
|
"2529": import("../../../country/index.js").CityMessages;
|
|
4
4
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NewSouthWalesCityCode } from "./NewSouthWalesCityCode.js";
|
|
2
2
|
import { dunmoreNswMessages } from "./dunmore/index.js";
|
|
3
|
-
import {
|
|
4
|
-
export const newSouthWales_fr =
|
|
3
|
+
import { DepartmentMessages } from "../../../country/index.js";
|
|
4
|
+
export const newSouthWales_fr = DepartmentMessages.create("Nouvelle-Galles du Sud", {
|
|
5
5
|
[NewSouthWalesCityCode.Dunmore]: dunmoreNswMessages
|
|
6
6
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SeineEtMarneCityCode } from "./SeineEtMarneCityCode.js";
|
|
2
|
-
import { sivryCourtryMessages } from "./
|
|
2
|
+
import { sivryCourtryMessages } from "./SivryCourtry/SivryCourtryMessages.js";
|
|
3
3
|
import { DepartmentMessages } from "../../../../../country/region/department/DepartmentMessages.js";
|
|
4
4
|
const seineEtMarneCityMessages = {
|
|
5
5
|
[SeineEtMarneCityCode.SivryCourtry]: sivryCourtryMessages
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@rr0/cms",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"author": "rr0@rr0.org",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.14",
|
|
6
6
|
"description": "Content Management System",
|
|
7
7
|
"exports": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
@@ -47,7 +47,9 @@
|
|
|
47
47
|
"cms",
|
|
48
48
|
"time",
|
|
49
49
|
"place",
|
|
50
|
-
"
|
|
50
|
+
"people",
|
|
51
|
+
"organization",
|
|
52
|
+
"event"
|
|
51
53
|
],
|
|
52
54
|
"publishConfig": {
|
|
53
55
|
"access": "public"
|
package/dist/WordFinder.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/WordFinder.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { ConsoleLogger, HtmlFileContents } from "ssg-api";
|
|
2
|
-
import { CLI } from "./util/index.js";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
import { TimeContext } from "./time/index.js";
|
|
5
|
-
import { RR0SsgContextImpl } from "./RR0SsgContext.js";
|
|
6
|
-
import { glob } from "glob";
|
|
7
|
-
import path from "path";
|
|
8
|
-
import { CSVFileReader } from "./CSVFileReader.js";
|
|
9
|
-
const logger = new ConsoleLogger("wordfinder");
|
|
10
|
-
const args = new CLI().getArgs();
|
|
11
|
-
const inputPattern = args.contents;
|
|
12
|
-
const dictionaryFile = args.dict;
|
|
13
|
-
class Dictionary {
|
|
14
|
-
constructor(logger) {
|
|
15
|
-
this.logger = logger;
|
|
16
|
-
this.words = [];
|
|
17
|
-
}
|
|
18
|
-
async read(fileName) {
|
|
19
|
-
logger.debug("Reading", fileName);
|
|
20
|
-
const columns = [];
|
|
21
|
-
const readStream = fs.createReadStream(fileName);
|
|
22
|
-
const csvSeparator = ",";
|
|
23
|
-
const reader = new CSVFileReader(readStream, logger, columns, csvSeparator, (data) => data["&"]);
|
|
24
|
-
this.words = ["&"].concat(await reader.read());
|
|
25
|
-
return this.words;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const outDir = "out";
|
|
29
|
-
const config = {
|
|
30
|
-
getOutputPath(context) {
|
|
31
|
-
return path.join(outDir, context.file.name);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
const timeContext = new TimeContext();
|
|
35
|
-
const context = new RR0SsgContextImpl("fr", timeContext, config);
|
|
36
|
-
glob(inputPattern).then(async (inputFiles) => {
|
|
37
|
-
const dictionary = new Dictionary(logger);
|
|
38
|
-
const dictWords = await dictionary.read(dictionaryFile);
|
|
39
|
-
logger.debug("Looking for files", inputPattern);
|
|
40
|
-
for (const inputFile of inputFiles) {
|
|
41
|
-
const file = HtmlFileContents.read(inputFile);
|
|
42
|
-
const contents = file.contents;
|
|
43
|
-
let pos;
|
|
44
|
-
let errorToFix;
|
|
45
|
-
const separators = " ;:.,!?()[]/+=";
|
|
46
|
-
const badChar = "�";
|
|
47
|
-
do {
|
|
48
|
-
pos = contents.indexOf(badChar);
|
|
49
|
-
errorToFix = pos >= 0;
|
|
50
|
-
let fileWordStart = pos;
|
|
51
|
-
if (errorToFix) {
|
|
52
|
-
while (fileWordStart > 0 && !separators.includes(contents.charAt(fileWordStart))) {
|
|
53
|
-
fileWordStart--;
|
|
54
|
-
}
|
|
55
|
-
let fileWordEnd = fileWordStart + 1;
|
|
56
|
-
while (!separators.includes(contents.charAt(fileWordEnd))) {
|
|
57
|
-
fileWordEnd++;
|
|
58
|
-
}
|
|
59
|
-
const wordToFix = contents.substring(fileWordStart, fileWordEnd);
|
|
60
|
-
context.log("Fixing", wordToFix);
|
|
61
|
-
let dictWordIndex = 0;
|
|
62
|
-
let score;
|
|
63
|
-
do {
|
|
64
|
-
const dictWord = dictWords[dictWordIndex];
|
|
65
|
-
let matchStart = 0;
|
|
66
|
-
score = 0;
|
|
67
|
-
for (let i = 0; i < dictWord.length; i++, matchStart++) {
|
|
68
|
-
const dictWordChar = dictWord.charAt(i);
|
|
69
|
-
const fileWordChar = contents.charAt(pos + matchStart);
|
|
70
|
-
if (fileWordChar === badChar) {
|
|
71
|
-
score += 5;
|
|
72
|
-
}
|
|
73
|
-
else if (fileWordChar === dictWordChar) {
|
|
74
|
-
score += 10;
|
|
75
|
-
}
|
|
76
|
-
else if (separators.includes(fileWordChar)) {
|
|
77
|
-
context.log("Found word", dictWord);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
context.debug("Not word", dictWord);
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
dictWordIndex++;
|
|
85
|
-
} while (score < 10 && dictWordIndex < dictWords.length);
|
|
86
|
-
}
|
|
87
|
-
} while (errorToFix);
|
|
88
|
-
}
|
|
89
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|