@rr0/cms 0.1.14 → 0.1.16
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/BaseReplaceCommand.d.ts +2 -2
- package/dist/DefaultContentVisitor.d.ts +11 -11
- package/dist/DescriptionReplaceCommand.d.ts +3 -3
- package/dist/ImageCommand.d.ts +3 -3
- package/dist/MetaLinkReplaceCommand.d.ts +3 -3
- package/dist/OpenGraphCommand.d.ts +6 -6
- package/dist/OpenGraphCommand.js +1 -1
- package/dist/RR0ContentStep.d.ts +11 -11
- package/dist/RR0ContentStep.js +2 -2
- package/dist/{RR0SsgContext.d.ts → RR0Context.d.ts} +8 -8
- package/dist/{RR0SsgContext.js → RR0Context.js} +4 -4
- package/dist/anchor/AnchorHandler.d.ts +2 -2
- package/dist/anchor/AnchorReplaceCommand.d.ts +2 -2
- package/dist/anchor/AnchorReplacer.d.ts +3 -3
- package/dist/anchor/CaseAnchorHandler.d.ts +2 -2
- package/dist/anchor/CaseAnchorHandler.js +2 -2
- package/dist/anchor/DataAnchorHandler.d.ts +6 -6
- package/dist/book/BookContentVisitor.d.ts +2 -2
- package/dist/book/BookDirectoryStep.d.ts +5 -5
- package/dist/book/BookService.d.ts +3 -1
- package/dist/book/BookService.js +4 -4
- package/dist/book/Chapters.d.ts +3 -3
- package/dist/book/Chapters.js +2 -2
- package/dist/build.js +27 -8
- package/dist/data/AbstractDataFactory.d.ts +3 -2
- package/dist/data/AbstractDataFactory.js +1 -1
- package/dist/data/AbstractDataService.d.ts +2 -3
- package/dist/data/AbstractDataService.js +2 -8
- package/dist/data/RR0Data.d.ts +4 -3
- package/dist/data/TypedDataFactory.d.ts +3 -2
- package/dist/data/TypedDataFactory.js +4 -0
- package/dist/data/index.d.ts +1 -1
- package/dist/data/index.js +1 -1
- package/dist/index/IndexedReplacer.d.ts +4 -4
- package/dist/index/IndexedReplacerFactory.d.ts +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lang/LanguageReplaceCommand.d.ts +3 -3
- package/dist/lang/RR0Messages.d.ts +1 -1
- package/dist/lang/RR0Messages_en.d.ts +1 -1
- package/dist/lang/RR0Messages_en.js +1 -1
- package/dist/lang/RR0Messages_fr.d.ts +1 -1
- package/dist/lang/RR0Messages_fr.js +1 -1
- package/dist/note/NoteFileCounter.d.ts +2 -2
- package/dist/note/NoteRenderer.d.ts +2 -2
- package/dist/note/NoteReplacer.d.ts +2 -2
- package/dist/note/NoteReplacerFactory.d.ts +2 -2
- package/dist/org/OrgMessages.d.ts +2 -2
- package/dist/org/Organization.d.ts +3 -3
- package/dist/org/Organization.js +3 -3
- package/dist/org/OrganizationMessages.d.ts +3 -3
- package/dist/org/OrganizationService.d.ts +4 -3
- package/dist/org/OrganizationService.js +10 -9
- package/dist/org/au/region/vic/index.d.ts +1 -1
- package/dist/org/au/region/vic/index.js +1 -1
- package/dist/org/br/region/cw/CentralWest.js +1 -1
- package/dist/org/br/region/se/SouthEast.js +1 -1
- package/dist/org/country/region/department/city/CityService.d.ts +2 -2
- package/dist/org/country/region/department/city/CityService.js +2 -1
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseSummary.d.ts +1 -1
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseSummaryRR0Mapper.d.ts +4 -4
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseSummaryRR0Mapper.js +1 -1
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseToSummaryMapper.d.ts +3 -3
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanCaseToSummaryMapper.js +1 -1
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanDatasource.d.ts +3 -3
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanFileDatasource.d.ts +3 -3
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanHttpDatasource.d.ts +6 -5
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanSummaryToCaseMapper.d.ts +3 -3
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanTestCases.js +1 -1
- package/dist/org/eu/fr/cnes/geipan/geipan/GeipanTestimonial.d.ts +1 -1
- package/dist/org/us/region/fl/Florida.js +1 -1
- package/dist/org/us/region/hi/Hawaii.js +1 -1
- package/dist/org/us/region/in/Indiana.js +1 -1
- package/dist/org/us/region/va/Virginia.js +1 -1
- package/dist/org/us/region/wa/Washington.js +1 -1
- package/dist/org/us/region/wv/WestVirginia.js +1 -1
- package/dist/people/PeopleDirectoryStep.d.ts +4 -4
- package/dist/people/PeopleReplacer.d.ts +3 -3
- package/dist/people/PeopleReplacerFactory.d.ts +2 -2
- package/dist/people/PeopleService.d.ts +3 -4
- package/dist/people/PeopleService.js +3 -14
- package/dist/people/author/AuthorReplaceCommand.d.ts +2 -2
- package/dist/people/witness/WitnessReplacer.d.ts +2 -2
- package/dist/people/witness/WitnessReplacerFactory.d.ts +2 -2
- package/dist/place/GooglePlaceService.d.ts +1 -1
- package/dist/place/GooglePlaceService.js +1 -1
- package/dist/place/Place.d.ts +1 -1
- package/dist/place/Place.js +1 -1
- package/dist/place/PlaceService.d.ts +1 -1
- package/dist/place/PlaceService.js +1 -1
- package/dist/place/index.d.ts +0 -4
- package/dist/place/index.js +0 -4
- package/dist/science/crypto/ufo/enquete/dossier/CaseDirectoryStep.d.ts +5 -5
- package/dist/science/crypto/ufo/enquete/dossier/CaseDirectoryStep.js +1 -1
- package/dist/science/crypto/ufo/enquete/dossier/CaseService.d.ts +3 -3
- package/dist/science/crypto/ufo/enquete/dossier/CaseService.js +2 -2
- package/dist/search/SearchVisitor.d.ts +5 -5
- package/dist/source/Source.d.ts +1 -1
- package/dist/source/SourceFactory.d.ts +4 -4
- package/dist/source/SourceFactory.js +3 -2
- package/dist/source/SourceFileCounter.d.ts +2 -2
- package/dist/source/SourceRegistry.d.ts +2 -2
- package/dist/source/SourceRenderer.d.ts +3 -3
- package/dist/source/SourceRenderer.js +2 -2
- package/dist/source/SourceReplacer.d.ts +3 -3
- package/dist/source/SourceReplacerFactory.d.ts +2 -2
- package/dist/tech/info/soft/proj/impl/lang/CodeReplacer.d.ts +3 -3
- package/dist/tech/info/soft/proj/impl/lang/CodeReplacerFactory.d.ts +2 -2
- package/dist/time/CaseSummaryRenderer.d.ts +1 -1
- package/dist/time/EventRenderer.d.ts +7 -7
- package/dist/time/EventReplacerFactory.d.ts +4 -4
- package/dist/time/SsiTitleReplaceCommand.d.ts +2 -2
- package/dist/time/Time.d.ts +5 -3
- package/dist/time/Time.js +31 -5
- package/dist/time/TimeLinkDefaultHandler.d.ts +10 -9
- package/dist/time/TimeLinkDefaultHandler.js +8 -12
- package/dist/time/TimeService.d.ts +16 -7
- package/dist/time/TimeService.js +16 -22
- package/dist/time/TimeTestUtil.d.ts +16 -0
- package/dist/time/TimeTestUtil.js +29 -0
- package/dist/time/TimeUrlBuilder.d.ts +7 -3
- package/dist/time/TimeUrlBuilder.js +7 -4
- package/dist/time/datasource/AbstractDatasource.d.ts +6 -6
- package/dist/time/datasource/ChronologyReplacer.d.ts +6 -6
- package/dist/time/datasource/ChronologyReplacerFactory.d.ts +2 -2
- package/dist/time/datasource/ChronologyReplacerFactory.js +1 -1
- package/dist/time/datasource/ContextFilter.d.ts +3 -3
- package/dist/time/datasource/CsvFileSource.d.ts +2 -2
- package/dist/time/datasource/CsvMapper.d.ts +5 -5
- package/dist/time/datasource/CsvMapper.js +1 -1
- package/dist/time/datasource/Datasource.d.ts +2 -2
- package/dist/time/datasource/DatasourceTestCase.d.ts +8 -8
- package/dist/time/datasource/DatasourceTestCase.js +18 -16
- package/dist/time/datasource/FileDatasource.d.ts +2 -2
- package/dist/time/datasource/JsonMapper.d.ts +4 -4
- package/dist/time/datasource/TimeContextFilter.d.ts +3 -3
- package/dist/time/datasource/acufo/AcufoCase.d.ts +1 -1
- package/dist/time/datasource/acufo/AcufoDatasource.d.ts +3 -3
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummary.d.ts +1 -1
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryMapper.d.ts +3 -3
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryMapper.js +1 -1
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryRR0Mapper.d.ts +3 -3
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceCaseSummaryRR0Mapper.js +1 -1
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceDatasource.d.ts +2 -2
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceHttpDatasource.d.ts +6 -6
- package/dist/time/datasource/baseovnifrance/BaseOvniFranceTestCases.js +1 -1
- package/dist/time/datasource/fufora/FuforaCaseSummary.d.ts +1 -1
- package/dist/time/datasource/fufora/FuforaCaseSummaryRR0Mapper.d.ts +3 -3
- package/dist/time/datasource/fufora/FuforaCaseSummaryRR0Mapper.js +1 -1
- package/dist/time/datasource/fufora/FuforaDatasource.d.ts +2 -2
- package/dist/time/datasource/fufora/FuforaHttpDatasource.d.ts +5 -5
- package/dist/time/datasource/fufora/FuforaTestCases.js +1 -1
- package/dist/time/datasource/nuforc/NuforcCaseSummary.d.ts +1 -1
- package/dist/time/datasource/nuforc/NuforcDatasource.d.ts +2 -2
- package/dist/time/datasource/nuforc/NuforcHttpDatasource.d.ts +6 -6
- package/dist/time/datasource/nuforc/NuforcRR0Mapper.d.ts +3 -3
- package/dist/time/datasource/nuforc/NuforcRR0Mapper.js +1 -1
- package/dist/time/datasource/nuforc/NuforcTestCases.js +1 -1
- package/dist/time/datasource/rr0/NamedPlace.d.ts +7 -0
- package/dist/time/datasource/rr0/RR0CaseMapping.d.ts +2 -2
- package/dist/time/datasource/rr0/RR0CaseSummary.d.ts +0 -7
- package/dist/time/datasource/rr0/RR0CaseSummaryMapper.d.ts +3 -3
- package/dist/time/datasource/rr0/RR0FileDatasource.d.ts +5 -5
- package/dist/time/datasource/rr0/RR0HttpDatasource.d.ts +10 -9
- package/dist/time/datasource/rr0/RR0HttpDatasource.js +3 -32
- package/dist/time/datasource/rr0/RR0TestCases.js +1 -1
- package/dist/time/datasource/rr0/index.d.ts +1 -0
- package/dist/time/datasource/rr0/index.js +1 -0
- package/dist/time/datasource/sceau/SceauCaseSummaryRR0Mapper.d.ts +3 -3
- package/dist/time/datasource/sceau/SceauCaseSummaryRR0Mapper.js +1 -1
- package/dist/time/datasource/sceau/SceauDatasource.d.ts +4 -4
- package/dist/time/datasource/sceau/SceauDatasource.js +1 -1
- package/dist/time/datasource/sceau/SceauHttpDatasource.d.ts +5 -5
- package/dist/time/datasource/ufo-search/UfoSearchCase.d.ts +1 -1
- package/dist/time/datasource/ufo-search/UfoSearchCaseRR0Mapper.d.ts +4 -4
- package/dist/time/datasource/ufo-search/UfoSearchCaseRR0Mapper.js +10 -10
- package/dist/time/datasource/ufo-search/UfoSearchDatasource.d.ts +2 -2
- package/dist/time/datasource/ufo-search/UfoSearchFileDatasource.d.ts +3 -3
- package/dist/time/datasource/ufo-search/UfoSearchFileDatasource.js +1 -1
- package/dist/time/datasource/ufo-search/UfoSearchHttpDatasource.d.ts +4 -4
- package/dist/time/datasource/ufo-search/UfoSearchTestCases.js +1 -1
- package/dist/time/datasource/urecat/UrecatCase.d.ts +1 -1
- package/dist/time/datasource/urecat/UrecatHttpDatasource.d.ts +5 -5
- package/dist/time/datasource/urecat/UrecatHttpDatasource.js +1 -1
- package/dist/time/datasource/urecat/UrecatRR0Mapper.d.ts +3 -3
- package/dist/time/datasource/urecat/UrecatRR0Mapper.js +1 -1
- package/dist/time/datasource/urecat/UrecatTestCases.js +1 -1
- package/dist/time/html/TimeElementFactory.d.ts +15 -0
- package/dist/time/{TimeElementFactory.js → html/TimeElementFactory.js} +16 -22
- package/dist/time/html/TimeRenderer.d.ts +18 -0
- package/dist/time/html/TimeRenderer.js +46 -0
- package/dist/time/html/TimeReplacer.d.ts +12 -0
- package/dist/time/{TimeReplacer.js → html/TimeReplacer.js} +0 -3
- package/dist/time/{TimeReplacerFactory.d.ts → html/TimeReplacerFactory.d.ts} +2 -2
- package/dist/time/{TimeReplacerFactory.js → html/TimeReplacerFactory.js} +1 -1
- package/dist/time/html/index.d.ts +4 -0
- package/dist/time/html/index.js +4 -0
- package/dist/time/index.d.ts +3 -8
- package/dist/time/index.js +3 -8
- package/dist/time/{RelativeTimeTextBuilder.d.ts → text/RelativeTimeTextBuilder.d.ts} +2 -2
- package/dist/time/text/RelativeTimeTextBuilder.js +165 -0
- package/dist/time/{TimeTextBuilder.d.ts → text/TimeTextBuilder.d.ts} +2 -2
- package/dist/time/{TimeTextBuilder.js → text/TimeTextBuilder.js} +1 -1
- package/dist/time/text/index.d.ts +2 -0
- package/dist/time/text/index.js +2 -0
- package/dist/value/UnitReplaceCommand.d.ts +2 -2
- package/package.json +12 -11
- package/tsconfig.json +2 -1
- package/dist/place/PlaceLocation.d.ts +0 -26
- package/dist/place/PlaceLocation.js +0 -48
- package/dist/place/PlaceMessages.d.ts +0 -5
- package/dist/place/PlaceMessages_en.d.ts +0 -2
- package/dist/place/PlaceMessages_en.js +0 -4
- package/dist/place/PlaceMessages_fr.d.ts +0 -2
- package/dist/place/PlaceMessages_fr.js +0 -4
- package/dist/time/RelativeTimeTextBuilder.js +0 -166
- package/dist/time/TimeContext.d.ts +0 -59
- package/dist/time/TimeContext.js +0 -267
- package/dist/time/TimeElementFactory.d.ts +0 -15
- package/dist/time/TimeRenderer.d.ts +0 -19
- package/dist/time/TimeRenderer.js +0 -63
- package/dist/time/TimeReplacer.d.ts +0 -24
- /package/dist/{place/PlaceMessages.js → time/datasource/rr0/NamedPlace.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DomReplaceCommand, DomReplacer } from "ssg-api";
|
|
2
|
-
import {
|
|
2
|
+
import { HtmlRR0Context } from "./RR0Context.js";
|
|
3
3
|
/**
|
|
4
4
|
* Enforce a constant host value for the <base> tag
|
|
5
5
|
*/
|
|
6
6
|
export declare class BaseReplaceCommand extends DomReplaceCommand {
|
|
7
7
|
protected baseUrl: string;
|
|
8
8
|
constructor(baseUrl: string);
|
|
9
|
-
protected createReplacer(context:
|
|
9
|
+
protected createReplacer(context: HtmlRR0Context): Promise<DomReplacer>;
|
|
10
10
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AllDataService } from "./data/AllDataService.js";
|
|
2
|
-
import { TimeElementFactory } from "./time/TimeElementFactory.js";
|
|
2
|
+
import { TimeElementFactory } from "./time/html/TimeElementFactory.js";
|
|
3
3
|
import { ContentVisitor } from "./RR0ContentStep.js";
|
|
4
|
-
import {
|
|
4
|
+
import { HtmlRR0Context } from "./RR0Context.js";
|
|
5
5
|
import { RR0Data } from "./data/RR0Data.js";
|
|
6
6
|
import { EventRenderer } from "./time/EventRenderer.js";
|
|
7
7
|
import { RR0Event } from "./event/RR0Event.js";
|
|
@@ -10,16 +10,16 @@ export declare class DefaultContentVisitor implements ContentVisitor {
|
|
|
10
10
|
protected eventRenderer: EventRenderer<RR0Event>;
|
|
11
11
|
protected timeElementFactory: TimeElementFactory;
|
|
12
12
|
constructor(service: AllDataService, eventRenderer: EventRenderer<RR0Event>, timeElementFactory: TimeElementFactory);
|
|
13
|
-
visit(context:
|
|
14
|
-
protected process(context:
|
|
15
|
-
protected timeParagraph(context:
|
|
13
|
+
visit(context: HtmlRR0Context): Promise<void>;
|
|
14
|
+
protected process(context: HtmlRR0Context, data: RR0Data): Promise<void>;
|
|
15
|
+
protected timeParagraph(context: HtmlRR0Context, event: RR0Data): {
|
|
16
16
|
eventP: HTMLParagraphElement;
|
|
17
17
|
timeEl: HTMLElement;
|
|
18
18
|
};
|
|
19
|
-
protected processImage(context:
|
|
20
|
-
protected processBirth(context:
|
|
21
|
-
protected processDeath(context:
|
|
22
|
-
protected processBook(context:
|
|
23
|
-
protected processTitle(context:
|
|
24
|
-
protected processURL(context:
|
|
19
|
+
protected processImage(context: HtmlRR0Context, imageData: RR0Data): Promise<void>;
|
|
20
|
+
protected processBirth(context: HtmlRR0Context, event: RR0Data, entity: RR0Data): Promise<void>;
|
|
21
|
+
protected processDeath(context: HtmlRR0Context, event: RR0Event, entity: RR0Data): Promise<void>;
|
|
22
|
+
protected processBook(context: HtmlRR0Context, bookData: RR0Data): Promise<void>;
|
|
23
|
+
protected processTitle(context: HtmlRR0Context, data: RR0Data): void;
|
|
24
|
+
protected processURL(context: HtmlRR0Context, data: RR0Data): void;
|
|
25
25
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HtmlRR0Context } from "./RR0Context.js";
|
|
2
2
|
import { ReplaceCommand } from "ssg-api/dist/src/step/content/replace/ReplaceCommand.js";
|
|
3
3
|
/**
|
|
4
4
|
* Adds an "abstract" HTML paragraph from a <meta name="description">, if any.
|
|
5
5
|
*/
|
|
6
|
-
export declare class DescriptionReplaceCommand implements ReplaceCommand<
|
|
6
|
+
export declare class DescriptionReplaceCommand implements ReplaceCommand<HtmlRR0Context> {
|
|
7
7
|
protected readonly defaultDescription: string;
|
|
8
8
|
protected readonly abstractClass: string;
|
|
9
9
|
constructor(defaultDescription: string, abstractClass?: string);
|
|
10
|
-
execute(context:
|
|
10
|
+
execute(context: HtmlRR0Context): Promise<void>;
|
|
11
11
|
contentStepEnd(): Promise<void>;
|
|
12
12
|
}
|
package/dist/ImageCommand.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DomReplaceCommand, DomReplacer } from "ssg-api";
|
|
2
|
-
import {
|
|
2
|
+
import { HtmlRR0Context } from "./RR0Context.js";
|
|
3
3
|
/**
|
|
4
4
|
* Register images (`<img>` tags) required in an HTML file.
|
|
5
5
|
*/
|
|
@@ -9,7 +9,7 @@ export declare class ImageCommand extends DomReplaceCommand<HTMLImageElement> {
|
|
|
9
9
|
protected maxHeight: number;
|
|
10
10
|
protected baseUrl: string;
|
|
11
11
|
constructor(outBaseDir: string, maxWidth: number, maxHeight: number, baseUrl?: string);
|
|
12
|
-
protected createReplacer(context:
|
|
13
|
-
protected postExecute(context:
|
|
12
|
+
protected createReplacer(context: HtmlRR0Context): Promise<DomReplacer<HTMLImageElement>>;
|
|
13
|
+
protected postExecute(context: HtmlRR0Context): Promise<void>;
|
|
14
14
|
private handleImage;
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HtmlSsgContext, Link, ReplaceCommand } from "ssg-api";
|
|
2
|
-
import {
|
|
2
|
+
import { HtmlRR0Context } from "./RR0Context.js";
|
|
3
3
|
export interface LinkHandler<C extends HtmlSsgContext> {
|
|
4
4
|
start(context: C): Link | undefined;
|
|
5
5
|
contents(context: C): Link | undefined;
|
|
@@ -9,10 +9,10 @@ export interface LinkHandler<C extends HtmlSsgContext> {
|
|
|
9
9
|
/**
|
|
10
10
|
* Convert meta <link> to HTML <nav> links.
|
|
11
11
|
*/
|
|
12
|
-
export declare class MetaLinkReplaceCommand<C extends
|
|
12
|
+
export declare class MetaLinkReplaceCommand<C extends HtmlRR0Context = HtmlRR0Context> implements ReplaceCommand<C> {
|
|
13
13
|
protected defaultHandler?: LinkHandler<C>;
|
|
14
14
|
constructor(defaultHandler?: LinkHandler<C>);
|
|
15
15
|
execute(context: C): Promise<void>;
|
|
16
16
|
contentStepEnd(): Promise<void>;
|
|
17
|
-
protected linkItem(context:
|
|
17
|
+
protected linkItem(context: HtmlRR0Context, link: Link): HTMLLIElement;
|
|
18
18
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReplaceCommand } from "ssg-api/dist/src/step/content/replace/ReplaceCommand.js";
|
|
2
|
-
import {
|
|
2
|
+
import { HtmlRR0Context } from "./RR0Context.js";
|
|
3
3
|
import { Canvas, CanvasRenderingContext2D } from "canvas";
|
|
4
4
|
import { TimeTextBuilder } from "./time/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Create a preview image for each page sharing.
|
|
7
7
|
*/
|
|
8
|
-
export declare class OpenGraphCommand implements ReplaceCommand<
|
|
8
|
+
export declare class OpenGraphCommand implements ReplaceCommand<HtmlRR0Context> {
|
|
9
9
|
protected outDir: string;
|
|
10
10
|
protected timeFiles: string[];
|
|
11
11
|
protected baseUrl: string;
|
|
@@ -14,8 +14,8 @@ export declare class OpenGraphCommand implements ReplaceCommand<HtmlRR0SsgContex
|
|
|
14
14
|
protected height: number;
|
|
15
15
|
protected num: number;
|
|
16
16
|
constructor(outDir: string, timeFiles: string[], baseUrl: string, timeTextBuilder: TimeTextBuilder, width?: number, height?: number);
|
|
17
|
-
execute(context:
|
|
18
|
-
getInfoStr(context:
|
|
17
|
+
execute(context: HtmlRR0Context): Promise<void>;
|
|
18
|
+
getInfoStr(context: HtmlRR0Context): string;
|
|
19
19
|
contentStepEnd(): Promise<void>;
|
|
20
20
|
/**
|
|
21
21
|
* Draw text on the canvas, with line returns when required.
|
|
@@ -46,6 +46,6 @@ export declare class OpenGraphCommand implements ReplaceCommand<HtmlRR0SsgContex
|
|
|
46
46
|
* @param dy
|
|
47
47
|
* @protected
|
|
48
48
|
*/
|
|
49
|
-
protected drawImage(context:
|
|
50
|
-
protected writeImageFile(context:
|
|
49
|
+
protected drawImage(context: HtmlRR0Context, canvasCtx: CanvasRenderingContext2D, dy?: number): Promise<number>;
|
|
50
|
+
protected writeImageFile(context: HtmlRR0Context, canvas: Canvas): string;
|
|
51
51
|
}
|
package/dist/OpenGraphCommand.js
CHANGED
|
@@ -56,7 +56,7 @@ export class OpenGraphCommand {
|
|
|
56
56
|
context.time.setDayOfMonth(timeContext.getDayOfMonth());
|
|
57
57
|
context.time.setHour(undefined);
|
|
58
58
|
context.time.setMinutes(undefined);
|
|
59
|
-
timeStr = this.timeTextBuilder.build(context);
|
|
59
|
+
timeStr = this.timeTextBuilder.build(context, true);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
const copyrightStr = context.file.meta.copyright || "RR0.org";
|
package/dist/RR0ContentStep.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { ContentStep, ContentStepConfig, ContentStepResult, OutputFunc } from "ssg-api";
|
|
2
|
-
import {
|
|
3
|
-
import { TimeContext } from "
|
|
2
|
+
import { HtmlRR0Context } from "./RR0Context.js";
|
|
3
|
+
import { TimeContext } from "@rr0/time";
|
|
4
4
|
export interface ContentVisitor {
|
|
5
|
-
visit(context:
|
|
5
|
+
visit(context: HtmlRR0Context): Promise<void>;
|
|
6
6
|
}
|
|
7
7
|
export interface FileVisitor {
|
|
8
|
-
visit(context:
|
|
8
|
+
visit(context: HtmlRR0Context, processFile: boolean): Promise<void>;
|
|
9
9
|
contentStepEnd(): Promise<void>;
|
|
10
10
|
}
|
|
11
|
-
export declare class RR0ContentStep extends ContentStep<
|
|
11
|
+
export declare class RR0ContentStep extends ContentStep<HtmlRR0Context> {
|
|
12
12
|
protected fileVisitors: FileVisitor[];
|
|
13
13
|
protected contentVisitors: ContentVisitor[];
|
|
14
14
|
protected force: boolean;
|
|
15
15
|
protected toProcess: Set<string>;
|
|
16
16
|
constructor(contentConfigs: ContentStepConfig[], outputFunc: OutputFunc, fileVisitors: FileVisitor[], contentVisitors: ContentVisitor[], force: boolean, name: string, toProcess: Set<string>);
|
|
17
|
-
static setTimeFromPath(context:
|
|
18
|
-
protected processFile(context:
|
|
19
|
-
protected setContextFromFile(context:
|
|
20
|
-
protected setTimeFromPath(context:
|
|
21
|
-
protected shouldProcessFile(context:
|
|
22
|
-
protected shouldProcessContent(context:
|
|
17
|
+
static setTimeFromPath(context: HtmlRR0Context, filePath: string): TimeContext | undefined;
|
|
18
|
+
protected processFile(context: HtmlRR0Context, filePath: string, contentsConfig: ContentStepConfig): Promise<string | undefined>;
|
|
19
|
+
protected setContextFromFile(context: HtmlRR0Context, filePath: string): void;
|
|
20
|
+
protected setTimeFromPath(context: HtmlRR0Context, filePath: string): void;
|
|
21
|
+
protected shouldProcessFile(context: HtmlRR0Context, contentsConfig: ContentStepConfig): Promise<boolean>;
|
|
22
|
+
protected shouldProcessContent(context: HtmlRR0Context, contentsConfig: ContentStepConfig): Promise<boolean>;
|
|
23
23
|
protected postExecute(result: ContentStepResult): Promise<ContentStepResult>;
|
|
24
24
|
}
|
package/dist/RR0ContentStep.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContentStep } from "ssg-api";
|
|
2
|
-
import {
|
|
2
|
+
import { Time } from "./time/index.js";
|
|
3
3
|
export class RR0ContentStep extends ContentStep {
|
|
4
4
|
constructor(contentConfigs, outputFunc, fileVisitors = [], contentVisitors = [], force, name, toProcess) {
|
|
5
5
|
super(contentConfigs, outputFunc, name);
|
|
@@ -11,7 +11,7 @@ export class RR0ContentStep extends ContentStep {
|
|
|
11
11
|
static setTimeFromPath(context, filePath) {
|
|
12
12
|
const time = context.time;
|
|
13
13
|
time.reset();
|
|
14
|
-
const newTimeContext =
|
|
14
|
+
const newTimeContext = Time.contextFromFileName(context, filePath);
|
|
15
15
|
if (newTimeContext) {
|
|
16
16
|
time.setYear(newTimeContext.getYear());
|
|
17
17
|
time.setMonth(newTimeContext.getMonth());
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { TimeContext } from "./time/index.js";
|
|
2
1
|
import { RR0Messages } from "./lang/index.js";
|
|
3
2
|
import { FileContents, HtmlSsgContext, SsgConfig, SsgContext, SsgContextImpl } from "ssg-api";
|
|
4
3
|
import { People } from "./people/People.js";
|
|
5
|
-
|
|
4
|
+
import { TimeContext } from "@rr0/time";
|
|
5
|
+
export interface RR0Context extends SsgContext {
|
|
6
6
|
readonly messages: RR0Messages;
|
|
7
7
|
readonly time: TimeContext;
|
|
8
|
-
clone(locale?: string):
|
|
8
|
+
clone(locale?: string): RR0Context;
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface HtmlRR0Context extends HtmlSsgContext {
|
|
11
11
|
readonly messages: RR0Messages;
|
|
12
12
|
time: TimeContext;
|
|
13
13
|
people: People;
|
|
14
14
|
readonly images: Set<string>;
|
|
15
15
|
readonly config: SsgConfig;
|
|
16
|
-
clone(locale?: string):
|
|
16
|
+
clone(locale?: string): HtmlRR0Context;
|
|
17
17
|
}
|
|
18
|
-
export declare class
|
|
18
|
+
export declare class RR0ContextImpl extends SsgContextImpl {
|
|
19
19
|
readonly time: TimeContext;
|
|
20
20
|
readonly config: SsgConfig;
|
|
21
21
|
readonly people: any;
|
|
22
22
|
readonly messages: RR0Messages;
|
|
23
23
|
readonly images: Set<string>;
|
|
24
24
|
protected readonly fileMap: Map<string, FileContents>;
|
|
25
|
-
constructor(locale: string, time: TimeContext, config: SsgConfig, people?: any, currentFile?: FileContents | undefined);
|
|
25
|
+
constructor(locale: string, time: TimeContext, config: SsgConfig, people?: any, currentFile?: FileContents | undefined, messages?: RR0Messages);
|
|
26
26
|
read(filePath: string): FileContents;
|
|
27
|
-
clone(locale?: string):
|
|
27
|
+
clone(locale?: string): RR0ContextImpl;
|
|
28
28
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ssgMessages } from "./lang/index.js";
|
|
2
2
|
import { ConsoleLogger, SsgContextImpl } from "ssg-api";
|
|
3
|
-
export class
|
|
4
|
-
constructor(locale, time, config, people = undefined, currentFile = undefined) {
|
|
3
|
+
export class RR0ContextImpl extends SsgContextImpl {
|
|
4
|
+
constructor(locale, time, config, people = undefined, currentFile = undefined, messages = ssgMessages[locale]) {
|
|
5
5
|
super(locale, new Map(), "RR0", new ConsoleLogger("RR0"), currentFile);
|
|
6
6
|
this.time = time;
|
|
7
7
|
this.config = config;
|
|
8
8
|
this.people = people;
|
|
9
|
+
this.messages = messages;
|
|
9
10
|
this.images = new Set();
|
|
10
11
|
this.fileMap = new Map();
|
|
11
|
-
this.messages = ssgMessages[locale];
|
|
12
12
|
}
|
|
13
13
|
read(filePath) {
|
|
14
14
|
let file = this.fileMap.get(filePath);
|
|
@@ -24,6 +24,6 @@ export class RR0SsgContextImpl extends SsgContextImpl {
|
|
|
24
24
|
}
|
|
25
25
|
clone(locale = this.locale) {
|
|
26
26
|
var _a;
|
|
27
|
-
return new
|
|
27
|
+
return new RR0ContextImpl(locale, this.time.clone(), this.config, (_a = this.people) === null || _a === void 0 ? void 0 : _a.clone(), this._file);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HtmlRR0Context } from "RR0Context.js";
|
|
2
2
|
export interface AnchorHandler {
|
|
3
|
-
handle(context:
|
|
3
|
+
handle(context: HtmlRR0Context, a: HTMLAnchorElement, pathToSearch: string): Promise<void>;
|
|
4
4
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DomReplaceCommand, DomReplacer } from "ssg-api";
|
|
2
2
|
import { AnchorReplacer } from "./AnchorReplacer.js";
|
|
3
|
-
import {
|
|
3
|
+
import { HtmlRR0Context } from "RR0Context.js";
|
|
4
4
|
import { AnchorHandler } from "./AnchorHandler.js";
|
|
5
5
|
/**
|
|
6
6
|
* Contextual replacement of anchors (`<a>` tags).
|
|
@@ -8,5 +8,5 @@ import { AnchorHandler } from "./AnchorHandler.js";
|
|
|
8
8
|
export declare class AnchorReplaceCommand extends DomReplaceCommand<HTMLAnchorElement> {
|
|
9
9
|
protected readonly singleton: AnchorReplacer;
|
|
10
10
|
constructor(baseUrl: string, handlers: AnchorHandler[]);
|
|
11
|
-
protected createReplacer(context:
|
|
11
|
+
protected createReplacer(context: HtmlRR0Context): Promise<DomReplacer<HTMLAnchorElement>>;
|
|
12
12
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { HtmlSsgContext } from "ssg-api";
|
|
2
|
-
import {
|
|
2
|
+
import { HtmlRR0Context } from "RR0Context.js";
|
|
3
3
|
import { AnchorHandler } from "./AnchorHandler.js";
|
|
4
4
|
export declare class AnchorReplacer {
|
|
5
5
|
protected handlers: AnchorHandler[];
|
|
6
6
|
protected readonly baseUrl: string;
|
|
7
7
|
constructor(baseUrl: string, handlers: AnchorHandler[]);
|
|
8
|
-
replacement(context:
|
|
8
|
+
replacement(context: HtmlRR0Context, a: HTMLAnchorElement): Promise<HTMLAnchorElement>;
|
|
9
9
|
/**
|
|
10
10
|
* Update a link to denote it as external.
|
|
11
11
|
*
|
|
@@ -14,5 +14,5 @@ export declare class AnchorReplacer {
|
|
|
14
14
|
* @protected
|
|
15
15
|
*/
|
|
16
16
|
protected updateLinkExternal(context: HtmlSsgContext, a: HTMLAnchorElement): void;
|
|
17
|
-
protected updateLinkInternal(context:
|
|
17
|
+
protected updateLinkInternal(context: HtmlRR0Context, a: HTMLAnchorElement, url: URL): Promise<void>;
|
|
18
18
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AnchorHandler } from "./AnchorHandler.js";
|
|
2
|
-
import {
|
|
2
|
+
import { HtmlRR0Context } from "RR0Context.js";
|
|
3
3
|
import { TimeTextBuilder } from "../time/index.js";
|
|
4
4
|
import { CaseService } from "../science/crypto/ufo/enquete/dossier/CaseService.js";
|
|
5
5
|
export declare class CaseAnchorHandler implements AnchorHandler {
|
|
6
6
|
protected caseService: CaseService;
|
|
7
7
|
protected timeTextBuilder: TimeTextBuilder;
|
|
8
8
|
constructor(caseService: CaseService, timeTextBuilder: TimeTextBuilder);
|
|
9
|
-
handle(context:
|
|
9
|
+
handle(context: HtmlRR0Context, link: HTMLAnchorElement, pathToSearch: string): Promise<void>;
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TimeContext } from "../time/index.js";
|
|
2
1
|
import path from "path";
|
|
2
|
+
import { TimeContext } from "@rr0/time";
|
|
3
3
|
export class CaseAnchorHandler {
|
|
4
4
|
constructor(caseService, timeTextBuilder) {
|
|
5
5
|
this.caseService = caseService;
|
|
@@ -31,7 +31,7 @@ export class CaseAnchorHandler {
|
|
|
31
31
|
else if (!titles.includes(timeStr)) {
|
|
32
32
|
caseContext.time.updateFromStr(timeStr);
|
|
33
33
|
}
|
|
34
|
-
titles.push(this.timeTextBuilder.build(caseContext));
|
|
34
|
+
titles.push(this.timeTextBuilder.build(caseContext, true));
|
|
35
35
|
}
|
|
36
36
|
const place = aCase.place;
|
|
37
37
|
if (typeof place === "string" && !titles.includes(place)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AnchorHandler } from "./AnchorHandler.js";
|
|
2
|
-
import {
|
|
2
|
+
import { HtmlRR0Context } from "RR0Context.js";
|
|
3
3
|
import { AllDataService } from "../data/AllDataService.js";
|
|
4
4
|
import { RR0Data } from "../data/RR0Data.js";
|
|
5
5
|
export declare class DataAnchorHandler implements AnchorHandler {
|
|
@@ -9,9 +9,9 @@ export declare class DataAnchorHandler implements AnchorHandler {
|
|
|
9
9
|
*/
|
|
10
10
|
protected number: number;
|
|
11
11
|
constructor(dataService: AllDataService);
|
|
12
|
-
handle(context:
|
|
13
|
-
protected handleNote(context:
|
|
14
|
-
protected handleApi(context:
|
|
15
|
-
protected handleProduct(context:
|
|
16
|
-
protected handleOrg(context:
|
|
12
|
+
handle(context: HtmlRR0Context, linkEl: HTMLAnchorElement, pathToSearch: string): Promise<void>;
|
|
13
|
+
protected handleNote(context: HtmlRR0Context, linkEl: HTMLAnchorElement, note: string): void;
|
|
14
|
+
protected handleApi(context: HtmlRR0Context, data: RR0Data, linkEl: HTMLAnchorElement): void;
|
|
15
|
+
protected handleProduct(context: HtmlRR0Context, data: RR0Data, linkEl: HTMLAnchorElement): void;
|
|
16
|
+
protected handleOrg(context: HtmlRR0Context, data: RR0Data, linkEl: HTMLAnchorElement): void;
|
|
17
17
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ContentVisitor } from "RR0ContentStep.js";
|
|
2
2
|
import { HtmlLinks, HtmlMeta } from "ssg-api";
|
|
3
|
-
import {
|
|
3
|
+
import { HtmlRR0Context } from "RR0Context.js";
|
|
4
4
|
export declare class BookContentVisitor implements ContentVisitor {
|
|
5
5
|
protected bookMeta: Map<string, HtmlMeta>;
|
|
6
6
|
protected bookLinks: Map<string, HtmlLinks>;
|
|
7
7
|
constructor(bookMeta: Map<string, HtmlMeta>, bookLinks: Map<string, HtmlLinks>);
|
|
8
|
-
visit(context:
|
|
8
|
+
visit(context: HtmlRR0Context): Promise<void>;
|
|
9
9
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HtmlRR0Context } from "RR0Context.js";
|
|
2
2
|
import { DirectoryStep, HtmlLinks, HtmlMeta, OutputFunc, SsgConfig } from "ssg-api";
|
|
3
3
|
import { Book } from "./Book.js";
|
|
4
4
|
/**
|
|
@@ -10,8 +10,8 @@ export declare class BookDirectoryStep extends DirectoryStep {
|
|
|
10
10
|
protected bookLinks: Map<string, HtmlLinks>;
|
|
11
11
|
constructor(rootDirs: string[], templateFileName: string, outputFunc: OutputFunc, config: SsgConfig, name: string, bookMeta: Map<string, HtmlMeta>, bookLinks: Map<string, HtmlLinks>);
|
|
12
12
|
static create(outputFunc: OutputFunc, config: SsgConfig, bookMeta: Map<string, HtmlMeta>, bookLinks: Map<string, HtmlLinks>): Promise<BookDirectoryStep>;
|
|
13
|
-
protected processDirs(context:
|
|
14
|
-
protected scan(context:
|
|
13
|
+
protected processDirs(context: HtmlRR0Context, dirNames: string[]): Promise<void>;
|
|
14
|
+
protected scan(context: HtmlRR0Context, dirNames: string[]): Book[];
|
|
15
15
|
/**
|
|
16
16
|
* Convert an array of Case[] to an <ul> HTML unordered list.
|
|
17
17
|
*
|
|
@@ -24,6 +24,6 @@ export declare class BookDirectoryStep extends DirectoryStep {
|
|
|
24
24
|
* @param dirBook
|
|
25
25
|
*/
|
|
26
26
|
protected toListItem(dirBook: Book): string;
|
|
27
|
-
protected tocAll(context:
|
|
28
|
-
protected toc(context:
|
|
27
|
+
protected tocAll(context: HtmlRR0Context, books: Book[]): Promise<void>;
|
|
28
|
+
protected toc(context: HtmlRR0Context, book: Book): Promise<void>;
|
|
29
29
|
}
|
|
@@ -2,14 +2,16 @@ import { Logger, SsgConfig } from "ssg-api";
|
|
|
2
2
|
import { Book } from "./Book.js";
|
|
3
3
|
import { People } from "../people/People.js";
|
|
4
4
|
import { PeopleService } from "../people/PeopleService.js";
|
|
5
|
+
import { TimeUrlBuilder } from "../time";
|
|
5
6
|
export declare class BookService {
|
|
6
7
|
readonly logger: Logger;
|
|
7
8
|
protected dry: boolean;
|
|
8
9
|
protected peopleService: PeopleService;
|
|
10
|
+
protected timeUrlBuilder: TimeUrlBuilder;
|
|
9
11
|
protected config: SsgConfig;
|
|
10
12
|
protected readonly intlOptions: Intl.DateTimeFormatOptions;
|
|
11
13
|
protected peopleList: People[];
|
|
12
|
-
constructor(logger: Logger, dry: boolean, peopleService: PeopleService, config: SsgConfig);
|
|
14
|
+
constructor(logger: Logger, dry: boolean, peopleService: PeopleService, timeUrlBuilder: TimeUrlBuilder, config: SsgConfig);
|
|
13
15
|
import(fileName: string): Promise<Book[]>;
|
|
14
16
|
protected findPeople(fullName: string): Promise<People | undefined>;
|
|
15
17
|
}
|
package/dist/book/BookService.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import { FileUtil } from "ssg-api";
|
|
3
|
-
import { TimeContext } from "
|
|
4
|
-
import { TimeUrlBuilder } from "../time/TimeUrlBuilder.js";
|
|
3
|
+
import { TimeContext } from "@rr0/time";
|
|
5
4
|
import * as path from "path";
|
|
6
5
|
import { StringUtil } from "../util/string/StringUtil.js";
|
|
7
6
|
import { CSVFileReader } from "../CSVFileReader.js";
|
|
8
7
|
export class BookService {
|
|
9
|
-
constructor(logger, dry, peopleService, config) {
|
|
8
|
+
constructor(logger, dry, peopleService, timeUrlBuilder, config) {
|
|
10
9
|
this.logger = logger;
|
|
11
10
|
this.dry = dry;
|
|
12
11
|
this.peopleService = peopleService;
|
|
12
|
+
this.timeUrlBuilder = timeUrlBuilder;
|
|
13
13
|
this.config = config;
|
|
14
14
|
this.intlOptions = {
|
|
15
15
|
year: "numeric",
|
|
@@ -67,7 +67,7 @@ export class BookService {
|
|
|
67
67
|
authorsStr = authorsStr.substring(0, authorsStr.length - andAl.length - 1) + andAl;
|
|
68
68
|
}
|
|
69
69
|
} while (dirName.length >= 255);
|
|
70
|
-
const parentDir =
|
|
70
|
+
const parentDir = this.timeUrlBuilder.fromContext(time);
|
|
71
71
|
const bookDir = path.join(parentDir, dirName);
|
|
72
72
|
const id = result[COLUMN_ISBN];
|
|
73
73
|
const book = {
|
package/dist/book/Chapters.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HtmlRR0Context } from "RR0Context.js";
|
|
2
2
|
export declare class Chapter {
|
|
3
3
|
protected startFileName: string;
|
|
4
|
-
readonly context:
|
|
4
|
+
readonly context: HtmlRR0Context;
|
|
5
5
|
subs: Chapter[];
|
|
6
|
-
constructor(parentContext:
|
|
6
|
+
constructor(parentContext: HtmlRR0Context, startFileName: string);
|
|
7
7
|
scan(): Promise<void>;
|
|
8
8
|
toString(prefix?: string): string;
|
|
9
9
|
update(parent?: Chapter): Promise<void>;
|
package/dist/book/Chapters.js
CHANGED
|
@@ -71,7 +71,7 @@ ${this.subs.map(subFile => subFile.toString(" " + prefix)).join("")}`;
|
|
|
71
71
|
const args = new CLI().getArgs();
|
|
72
72
|
const startFileName = args.start;
|
|
73
73
|
|
|
74
|
-
const context = new
|
|
74
|
+
const context = new RR0ContextImpl('fr', new TimeContext({
|
|
75
75
|
year: 'numeric',
|
|
76
76
|
month: 'long',
|
|
77
77
|
day: 'numeric',
|
|
@@ -89,7 +89,7 @@ for (const variant of variants) {
|
|
|
89
89
|
startFileNames.push(variantFileName);
|
|
90
90
|
}
|
|
91
91
|
for (const startFileName of startFileNames) {
|
|
92
|
-
const chapter = new Chapter(context as unknown as
|
|
92
|
+
const chapter = new Chapter(context as unknown as HtmlRR0Context, startFileName);
|
|
93
93
|
chapter.scan().then(async () => {
|
|
94
94
|
console.log('*** Before:\n', chapter.toString());
|
|
95
95
|
await chapter.update();
|
package/dist/build.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CaseSummaryRenderer, ChronologyReplacerFactory, CsvMapper, EventReplacer, EventReplacerFactory, HttpSource, RR0Mapping, SsiTitleReplaceCommand, Time,
|
|
1
|
+
import { CaseSummaryRenderer, ChronologyReplacerFactory, CsvMapper, EventReplacer, EventReplacerFactory, HttpSource, RR0Mapping, SsiTitleReplaceCommand, Time, TimeElementFactory, TimeLinkDefaultHandler, TimeReplacer, TimeReplacerFactory, TimeService, TimeTextBuilder, TimeUrlBuilder } from "./time";
|
|
2
2
|
import { CaseDirectoryStep, CaseFactory, CaseService } from "./science/index.js";
|
|
3
3
|
import { GooglePlaceService, PlaceReplacerFactory } from "./place/index.js";
|
|
4
4
|
import { OrganizationFactory, OrganizationService } from "./org/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { RR0ContextImpl } from "./RR0Context.js";
|
|
6
6
|
import { CLI, HtmlTable } from "./util/index.js";
|
|
7
7
|
import { AngularExpressionReplaceCommand, ClassDomReplaceCommand, CopyStep, DomReplaceCommand, FileContents, FileUtil, HtAccessToNetlifyConfigReplaceCommand, Ssg, SsiEchoVarReplaceCommand, SsiIfReplaceCommand, SsiIncludeReplaceCommand, SsiLastModifiedReplaceCommand, SsiSetVarReplaceCommand, StringEchoVarReplaceCommand } from "ssg-api";
|
|
8
8
|
import { LanguageReplaceCommand } from "./lang/index.js";
|
|
@@ -28,6 +28,8 @@ import { DefaultContentVisitor } from "./DefaultContentVisitor.js";
|
|
|
28
28
|
import { RR0EventFactory } from "./event/index.js";
|
|
29
29
|
import fs from "fs";
|
|
30
30
|
import { rr0DefaultCopyright } from "./RR0DefaultCopyright.js";
|
|
31
|
+
import { glob } from "glob";
|
|
32
|
+
import { TimeContext } from "@rr0/time";
|
|
31
33
|
console.time("ssg");
|
|
32
34
|
let args = new CLI().getArgs();
|
|
33
35
|
const configFile = args.config;
|
|
@@ -96,7 +98,7 @@ const timeFormat = {
|
|
|
96
98
|
minute: "2-digit"
|
|
97
99
|
};
|
|
98
100
|
const timeContext = new TimeContext();
|
|
99
|
-
const context = new
|
|
101
|
+
const context = new RR0ContextImpl("fr", timeContext, config);
|
|
100
102
|
context.setVar("mail", "rr0@rr0.org");
|
|
101
103
|
const siteBaseUrl = "https://rr0.org/";
|
|
102
104
|
const eventFactory = new RR0EventFactory();
|
|
@@ -111,9 +113,13 @@ const dataService = new AllDataService([orgFactory, caseFactory, peopleFactory,
|
|
|
111
113
|
dataService.getFromDir("", ["people", "case"]).then(data => {
|
|
112
114
|
console.debug(data);
|
|
113
115
|
});
|
|
116
|
+
const timeOptions = {
|
|
117
|
+
root: "src/time",
|
|
118
|
+
files: []
|
|
119
|
+
};
|
|
114
120
|
const timeTextBuilder = new TimeTextBuilder(timeFormat);
|
|
115
|
-
const
|
|
116
|
-
const
|
|
121
|
+
const timeUrlBuilder = new TimeUrlBuilder({ rootDir: timeOptions.root });
|
|
122
|
+
const timeService = new TimeService(dataService, timeTextBuilder, timeUrlBuilder, timeOptions);
|
|
117
123
|
const googleMapsApiKey = process.env.GOOGLE_MAPS_API_KEY;
|
|
118
124
|
if (!googleMapsApiKey) {
|
|
119
125
|
throw Error("GOOGLE_MAPS_API_KEY is required");
|
|
@@ -121,11 +127,24 @@ if (!googleMapsApiKey) {
|
|
|
121
127
|
context.setVar("mapsApiKey", googleMapsApiKey);
|
|
122
128
|
const placeService = new GooglePlaceService("place", googleMapsApiKey);
|
|
123
129
|
const orgService = new OrganizationService([], "org", undefined);
|
|
124
|
-
|
|
130
|
+
async function getTimeFiles() {
|
|
131
|
+
const minusYearFiles = await glob("time/-?/?/?/?/index.html");
|
|
132
|
+
const year1Files = await glob("time/?/index.html");
|
|
133
|
+
const year2Files = await glob("time/?/?/index.html");
|
|
134
|
+
const year3Files = await glob("time/?/?/?/index.html");
|
|
135
|
+
const year4Files = await glob("time/?/?/?/?/index.html");
|
|
136
|
+
const monthFiles = await glob("time/?/?/?/?/??/index.html");
|
|
137
|
+
const dayFiles = await glob("time/?/?/?/?/??/??/index.html");
|
|
138
|
+
return year1Files.concat(year2Files).concat(year3Files).concat(year4Files).concat(minusYearFiles).concat(monthFiles).concat(dayFiles).sort();
|
|
139
|
+
}
|
|
140
|
+
getTimeFiles().then(async (timeFiles) => {
|
|
125
141
|
context.setVar("timeFilesCount", timeFiles.length);
|
|
126
142
|
const timeElementFactory = new TimeElementFactory(timeService.renderer);
|
|
127
|
-
const caseService = new CaseService(dataService, caseFactory, timeElementFactory);
|
|
128
143
|
const timeReplacer = new TimeReplacer(timeElementFactory);
|
|
144
|
+
const caseFiles = await caseFactory.getFiles();
|
|
145
|
+
const caseService = new CaseService(dataService, caseFactory, timeElementFactory, caseFiles);
|
|
146
|
+
const peopleFiles = await peopleFactory.getFiles();
|
|
147
|
+
const peopleService = new PeopleService(dataService, peopleFactory, peopleFiles);
|
|
129
148
|
const peopleList = await peopleService.getAll();
|
|
130
149
|
context.setVar("peopleFilesCount", peopleList.length);
|
|
131
150
|
const bookMeta = new Map();
|
|
@@ -194,7 +213,7 @@ timeService.getFiles().then(async (timeFiles) => {
|
|
|
194
213
|
new ClassDomReplaceCommand(noteReplacerFactory, "note"),
|
|
195
214
|
new ClassDomReplaceCommand(new IndexedReplacerFactory(), "indexed"),
|
|
196
215
|
new UnitReplaceCommand(),
|
|
197
|
-
new MetaLinkReplaceCommand(new TimeLinkDefaultHandler(
|
|
216
|
+
new MetaLinkReplaceCommand(new TimeLinkDefaultHandler(timeService, timeTextBuilder)),
|
|
198
217
|
databaseAggregationCommand
|
|
199
218
|
];
|
|
200
219
|
const ssg = new Ssg(config);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { RR0Data } from "./RR0Data.js";
|
|
2
|
-
import { TimeContext } from "../time/index.js";
|
|
3
2
|
import { RR0DataFactory } from "./RR0DataFactory.js";
|
|
4
|
-
import {
|
|
3
|
+
import { RR0EventFactory } from "../event/RR0EventFactory.js";
|
|
4
|
+
import { RR0Event } from "../event/RR0Event.js";
|
|
5
|
+
import { TimeContext } from "@rr0/time";
|
|
5
6
|
export declare class AbstractDataFactory<T extends RR0Data> implements RR0DataFactory<T> {
|
|
6
7
|
protected eventFactory: RR0EventFactory;
|
|
7
8
|
static readonly defaultImageFileNames: string[];
|
|
@@ -5,9 +5,8 @@ import { RR0Case } from "../science/crypto/ufo/enquete/dossier/RR0Case.js";
|
|
|
5
5
|
export declare abstract class AbstractDataService<T extends RR0Data> {
|
|
6
6
|
protected readonly dataService: AllDataService;
|
|
7
7
|
protected factory: TypedDataFactory<T>;
|
|
8
|
-
|
|
9
|
-
protected constructor(dataService: AllDataService, factory: TypedDataFactory<T
|
|
8
|
+
readonly files: string[];
|
|
9
|
+
protected constructor(dataService: AllDataService, factory: TypedDataFactory<T>, files: string[]);
|
|
10
10
|
get type(): string;
|
|
11
11
|
get(path: string): Promise<RR0Case[] | undefined>;
|
|
12
|
-
getFiles(): Promise<string[]>;
|
|
13
12
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RR0FileUtil } from "../util/file/RR0FileUtil.js";
|
|
2
1
|
export class AbstractDataService {
|
|
3
|
-
constructor(dataService, factory) {
|
|
2
|
+
constructor(dataService, factory, files) {
|
|
4
3
|
this.dataService = dataService;
|
|
5
4
|
this.factory = factory;
|
|
5
|
+
this.files = files;
|
|
6
6
|
}
|
|
7
7
|
get type() {
|
|
8
8
|
return this.factory.type;
|
|
@@ -10,10 +10,4 @@ export class AbstractDataService {
|
|
|
10
10
|
async get(path) {
|
|
11
11
|
return this.dataService.getFromDir(path, [this.type, undefined], [this.type + ".json"]);
|
|
12
12
|
}
|
|
13
|
-
async getFiles() {
|
|
14
|
-
if (!this.files) {
|
|
15
|
-
this.files = RR0FileUtil.findDirectoriesContaining(this.factory.fileNames[0] + ".json", "out");
|
|
16
|
-
}
|
|
17
|
-
return this.files;
|
|
18
|
-
}
|
|
19
13
|
}
|