@rr0/cms 0.3.75 → 0.3.77

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.
@@ -80,6 +80,7 @@ export class SourceFactory {
80
80
  * @param href
81
81
  */
82
82
  async createExternal(context, href) {
83
+ var _a, _b;
83
84
  const resOut = {};
84
85
  let title;
85
86
  let lastModif;
@@ -94,7 +95,7 @@ export class SourceFactory {
94
95
  context.error("Could not fetch source from " + href, e.message);
95
96
  title = href;
96
97
  }
97
- publisher = resOut.headers.get("host");
98
+ publisher = (_b = (_a = resOut.headers) === null || _a === void 0 ? void 0 : _a.get("host")) !== null && _b !== void 0 ? _b : new URL(href).host; // No response when the fetch failed
98
99
  const time = lastModif ? EdtfDate.fromDate(new Date(lastModif)) : context.time.date;
99
100
  const publication = { publisher, time };
100
101
  return {
@@ -53,12 +53,13 @@ export class TimeElementFactory {
53
53
  return replacement;
54
54
  }
55
55
  createStarting(fromContext, previousContext, options) {
56
+ options = { ...options, relativeWords: false }; // Not "à partir de l'année suivante"
56
57
  const { result, replacement } = this.renderer.renderContent(fromContext, previousContext, options);
57
58
  let startingReplacement;
58
59
  startingReplacement = fromContext.file.document.createElement("span");
59
60
  startingReplacement.className = "time-interval";
60
61
  const approximate = !fromContext.time.getDayOfMonth();
61
- startingReplacement.innerHTML = fromContext.messages.context.time.starting(approximate) + " " + result.outerHTML;
62
+ startingReplacement.textContent = fromContext.messages.context.time.starting(approximate);
62
63
  result.append(startingReplacement, replacement);
63
64
  return result;
64
65
  }
@@ -236,6 +236,10 @@ describe("TimeReplacer", async () => {
236
236
  test("but not without one", async () => {
237
237
  expect(await renderAfter("fr", "<time>2005</time>. Puis, <time>2006</time>")).toBe("l'année suivante");
238
238
  });
239
+ test("including the one of an open interval", async () => {
240
+ expect(await renderAfter("fr", "<time>2005</time>. <time>2006/</time>")).toBe("à partir de 2006");
241
+ expect(await renderAfter("en", "<time>2005</time>. <time>2006/</time>")).toBe("starting 2006");
242
+ });
239
243
  });
240
244
  test("avoids linking to current file", async () => {
241
245
  const context = cmsTestUtil.time.newHtmlContext("1/9/9/0/08/index.html", "");
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.75",
5
+ "version": "0.3.77",
6
6
  "description": "RR0 Content Management System (CMS)",
7
7
  "exports": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",