@rr0/cms 0.3.39 → 0.3.41

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.
@@ -58,7 +58,7 @@ export class DataContentVisitor {
58
58
  const eventTime = eventContext.time.date = event.time;
59
59
  assert.ok(eventTime, `Event of type "${event.type}" has no time for paragraph`);
60
60
  container.dataset.time = eventTime.toString();
61
- const timeEl = this.timeElementFactory.create(eventContext, context);
61
+ const timeEl = this.timeElementFactory.create(eventContext, context, { url: true, contentOnly: false });
62
62
  return { eventP: container, timeEl };
63
63
  }
64
64
  async processImage(context, imageData) {
@@ -84,6 +84,7 @@ export class DataContentVisitor {
84
84
  }
85
85
  }
86
86
  async processBirth(context, event, entity) {
87
+ var _a;
87
88
  const parentEl = context.file.document.querySelector(".contents");
88
89
  if (parentEl) {
89
90
  const { eventP, timeEl } = this.timeParagraph(context, event);
@@ -97,7 +98,8 @@ export class DataContentVisitor {
97
98
  eventP.append(this.eventRenderer.placeElement(context, eventPlace));
98
99
  }
99
100
  await this.eventRenderer.renderEnd(context, event, eventP);
100
- const insertEl = parentEl.firstElementChild;
101
+ const allExergues = context.file.document.querySelectorAll(".exergue");
102
+ const insertEl = ((_a = allExergues[allExergues.length - 1]) === null || _a === void 0 ? void 0 : _a.nextElementSibling) || parentEl.firstElementChild;
101
103
  parentEl.insertBefore(eventP, insertEl);
102
104
  }
103
105
  else {
@@ -128,7 +130,7 @@ export class DataContentVisitor {
128
130
  const bookEl = doc.createElement("p");
129
131
  const people = context.people;
130
132
  const birthContext = context.clone();
131
- const bookDateEl = this.timeElementFactory.create(birthContext, context);
133
+ const bookDateEl = this.timeElementFactory.create(birthContext, context, { url: true, contentOnly: false });
132
134
  bookEl.append(bookDateEl, " ");
133
135
  bookEl.append((people.gender === "female" ? "elle" : "il") + " écrit un livre");
134
136
  await this.eventRenderer.renderEnd(context, bookData, bookEl);
@@ -6,7 +6,7 @@ import { TimeRenderer, TimeRenderOptions } from "./TimeRenderer.js";
6
6
  export declare class TimeElementFactory {
7
7
  readonly renderer: TimeRenderer;
8
8
  constructor(renderer: TimeRenderer);
9
- create(context: HtmlRR0Context, previousContext: HtmlRR0Context | undefined, options?: TimeRenderOptions): HTMLElement | undefined;
9
+ create(context: HtmlRR0Context, previousContext: HtmlRR0Context | undefined, options: TimeRenderOptions): HTMLElement | undefined;
10
10
  protected createInterval(fromContext: HtmlRR0Context, toContext: HtmlRR0Context, previousContext: HtmlRR0Context, options: TimeRenderOptions): HTMLElement | undefined;
11
11
  protected createStarting(fromContext: HtmlRR0Context, previousContext: HtmlRR0Context, options: TimeRenderOptions): HTMLElement | undefined;
12
12
  protected valueReplacement(context: HtmlRR0Context, previousContext: RR0Context | undefined, options?: TimeRenderOptions): HTMLElement | undefined;
@@ -6,7 +6,7 @@ export class TimeElementFactory {
6
6
  constructor(renderer) {
7
7
  this.renderer = renderer;
8
8
  }
9
- create(context, previousContext, options = { url: true, contentOnly: true }) {
9
+ create(context, previousContext, options) {
10
10
  let replacement;
11
11
  const time = context.time;
12
12
  const interval = time.interval;
@@ -20,7 +20,7 @@ export class TimeReplacer {
20
20
  const previousContext = origEl.dataset.context === "none" ? undefined : context.clone();
21
21
  const timeStr = origEl.textContent;
22
22
  const valid = context.time.updateFromStr(timeStr);
23
- replacement = valid && this.factory.create(context, previousContext);
23
+ replacement = valid && this.factory.create(context, previousContext, { url: true, contentOnly: true });
24
24
  if (!replacement) {
25
25
  replacement = origEl;
26
26
  // replacement.setAttribute("datetime", context.time.toString())
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.39",
5
+ "version": "0.3.41",
6
6
  "description": "RR0 Content Management System (CMS)",
7
7
  "exports": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",