@rr0/cms 0.3.24 → 0.3.26

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.
@@ -27,7 +27,7 @@ export async function getTimeFiles() {
27
27
  describe("Build", () => {
28
28
  console.time("ssg");
29
29
  const args = {
30
- contents: ["test/people/a/Aristote/*.html"],
30
+ contents: ["test/**/*.html"],
31
31
  force: "true"
32
32
  };
33
33
  const cliContents = args.contents;
@@ -7,7 +7,7 @@ import { imageSizeFromFile } from "image-size/fromFile";
7
7
  */
8
8
  export class ImageCommand extends DomReplaceCommand {
9
9
  constructor(outBaseDir, maxWidth, maxHeight, baseUrl = "") {
10
- super("img", undefined);
10
+ super("img:not(.raw)", undefined);
11
11
  this.outBaseDir = outBaseDir;
12
12
  this.maxWidth = maxWidth;
13
13
  this.maxHeight = maxHeight;
@@ -39,6 +39,7 @@ export declare class OpenGraphCommand implements ReplaceCommand<HtmlRR0Context>
39
39
  * @private
40
40
  */
41
41
  protected drawGradient(canvasCtx: CanvasRenderingContext2D, widthRatio: number, startColor?: string, endColor?: string): void;
42
+ readonly supportedFiles = "img[src$='.png'],img[src$='.jpg'],img[src$='.gif']";
42
43
  /**
43
44
  * Draw a height-scaled image on the right of the canvas.
44
45
  *
@@ -15,6 +15,7 @@ export class OpenGraphCommand {
15
15
  this.width = width;
16
16
  this.height = height;
17
17
  this.num = 0;
18
+ this.supportedFiles = "img[src$='.png'],img[src$='.jpg'],img[src$='.gif']";
18
19
  }
19
20
  async execute(context) {
20
21
  const title = context.file.title;
@@ -152,7 +153,7 @@ export class OpenGraphCommand {
152
153
  */
153
154
  async drawImage(context, canvasCtx, dy = 0) {
154
155
  const outDoc = context.file.document;
155
- const docImages = outDoc.documentElement.getElementsByTagName("img");
156
+ const docImages = outDoc.documentElement.querySelectorAll(this.supportedFiles);
156
157
  let widthRatio = 0.5;
157
158
  let imageIndex = 0;
158
159
  if (imageIndex < docImages.length) {
@@ -54,7 +54,7 @@ export class PeopleHtmlRenderer {
54
54
  titles.push(occupationMsg(gender));
55
55
  }
56
56
  }
57
- const text = content || people.lastAndFirstName;
57
+ const text = content || people.lastAndFirstName || people.title;
58
58
  const doc = context.file.document;
59
59
  const link = doc.createElement("a");
60
60
  link.innerHTML = text;
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.24",
5
+ "version": "0.3.26",
6
6
  "description": "RR0 Content Management System (CMS)",
7
7
  "exports": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",