@tolokoban/impress 0.20.0 → 0.20.1

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.
Files changed (2) hide show
  1. package/dist/impress.js +7 -7
  2. package/package.json +1 -1
package/dist/impress.js CHANGED
@@ -612,7 +612,7 @@ function parse(md, file) {
612
612
  const level = m[1].length;
613
613
  while (cur.level >= level)
614
614
  cur = cur.parent;
615
- const sec = new Section(level, stripMd(m[2]), cur, root.source);
615
+ const sec = new Section(level, m[2].trim(), cur, root.source);
616
616
  sec.layout = layout;
617
617
  layout = null;
618
618
  cur.children.push(sec);
@@ -2292,14 +2292,14 @@ class Builder {
2292
2292
  titleShapes(title, crumbs) {
2293
2293
  const out = [];
2294
2294
  if (crumbs.length)
2295
- out.push(this.frame("Fil-ariane", X0, 0.35, W, 0.6, `<text:p>${xmlText(crumbs.join(" › "))}</text:p>`));
2296
- out.push(this.frame("Master-title", X0, 0.95, W, 1.6, `<text:p>${xmlText(title)}</text:p>`, "title", this.takeHints()));
2295
+ out.push(this.frame("Fil-ariane", X0, 0.35, W, 0.6, `<text:p>${crumbs.map(runsXml).join(" › ")}</text:p>`));
2296
+ out.push(this.frame("Master-title", X0, 0.95, W, 1.6, `<text:p>${runsXml(title)}</text:p>`, "title", this.takeHints()));
2297
2297
  return out;
2298
2298
  }
2299
2299
  sectionPage(sec) {
2300
2300
  // The big title is always the top-level (`#`) heading; the hierarchy box comes in `finish()`.
2301
2301
  const [title] = sec.path();
2302
- const shapes = [this.frame("Section-title", SEC.x, SEC.titleY, SEC.w, SEC.titleH, `<text:p>${xmlText(title)}</text:p>`, "title", this.takeHints())];
2302
+ const shapes = [this.frame("Section-title", SEC.x, SEC.titleY, SEC.w, SEC.titleH, `<text:p>${runsXml(title)}</text:p>`, "title", this.takeHints())];
2303
2303
  const notes = sec.blocks.flatMap(b => (b.t === "note" ? [b.text] : []));
2304
2304
  this.page("Section", shapes, notes).toc = sec;
2305
2305
  this.lastPath = sec.path();
@@ -2337,7 +2337,7 @@ class Builder {
2337
2337
  for (const child of parent.children) {
2338
2338
  if (child.continued || !child.title)
2339
2339
  continue;
2340
- let text = xmlText(child.title);
2340
+ let text = runsXml(child.title);
2341
2341
  if (child === current)
2342
2342
  text = `<text:span text:style-name="T_section">${text}</text:span>`;
2343
2343
  lines.push(text);
@@ -2414,7 +2414,7 @@ class Builder {
2414
2414
  /** Preferred width of a cell content, used by `auto` columns. */
2415
2415
  static preferredWidth(sec, height, textPt) {
2416
2416
  const cw = (pt) => pt * PT * 0.5;
2417
- let w = sec.title.length * cw(sizes.gridTitle) + 0.8;
2417
+ let w = plainLen(sec.title) * cw(sizes.gridTitle) + 0.8;
2418
2418
  for (const b of sec.blocks) {
2419
2419
  if (b.t === "para" || b.t === "quote")
2420
2420
  w = Math.max(w, plainLen(b.text) * cw(textPt) + 0.8);
@@ -2583,7 +2583,7 @@ class Builder {
2583
2583
  // Cells of an `@layout` of blocks have no heading.
2584
2584
  const hh = sec.title ? headH : 0;
2585
2585
  if (sec.title)
2586
- shapes.push(this.frame(headStyle, x, y, w, hh, `<text:p>${xmlText(sec.title)}</text:p>`));
2586
+ shapes.push(this.frame(headStyle, x, y, w, hh, `<text:p>${runsXml(sec.title)}</text:p>`));
2587
2587
  shapes.push(...this.cellXml(sec, x, y + hh, w, h - hh, textStyle, textPt));
2588
2588
  notes.push(...sec.blocks.flatMap(b => (b.t === "note" ? [b.text] : [])));
2589
2589
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolokoban/impress",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "Convert teaching markdown files into LibreOffice Impress presentations (.odp)",
5
5
  "type": "module",
6
6
  "bin": {