egatari 0.6.12 → 0.6.13

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 (107) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/README.ja.md +2 -2
  3. package/README.md +2 -2
  4. package/bin/egatari.mjs +3 -1
  5. package/components.lock.json +141 -51
  6. package/components2.lock.json +500 -1
  7. package/kit/browser.mjs +19 -7
  8. package/kit/check-messages.mjs +2 -0
  9. package/kit/check.mjs +2 -0
  10. package/kit/core/article-links.mjs +5 -4
  11. package/kit/core/article-messages.mjs +6 -1
  12. package/kit/core/article-render.mjs +61 -42
  13. package/kit/core/article-text.mjs +42 -1
  14. package/kit/core/article.mjs +7 -6
  15. package/kit/core/build-core.mjs +4 -0
  16. package/kit/core/caution.mjs +49 -0
  17. package/kit/core/check-parity.mjs +1 -0
  18. package/kit/core/check-rules.mjs +3 -0
  19. package/kit/core/check-source.mjs +2 -0
  20. package/kit/core/colab-core.mjs +1 -1
  21. package/kit/core/llm-pack-assemble.mjs +4 -3
  22. package/kit/core/llm-pack-data.mjs +124 -10
  23. package/kit/core/part-labels.mjs +3 -0
  24. package/kit/core/purposes.mjs +6 -8
  25. package/kit/instruction-version.json +1 -1
  26. package/kit/layouts.css +8 -1
  27. package/kit/player.json +1 -1
  28. package/kit/player.lock.json +2 -2
  29. package/package.json +1 -1
  30. package/themes/asagi/theme.json +1 -1
  31. package/themes/asagi/tokens.css +2 -0
  32. package/themes/bengara/theme.json +1 -1
  33. package/themes/bengara/tokens.css +2 -0
  34. package/themes/business/theme.json +1 -1
  35. package/themes/business/tokens.css +2 -0
  36. package/themes/default/theme.json +1 -1
  37. package/themes/default/tokens.css +2 -0
  38. package/themes/kogecha/theme.json +1 -1
  39. package/themes/kogecha/tokens.css +2 -0
  40. package/themes/kokugo/theme.json +1 -1
  41. package/themes/kokugo/tokens.css +2 -0
  42. package/themes/murasaki/theme.json +1 -1
  43. package/themes/murasaki/tokens.css +2 -0
  44. package/themes/sumi/theme.json +1 -1
  45. package/themes/sumi/tokens.css +2 -0
  46. package/themes/tokiwa/theme.json +1 -1
  47. package/themes/tokiwa/tokens.css +2 -0
  48. package/themes.lock.json +92 -28
  49. package/vendor/components/CATALOG.md +6 -3
  50. package/vendor/components/sha256/061415b5f5a1861e115103224ebbcaf689b602cd9972516001f50f4646d3692a/README.en.md +33 -0
  51. package/vendor/components/sha256/061415b5f5a1861e115103224ebbcaf689b602cd9972516001f50f4646d3692a/index.js +390 -0
  52. package/vendor/components/sha256/1854c2d9091a44f465a8de71de2ef3cfa26de3750c67aba4d0ab6eef9b826b8c/README.en.md +21 -0
  53. package/vendor/components/sha256/1854c2d9091a44f465a8de71de2ef3cfa26de3750c67aba4d0ab6eef9b826b8c/index.js +108 -0
  54. package/vendor/components/sha256/19803bbabc26cab7937b17c101f0529239ad505e2ef72a5b21c5d0b9afb063b5/README.en.md +35 -0
  55. package/vendor/components/sha256/19803bbabc26cab7937b17c101f0529239ad505e2ef72a5b21c5d0b9afb063b5/index.js +179 -0
  56. package/vendor/components/sha256/1fac9a4c6608f0150a51275fb11bad0dcff00bed1696c2d93d150fa97219e41a/README.en.md +23 -0
  57. package/vendor/components/sha256/1fac9a4c6608f0150a51275fb11bad0dcff00bed1696c2d93d150fa97219e41a/index.js +147 -0
  58. package/vendor/components/sha256/24e433f4e96427b5b4625ea6542ae74393a8610a9e3d331d01481b3185c827d4/README.en.md +66 -0
  59. package/vendor/components/sha256/24e433f4e96427b5b4625ea6542ae74393a8610a9e3d331d01481b3185c827d4/index.js +984 -0
  60. package/vendor/components/sha256/336f518ad98df0700348406a1fcc4a2de6843b68de0d2e6fcb2cf92428cc3f32/index.js +121 -0
  61. package/vendor/components/sha256/362590bb028486c9b92c90b0c04bb21c9989b7da1b9d234f0d3c26093770eb52/index.js +228 -0
  62. package/vendor/components/sha256/3c79d2605e1949c302a5e190dab3d12812e548af7d66e80dd73dc517dfa1ae3d/index.js +268 -0
  63. package/vendor/components/sha256/4526a332a77fce02370c58d6acd2b83777bfac10aca91e304f105ca2d6935e21/README.en.md +40 -0
  64. package/vendor/components/sha256/4526a332a77fce02370c58d6acd2b83777bfac10aca91e304f105ca2d6935e21/index.js +405 -0
  65. package/vendor/components/sha256/46fd8b2bfa296e18d7720dec9c9639421fb02cec1b641e50e2cadefcc3945675/README.en.md +31 -0
  66. package/vendor/components/sha256/46fd8b2bfa296e18d7720dec9c9639421fb02cec1b641e50e2cadefcc3945675/index.js +236 -0
  67. package/vendor/components/sha256/49fc5add9b34d9a34fcf9ffa3772da4a36d054feead033a7212b98ce1e18705d/index.js +465 -0
  68. package/vendor/components/sha256/4bedc6e22490461bb624d1801954aed230e9f47e393d2a9779c89c4c6483ab3e/README.en.md +42 -0
  69. package/vendor/components/sha256/4bedc6e22490461bb624d1801954aed230e9f47e393d2a9779c89c4c6483ab3e/index.js +549 -0
  70. package/vendor/components/sha256/5b3a29cd3ad1c572ba2864430fde589a0fa90f5a7cf6c8753ccfc97dd16d99f3/README.en.md +37 -0
  71. package/vendor/components/sha256/5b3a29cd3ad1c572ba2864430fde589a0fa90f5a7cf6c8753ccfc97dd16d99f3/index.js +501 -0
  72. package/vendor/components/sha256/6e9d8d26ba0427f26a8143ecaf1ff3a3fec1a6cb114ef5feed15a62f6a6e77c2/README.en.md +54 -0
  73. package/vendor/components/sha256/6e9d8d26ba0427f26a8143ecaf1ff3a3fec1a6cb114ef5feed15a62f6a6e77c2/index.js +470 -0
  74. package/vendor/components/sha256/9ffe48f7c39657aacbbca355c8268a4682f306c0e453bdd73b69c3ed7e0cb030/README.en.md +30 -0
  75. package/vendor/components/sha256/9ffe48f7c39657aacbbca355c8268a4682f306c0e453bdd73b69c3ed7e0cb030/index.js +192 -0
  76. package/vendor/components/sha256/a04ba1b59cae0406ad91c64da77df1f77d0ae6fb5629da4549452f68b926a20b/index.js +315 -0
  77. package/vendor/components/sha256/c129c1c6c5df8ddafed87ea41fe6f9fc03784b2904059321f970d16ff3238bf8/index.js +312 -0
  78. package/vendor/components/sha256/d831672acd189fd9e6bd294bdbceab539f4b2dc4ec0415e776a9fe740c499544/index.js +97 -0
  79. package/vendor/components/sha256/dc5d9e6da444ef49ac343c870271c6679601040bf3a38a389a7991ffd39dd0fc/index.js +607 -0
  80. package/vendor/components/sha256/deae02519dd79e53cf18137777d486cb3b3234ab02a71d26c4e2925593b047ba/LICENSE-tabler.txt +21 -0
  81. package/vendor/components/sha256/deae02519dd79e53cf18137777d486cb3b3234ab02a71d26c4e2925593b047ba/index.js +4868 -0
  82. package/vendor/components/sha256/deae02519dd79e53cf18137777d486cb3b3234ab02a71d26c4e2925593b047ba/names.txt +4808 -0
  83. package/vendor/components/sha256/e76667b8fbaeb6c5d05ada81b2230f21388e2e68f3437034d2a54ead1c8ccbef/README.en.md +32 -0
  84. package/vendor/components/sha256/e76667b8fbaeb6c5d05ada81b2230f21388e2e68f3437034d2a54ead1c8ccbef/index.js +222 -0
  85. package/vendor/components-2/manifest-2.9.0.json +2204 -0
  86. package/vendor/components-2/manifest-2.9.1.json +2204 -0
  87. package/vendor/egatari-spec/SOURCE.json +3 -3
  88. package/vendor/themes/asagi/1.3.0/theme.json +14 -0
  89. package/vendor/themes/asagi/1.3.0/tokens.css +36 -0
  90. package/vendor/themes/bengara/1.0.0/theme.json +13 -0
  91. package/vendor/themes/bengara/1.0.0/tokens.css +66 -0
  92. package/vendor/themes/business/1.3.0/theme.json +5 -0
  93. package/vendor/themes/business/1.3.0/tokens.css +47 -0
  94. package/vendor/themes/default/1.5.0/README.ja.md +65 -0
  95. package/vendor/themes/default/1.5.0/README.md +65 -0
  96. package/vendor/themes/default/1.5.0/theme.json +4 -0
  97. package/vendor/themes/default/1.5.0/tokens.css +95 -0
  98. package/vendor/themes/kogecha/1.3.0/theme.json +10 -0
  99. package/vendor/themes/kogecha/1.3.0/tokens.css +35 -0
  100. package/vendor/themes/kokugo/1.3.0/theme.json +5 -0
  101. package/vendor/themes/kokugo/1.3.0/tokens.css +31 -0
  102. package/vendor/themes/murasaki/1.3.0/theme.json +10 -0
  103. package/vendor/themes/murasaki/1.3.0/tokens.css +31 -0
  104. package/vendor/themes/sumi/1.3.0/theme.json +10 -0
  105. package/vendor/themes/sumi/1.3.0/tokens.css +57 -0
  106. package/vendor/themes/tokiwa/1.3.0/theme.json +10 -0
  107. package/vendor/themes/tokiwa/1.3.0/tokens.css +33 -0
@@ -184,6 +184,8 @@ export const MESSAGES = {
184
184
  // ---------------------------------------------------------------- 体裁(はみ出し・字数・表記)
185
185
  kickerLong: { rule: 'R-headings', ja: (a) => `肩見出しが長い(${a.n} ${a.latin ? '文字' : '字分'}。${a.latin ? 'ラテン文字は 40 文字まで' : '24 字分まで。全角 1・半角 0.5'}):${quoteJa(a.t)}を短くする`, en: (a) => `the kicker has ${a.n} ${a.latin ? 'characters' : 'units'}, over ${a.max} (${a.latin ? 'Latin script' : 'full-width 1, ASCII 0.5'}): shorten “${a.t}”` },
186
186
  kickerPlace: { rule: 'R-headings', ja: () => '肩見出し(.kicker)はスライドに 1 つだけ、見出しの直前に置く', en: () => 'place just one kicker (.kicker) per slide, immediately before the heading' },
187
+ cautionEmpty: { rule: 'R-caution', ja: () => '注意・警告の枠(.caution)にラベル以外の本文を書く', en: () => 'write body text besides the label in the caution or warning box (.caution)' },
188
+ cautionLabel: { rule: 'R-caution', ja: () => '注意・警告のラベルは組み立てが付けるので、枠の先頭に書いたラベルを消す', en: () => 'remove the label written at the start of the caution or warning box; the build adds it' },
187
189
  kickerSlide: { rule: 'R-headings', ja: () => '表紙・章の扉・縦書きのスライド(layout-tate)には肩見出し(.kicker)を置かない', en: () => 'do not use a kicker (.kicker) on a cover, chapter divider or vertical slide (layout-tate)' },
188
190
  titleLong: { rule: 'R-title', ja: (a) => `見出しが ${a.n} 字で長い(26 字まで。全角 1・半角 0.5):${quoteJa(a.t)}を短くするか、要点を結論の行に移す`, en: (a) => `the heading has ${a.n} units, over 26 (full-width 1, ASCII 0.5): shorten “${a.t}” or move the point to the conclusion line` },
189
191
  titleLongEn: { rule: 'R-title', ja: (a) => `見出しが ${a.n} 文字で長い(英文は 60 文字まで):${quoteJa(a.t)}を短くする`, en: (a) => `the heading has ${a.n} characters, over 60: shorten “${a.t}”` },
package/kit/check.mjs CHANGED
@@ -62,6 +62,7 @@ import { placeholderSteps, templateTextIn } from './core/template-text.mjs';
62
62
  import { legacyVocabulary } from './core/legacy-vocab.mjs';
63
63
  import { colorsOutsideVocabulary } from './core/color-vocab.mjs';
64
64
  import { kickerFindings } from './core/kicker.mjs';
65
+ import { cautionFindings } from './core/caution.mjs';
65
66
  import { predictStepProblems } from './core/predict-steps.mjs';
66
67
  import { FONTS_EXTRA_WARN, FONTS_EXTRA_PKG, FONTS_EXTRA_INSTALL } from './core/build-core.mjs';
67
68
  import { uncoveredGlyphs } from './core/font-coverage.mjs';
@@ -190,6 +191,7 @@ if (extraMissing.length) report(null, 'error', 'fontsExtraMissing', { fonts: ext
190
191
  for (const { code, slide, ...x } of predictStepProblems(readRegular(src, { max: READ_LIMITS.source }).toString('utf8'))) report(slide, 'warn', code, x);
191
192
  // 肩見出し:置き場所・字数・使えない種類のスライド(編集アプリも同じ関数)
192
193
  for (const f of kickerFindings(readRegular(src, { max: READ_LIMITS.source }).toString('utf8'))) report(f.i, f.sev, f.code, f.a);
194
+ for (const f of cautionFindings(readRegular(src, { max: READ_LIMITS.source }).toString('utf8'))) report(f.i, f.sev, f.code, f.a);
193
195
  // {#id} で指したスライドの見出しと、narration.md の見出しの文字列が違う(id が勝つので、知らせるだけ)
194
196
  const byKey = new Map(built.slides.map((s, i) => [s.key, { ...s, i }]));
195
197
  for (const sec of built.segs.sections || []) {
@@ -8,7 +8,7 @@
8
8
  // both・unconfirmed(記録がない)。編集アプリは「スライドと本が合っていないかもしれません」と出す。どちらの字も自動では直さない(§9C.7)
9
9
  // 組み立て(1 ファイルへの書き出し)は、もうつながっていない組の記録を外す。記録を足すのは npm run ids(つないだ組)と、確かめたとき
10
10
  // 編集アプリと共有する(node: の読み込み・fs を使わない。hash は crypto.subtle)。
11
- import { visit } from './article-text.mjs';
11
+ import { articleContent, visit } from './article-text.mjs';
12
12
  import { parseStep } from './article.mjs';
13
13
  import { parseHeading } from './narration-parse.mjs';
14
14
 
@@ -22,10 +22,10 @@ const norm = (s) => String(s).normalize('NFC').replace(/\r\n?/g, '\n').trim();
22
22
  export function linkedPairs(article, dataArticle = []) {
23
23
  const sections = new Set(), out = [], seen = new Set();
24
24
  const add = (slide, section) => { const k = `${slide}\u0000${section}`; if (!seen.has(k)) { seen.add(k); out.push({ slide, section }); } };
25
- for (const f of article.files) for (const top of f.tree.children || []) if (top.type === 'heading' && top.depth === 2 && top.label) sections.add(String(top.label));
25
+ for (const f of article.files) for (const { node: top } of articleContent(f.tree, f.kind)) if (top.type === 'heading' && top.depth === 2 && top.label) sections.add(String(top.label));
26
26
  for (const f of article.files) {
27
27
  let section = null;
28
- for (const top of f.tree.children || []) {
28
+ for (const { node: top } of articleContent(f.tree, f.kind)) {
29
29
  if (top.type === 'heading' && top.depth === 2) section = top.label ? String(top.label) : null;
30
30
  if (!section) continue;
31
31
  visit(top, (n) => { if (n.type === 'mystRole' && n.name === 'step') { const s = parseStep(n.value); if (s) add(s.slideKey, section); } });
@@ -41,13 +41,14 @@ export function sectionSources(article) {
41
41
  for (const f of article.files) {
42
42
  const lines = String(f.source || '').replace(/^/, '').split(/\r?\n/);
43
43
  const off = f.lineOffset || 0;
44
- const heads = (f.tree.children || []).filter((n) => n.type === 'heading' && n.position);
44
+ const heads = articleContent(f.tree, f.kind).map(({ node }) => node).filter((n) => n.type === 'heading' && n.position);
45
45
  heads.forEach((h, j) => {
46
46
  if (h.depth !== 2 || !h.label) return;
47
47
  const start = h.position.start.line + off; // 1 から
48
48
  const next = heads.slice(j + 1).find((x) => x.depth <= h.depth);
49
49
  let end = next ? next.position.start.line + off - 1 : lines.length; // 含まない(1 から数えた行の番号のひとつ前まで)
50
50
  if (next && next.label && end > start && /^\s*\([^()\s]+\)=\s*$/.test(lines[end - 1])) end--;
51
+ if (next && /^\+\+\+\s/.test(lines[end - 1] || '')) end--;
51
52
  out[String(h.label)] = norm(lines.slice(start - 1, end).join('\n'));
52
53
  });
53
54
  }
@@ -37,7 +37,7 @@ export const ARTICLE_MESSAGES = {
37
37
  articleHtmlTable: { ja: (a) => `HTML の表が決まりに合わない:${a.why}(使えるのは table・thead・tbody・tr・th・td、属性 colspan・rowspan・align、セルの中は字と em・strong・code・sub・sup・br だけ。空行・数式・Markdown は書けない)`, en: (a) => `the HTML table breaks the rules: ${a.why} (only table, thead, tbody, tr, th, td; attributes colspan, rowspan, align; cells hold text and em, strong, code, sub, sup, br; no blank lines, math or Markdown)` },
38
38
  articleHtmlTableNoSpan: { ja: () => 'HTML の表にセルをつなぐところ(colspan・rowspan)がない:パイプの表(| 見出し | … |)で書く', en: () => 'the HTML table merges no cells (no colspan or rowspan): write it as a pipe table (| header | … |)' },
39
39
  articleComment: { ja: (a) => `「%」で始まる行(${a.text})は MyST では消える:字として書くなら \\% と書く`, en: (a) => `a line starting with % (${a.text}) is a MyST comment and disappears: write \\% for the character` },
40
- articleBlockBreak: { ja: () => '「+++」(区切り)は書けない:外すか、--- (横線)にする', en: () => 'a block break (+++) is not allowed: remove it or use --- (a thematic break)' },
40
+ articleBlockBreak: { ja: () => '「+++」(区切り)は節の kind の行だけに使える:外すか、--- (横線)にする', en: () => 'a block break (+++) is allowed only for a section kind line: remove it or use --- (a thematic break)' },
41
41
  articleSubstitution: { ja: (a) => `置き換え「${a.text}」は書けない:字をそのまま書く`, en: (a) => `the substitution “${a.text}” is not allowed: write the text itself` },
42
42
  articleStrike: { ja: (a) => `取り消し線「${a.text}」は書けない`, en: (a) => `strikethrough “${a.text}” is not allowed` },
43
43
  articleBareUrl: { ja: (a) => `URL「${a.url}」がリンクになっていない:<${a.url}> か [字](${a.url}) と書く`, en: (a) => `the URL ${a.url} is not a link: write <${a.url}> or [text](${a.url})` },
@@ -80,6 +80,11 @@ export const ARTICLE_MESSAGES = {
80
80
  articleChapterNumber: { ja: () => '章のファイルに chapter(章の番号)がない:前付けに chapter: 番号 を書く', en: () => 'a chapter file has no chapter number: add chapter: <n> to its front matter' },
81
81
  articleChapterTitle: { ja: () => '章のファイルに title(章の題)がない:前付けに title: 題 を書く', en: () => 'a chapter file has no title: add title: <title> to its front matter' },
82
82
  articleChapterIncrease: { ja: (a) => `章の番号 ${a.chapter} が前の章(${a.before})より大きくない:読む順(ファイルの名前の順)に大きくする`, en: (a) => `chapter ${a.chapter} does not follow chapter ${a.before}: numbers must increase in reading order (file name order)` },
83
+ articleSectionKindValue: { ja: (a) => `節の kind「${a.kind}」は使えない:preface・chapter・appendix・afterword のどれかにする`, en: (a) => `section kind “${a.kind}” is not allowed: use preface, chapter, appendix or afterword` },
84
+ articleSectionKindMember: { ja: () => '節の kind の JSON には kind だけを書く', en: () => 'the section kind JSON must contain only the kind member' },
85
+ articleSectionKindPosition: { ja: () => '節の kind の行はレベル 2 の節の target 行(id がなければ見出し)の直前に書く', en: () => "put the section kind line directly before a level-2 section's target line (or its heading if it has no id)" },
86
+ articleSectionKindOrder: { ja: () => '節の種類の順が違う:前書き・章・付録・後書きの順にする', en: () => 'section kinds are out of order: use prefaces, chapters, appendices, then afterwords' },
87
+ articleSectionKindContext: { ja: () => '節の kind の行は 1 ファイルの本文(article.path)で、ファイルの kind が chapter のときだけ書ける', en: () => 'a section kind line is allowed only in a one-file article (article.path) whose file kind is chapter' },
83
88
  articleChapterOrder: { ja: (a) => `kind: ${a.kind} のファイルの順が違う:前書き・章・付録・後書きの順にファイルの名前を付ける`, en: (a) => `the kind: ${a.kind} file is out of order: name the files so that prefaces, chapters, appendices and afterwords come in that order` },
84
89
  articleChapterDiffer: { ja: (a) => `章のファイルで ${a.member} が違う(${a.values.join('・')}):すべての章で同じにする`, en: (a) => `${a.member} differs between chapter files (${a.values.join(', ')}): use the same value in every chapter` },
85
90
  articleLang: { ja: (a) => `前付けの lang(${a.lang})が教材の言語(${a.deck})と違う:同じにするか、lang を外す`, en: (a) => `front matter lang (${a.lang}) differs from the lesson language (${a.deck}): make them equal or remove lang` },
@@ -2,8 +2,8 @@
2
2
  // 原稿の HTML は通さない(表も木から書く)。script・イベントの属性・埋め込みの要素は書かない。リンクは http(s)・mailto と # だけ。
3
3
  // 引用(§9C.4)は opts.csl(citeproc と同梱の書式)があれば CSL で組み、文献の一覧を書く(kit/core/article-cite.mjs)。なければ鍵の字のまま。
4
4
  // 編集アプリと共有する(node: の読み込み・fs を使わない。KaTeX と画像は opts で渡す)。
5
- import { visit, plain } from './article-text.mjs';
6
- import { parseStep } from './article.mjs';
5
+ import { visit, plain, articleContent } from './article-text.mjs';
6
+ import { parseStep, letterOf } from './article.mjs';
7
7
  import { renderCitations } from './article-cite.mjs';
8
8
  import { quoteJa } from './quote-ja.mjs';
9
9
 
@@ -40,8 +40,10 @@ export function numberArticle(article, lang) {
40
40
  const prefix = f.kind === 'chapter' && f.chapter ? String(f.chapter) : f.kind === 'appendix' ? f.letter || '' : '';
41
41
  // 前書き・後書きは節の番号なし(§9C.1A)。numbering: false も節の番号だけを切る
42
42
  const numbered = f.fm.numbering !== false && f.kind !== 'preface' && f.kind !== 'afterword';
43
- const pre = (n) => (prefix ? `${prefix}.${n}` : String(n));
44
- const counters = new Map();
43
+ let activePrefix = prefix, sectionKind = f.kind, appendix = -1;
44
+ const pre = (n) => (activePrefix ? `${activePrefix}.${n}` : String(n));
45
+ const fileCounters = new Map();
46
+ let counters = fileCounters;
45
47
  const next = (k) => { const n = (counters.get(k) || 0) + 1; counters.set(k, n); return pre(n); };
46
48
  const sec = [0, 0, 0];
47
49
  // 章の印(§9C.6):章の番号・付録の記号、前書き・後書きは preface<i>・afterword<i>(i はその種類の中で 1 から)。章ごとの id と属性はすべてこれを使う
@@ -50,43 +52,60 @@ export function numberArticle(article, lang) {
50
52
  const fileInfo = { prefix, numbered, kind: f.kind, chapterAttr: token, fnPrefix: book ? token : '', nodes: new Map() };
51
53
  files.push(fileInfo);
52
54
  const set = (n, info) => { fileInfo.nodes.set(n, info); if (n.label) targets.set(String(n.label).toLowerCase(), { ...info, file: f.path }); };
53
- visit(f.tree, (n, parents) => {
54
- if (n.type === 'heading' && n.depth >= 2 && n.depth <= 4) {
55
- const d = n.depth - 2;
56
- sec[d]++; for (let j = d + 1; j < 3; j++) sec[j] = 0;
57
- const num = numbered ? (prefix ? [prefix, ...sec.slice(0, d + 1)] : sec.slice(0, d + 1)).join('.') : null;
58
- set(n, { kind: 'section', num, text: num ? W.section(num) : plain(n), title: plain(n) });
59
- } else if (n.type === 'container' && n.kind === 'figure' && !n.subcontainer) {
60
- const num = next('figure'); // 名前がなくても番号を付ける(mystmd と同じ。§9C.1A)
61
- set(n, { kind: 'figure', num, text: num ? `${W.figure}${W.sp}${num}` : null });
62
- let sub = 0;
63
- for (const c of n.children || []) if (c.type === 'container' && c.subcontainer) {
64
- const letter = `(${String.fromCharCode(97 + sub++)})`;
65
- set(c, { kind: 'subfigure', num: letter, text: num ? `${W.figure}${W.sp}${num}${letter}` : letter });
55
+ for (const { node, kind } of articleContent(f.tree, f.kind)) {
56
+ sectionKind = kind;
57
+ if (node.type === 'heading' && node.depth === 2) {
58
+ if (kind === 'appendix' && f.kind === 'chapter') {
59
+ activePrefix = letterOf(++appendix);
60
+ counters = new Map();
61
+ sec.fill(0);
62
+ } else {
63
+ activePrefix = kind === 'preface' || kind === 'afterword' ? '' : prefix;
64
+ counters = fileCounters;
66
65
  }
67
- } else if (n.type === 'container' && n.kind === 'table') {
68
- const num = next('table'); // 名前がなくても番号を付ける(mystmd と同じ。§9C.1A)
69
- set(n, { kind: 'table', num, text: num ? `${W.table}${W.sp}${num}` : null });
70
- } else if (n.type === 'aside') {
71
- const num = next('aside'); // 名前がなくても番号を付ける(mystmd と同じ。§9C.1A)
72
- set(n, { kind: 'aside', num, text: num ? `${W.aside}${W.sp}${num}` : null, title: titleOf(n) });
73
- } else if (n.type === 'exercise') {
74
- const num = n.enumerated === false ? null : next('exercise');
75
- set(n, { kind: 'exercise', num, text: num ? `${W.exercise}${W.sp}${num}` : W.exercise, title: titleOf(n) });
76
- } else if (n.type === 'proof') {
77
- const word = W.kinds[n.kind] || n.kind;
78
- const num = n.kind === 'proof' ? null : next('proof:' + n.kind);
79
- set(n, { kind: 'proof', proofKind: n.kind, num, text: num ? `${word}${W.sp}${num}` : word, title: titleOf(n) });
80
- } else if (n.type === 'math' && n.label) {
81
- const num = next('equation');
82
- set(n, { kind: 'equation', num, text: W.eq(num) });
83
- } else if (n.type === 'solution') {
84
- set(n, { kind: 'solution', num: null, text: null });
85
- } else if (n.type === 'glossary') {
86
- visit(n, (d) => { if (d.type === 'definitionTerm') { const term = plain(d).trim(); if (!terms.has(term)) terms.set(term, `term-${++termN}`); } });
87
66
  }
88
- void parents;
89
- });
67
+ visit(node, (n, parents) => {
68
+ if (n.type === 'heading' && n.depth >= 2 && n.depth <= 4) {
69
+ const d = n.depth - 2;
70
+ const sectionNumbered = f.fm.numbering !== false && sectionKind !== 'preface' && sectionKind !== 'afterword';
71
+ const appendixSection = sectionKind === 'appendix' && f.kind === 'chapter';
72
+ if (sectionNumbered) { sec[d]++; for (let j = d + 1; j < 3; j++) sec[j] = 0; }
73
+ const parts = appendixSection ? [activePrefix, ...sec.slice(1, d + 1)] : (prefix ? [prefix, ...sec.slice(0, d + 1)] : sec.slice(0, d + 1));
74
+ const num = sectionNumbered ? parts.join('.') : null;
75
+ const headingNum = appendixSection && d === 0 && num ? W.appendix(num) : num;
76
+ set(n, { kind: 'section', sectionKind, num, headingNum, text: num ? (appendixSection && d === 0 ? W.appendix(num) : W.section(num)) : plain(n), title: plain(n) });
77
+ } else if (n.type === 'container' && n.kind === 'figure' && !n.subcontainer) {
78
+ const num = next('figure'); // 名前がなくても番号を付ける(mystmd と同じ。§9C.1A)
79
+ set(n, { kind: 'figure', num, text: num ? `${W.figure}${W.sp}${num}` : null });
80
+ let sub = 0;
81
+ for (const c of n.children || []) if (c.type === 'container' && c.subcontainer) {
82
+ const letter = `(${String.fromCharCode(97 + sub++)})`;
83
+ set(c, { kind: 'subfigure', num: letter, text: num ? `${W.figure}${W.sp}${num}${letter}` : letter });
84
+ }
85
+ } else if (n.type === 'container' && n.kind === 'table') {
86
+ const num = next('table'); // 名前がなくても番号を付ける(mystmd と同じ。§9C.1A)
87
+ set(n, { kind: 'table', num, text: num ? `${W.table}${W.sp}${num}` : null });
88
+ } else if (n.type === 'aside') {
89
+ const num = next('aside'); // 名前がなくても番号を付ける(mystmd と同じ。§9C.1A)
90
+ set(n, { kind: 'aside', num, text: num ? `${W.aside}${W.sp}${num}` : null, title: titleOf(n) });
91
+ } else if (n.type === 'exercise') {
92
+ const num = n.enumerated === false ? null : next('exercise');
93
+ set(n, { kind: 'exercise', num, text: num ? `${W.exercise}${W.sp}${num}` : W.exercise, title: titleOf(n) });
94
+ } else if (n.type === 'proof') {
95
+ const word = W.kinds[n.kind] || n.kind;
96
+ const num = n.kind === 'proof' ? null : next('proof:' + n.kind);
97
+ set(n, { kind: 'proof', proofKind: n.kind, num, text: num ? `${word}${W.sp}${num}` : word, title: titleOf(n) });
98
+ } else if (n.type === 'math' && n.label) {
99
+ const num = next('equation');
100
+ set(n, { kind: 'equation', num, text: W.eq(num) });
101
+ } else if (n.type === 'solution') {
102
+ set(n, { kind: 'solution', num: null, text: null });
103
+ } else if (n.type === 'glossary') {
104
+ visit(n, (d) => { if (d.type === 'definitionTerm') { const term = plain(d).trim(); if (!terms.has(term)) terms.set(term, `term-${++termN}`); } });
105
+ }
106
+ void parents;
107
+ });
108
+ }
90
109
  // 章の見出し(§9C.6)
91
110
  const title = f.fm.title || (book ? '' : article.title || '');
92
111
  const head = f.kind === 'chapter' && f.chapter ? W.chapter(f.chapter) : f.kind === 'appendix' && f.letter ? W.appendix(f.letter) : '';
@@ -136,7 +155,7 @@ export function renderArticle(article, opts = {}) {
136
155
  const fnId = (n) => (info.fnPrefix ? `fn-${info.fnPrefix}-${n}` : `fn-${n}`);
137
156
  const fnSeen = new Set();
138
157
  let pendingNotes = [];
139
- const children = f.tree.children || [];
158
+ const children = articleContent(f.tree, f.kind).map(({ node }) => node);
140
159
  const exerciseBefore = new Set();
141
160
  children.forEach((c, i) => { if (c.type === 'solution' && i > 0 && children[i - 1].type === 'exercise') exerciseBefore.add(c); });
142
161
 
@@ -184,7 +203,7 @@ export function renderArticle(article, opts = {}) {
184
203
  case 'heading': {
185
204
  const x = num(n);
186
205
  const id = n.label ? ` id="${esc(n.label)}"` : '';
187
- return `<h${n.depth}${n.depth === 2 ? '' : id}>${x.num ? `<span class="egatari-num">${text(x.num)}</span> ` : ''}${inline(n.children)}</h${n.depth}>`;
206
+ return `<h${n.depth}${n.depth === 2 ? '' : id}>${x.num ? `<span class="egatari-num">${text(x.headingNum || x.num)}</span> ` : ''}${inline(n.children)}</h${n.depth}>`;
188
207
  }
189
208
  case 'blockquote': return `<blockquote>${block(n.children)}</blockquote>`;
190
209
  case 'thematicBreak': return '<hr>';
@@ -352,7 +371,7 @@ export function renderArticle(article, opts = {}) {
352
371
  if (notes) parts.push(notes);
353
372
  if (open) parts.push('</section>');
354
373
  const id = c.label ? esc(c.label) : '';
355
- parts.push(`<section${id ? ` id="${id}" data-section-id="${id}"` : ''}>`);
374
+ parts.push(`<section${id ? ` id="${id}" data-section-id="${id}"` : ''} data-section-kind="${esc(num(c).sectionKind || f.kind)}">`);
356
375
  open = true;
357
376
  }
358
377
  const h = node(c);
@@ -251,7 +251,7 @@ export function parseArticleText(src, opts = {}) {
251
251
  else if (t === 'mystRole') rawRole(node);
252
252
  else if (t === 'html' && !parents.some((p) => p.__htmlTable === node)) add('error', 'articleHtml', '§9C.2', node, { html: String(node.value).trim().slice(0, 60), hint: htmlHint(node.value) });
253
253
  else if (t === 'comment') add('error', 'articleComment', '§9C.2', node, { text: String(node.value).slice(0, 60) });
254
- else if (t === 'block' || t === 'blockBreak') add('error', 'articleBlockBreak', '§9C.2', node);
254
+ else if (t === 'block' || t === 'blockBreak') rawSectionKind(node, parents);
255
255
  else if (t === 'heading' && (node.depth < 2 || node.depth > 4)) add('error', 'articleHeadingLevel', '§9C.2', node, { depth: node.depth });
256
256
  else if (t === 'listItem' && typeof node.checked === 'boolean') add('error', 'articleTaskList', '§9C.2', node);
257
257
  else if (t === 'text' && !parents.some((p) => p.type === 'link' || p.type === 'crossReference')) rawText(node);
@@ -263,6 +263,25 @@ export function parseArticleText(src, opts = {}) {
263
263
  }
264
264
  for (const c of node.children || []) rawWalk(c, [...parents, node]);
265
265
  };
266
+ function rawSectionKind(node, parents) {
267
+ let meta;
268
+ try { meta = JSON.parse(node.meta); } catch { /* not a section kind line */ }
269
+ if (!meta || typeof meta !== 'object' || Array.isArray(meta) || !Object.hasOwn(meta, 'kind')) {
270
+ add('error', 'articleBlockBreak', '§9C.2', node);
271
+ return;
272
+ }
273
+ if (Object.keys(meta).length !== 1) add('error', 'articleSectionKindMember', '§9C.1A', node);
274
+ if (!KINDS.includes(meta.kind)) add('error', 'articleSectionKindValue', '§9C.1A', node, { kind: String(meta.kind) });
275
+ if (opts.chapterFile || (front.fm.kind && front.fm.kind !== 'chapter')) add('error', 'articleSectionKindContext', '§9C.1A', node);
276
+ const [first, second] = node.children || [];
277
+ const target = first?.type === 'mystTarget';
278
+ const heading = target ? second : first;
279
+ const line = node.position?.start.line;
280
+ if (parents.length !== 1 || parents[0].type !== 'root' || heading?.type !== 'heading' || heading.depth !== 2
281
+ || first.position?.start.line !== line + 1 || (target && heading.position?.start.line !== line + 2)) {
282
+ add('error', 'articleSectionKindPosition', '§9C.1A', node);
283
+ }
284
+ }
266
285
  const srcLine = (node) => (node.position ? lines[node.position.start.line - 1] || '' : '');
267
286
  function rawDirective(node, parents) {
268
287
  const name = node.name;
@@ -408,6 +427,13 @@ export function parseArticleText(src, opts = {}) {
408
427
  return null;
409
428
  }
410
429
  rawWalk(tree, []);
430
+ let lastKind = -1;
431
+ for (const { node, kind } of articleContent(tree, front.fm.kind || 'chapter')) {
432
+ if (node.type !== 'heading' || node.depth !== 2) continue;
433
+ const order = KINDS.indexOf(kind);
434
+ if (order < lastKind) add('error', 'articleSectionKindOrder', '§9C.1A', node, { kind });
435
+ lastKind = Math.max(lastKind, order);
436
+ }
411
437
 
412
438
  // ---- 構造の変換(仕様の fixtures と同じ 6 つ、同じ順)
413
439
  liftMystDirectivesAndRolesTransform(tree);
@@ -501,6 +527,21 @@ export function parseArticleText(src, opts = {}) {
501
527
  return { fm: front.fm, tree, problems, conversions, lineOffset: off };
502
528
  }
503
529
 
530
+ // The parser keeps kind spans as blocks. Consumers share this flat view without changing the fixture tree.
531
+ export function articleContent(tree, fileKind = 'chapter') {
532
+ const out = [];
533
+ let kind = fileKind;
534
+ for (const node of tree.children || []) {
535
+ if (node.type === 'block') {
536
+ let meta;
537
+ try { meta = JSON.parse(node.meta); } catch { /* invalid blocks are reported by the parser */ }
538
+ if (meta && KINDS.includes(meta.kind)) kind = meta.kind;
539
+ for (const child of node.children || []) out.push({ node: child, kind });
540
+ } else out.push({ node, kind });
541
+ }
542
+ return out;
543
+ }
544
+
504
545
  // 試験の比べ方(仕様の tools/test-fixtures.mjs と同じ):position・key・html_id を外した木
505
546
  export function fixtureTree(tree) {
506
547
  const DROP = new Set(['position', 'key', 'html_id']);
@@ -2,7 +2,7 @@
2
2
  // ファイルをまたぐ決まり(章の番号・種類の順・lang・writing-mode・bibliography)と、文書全体の点検(§9C.8:名前の重なり・相互参照・
3
3
  // 解答の問・用語・ステップへのリンク・引用の鍵・画像・スライドの data-article)を行う。番号と HTML は kit/core/article-render.mjs。
4
4
  // 編集アプリと共有する(node: の読み込み・fs を使わない。読むのは渡された read・exists を通す)。
5
- import { parseArticleText, visit, plain, ARTICLE_LIMITS, CITE_KEY_RE } from './article-text.mjs';
5
+ import { parseArticleText, articleContent, visit, plain, ARTICLE_LIMITS, CITE_KEY_RE } from './article-text.mjs';
6
6
  import { citationSettings } from './article-cite.mjs';
7
7
 
8
8
  export const ARTICLE_FILE = 'article.md';
@@ -57,7 +57,7 @@ export function readArticle(index, read, opts = {}) {
57
57
  let text;
58
58
  try { text = read(p); } catch (e) { problems.push(D('error', 'articleRead', '§9C.1', p, null, { why: String(e && e.message || e).slice(0, 120) })); continue; }
59
59
  if (text.length > ARTICLE_LIMITS.fileBytes) { problems.push(D('error', 'articleTooLarge', '§9C.1', p, null, { bytes: text.length, max: ARTICLE_LIMITS.fileBytes })); continue; }
60
- const r = parseArticleText(text, { convert: !!opts.convert });
60
+ const r = parseArticleText(text, { convert: !!opts.convert, chapterFile: !!index.chapters });
61
61
  const kind = r.fm.kind || 'chapter';
62
62
  files.push({ path: p, source: text, lineOffset: r.lineOffset, fm: r.fm, tree: r.tree, kind, chapter: kind === 'chapter' ? r.fm.chapter ?? null : null, letter: null, conversions: r.conversions });
63
63
  for (const x of r.problems) problems.push({ ...x, file: p });
@@ -122,6 +122,7 @@ export function validateArticle(article, ctx = {}) {
122
122
  const others = new Set([...(ctx.slideIds || []), ...(ctx.otherIds || [])].map((x) => String(x).toLowerCase()));
123
123
  // 1 回目:名前・節・問・用語集
124
124
  for (const f of article.files) {
125
+ const sectionKinds = new Map(articleContent(f.tree, f.kind).map(({ node, kind }) => [node, kind]));
125
126
  visit(f.tree, (n) => {
126
127
  if (n.label && ['heading', 'math', 'container', 'aside', 'proof', 'exercise', 'solution'].includes(n.type) && !(n.type === 'exercise' && n.hidden)) {
127
128
  const k = String(n.label).toLowerCase();
@@ -129,7 +130,7 @@ export function validateArticle(article, ctx = {}) {
129
130
  if (labels.has(k)) { const o = labels.get(k); problems.push(D('error', 'articleLabelDuplicate', '§9C.3', f.path, at.line, { label: at.label, other: o.file, otherLine: o.line })); }
130
131
  else labels.set(k, at);
131
132
  if (others.has(k)) problems.push(D('error', 'articleLabelSlideId', '§9C.3', f.path, at.line, { label: at.label }));
132
- if (n.type === 'heading' && n.depth === 2) sections.set(String(n.label), { file: f.path, line: at.line, heading: plain(n), kind: f.kind });
133
+ if (n.type === 'heading' && n.depth === 2) sections.set(String(n.label), { file: f.path, line: at.line, heading: plain(n), kind: sectionKinds.get(n) || f.kind });
133
134
  if (n.type === 'exercise') exercises.add(k);
134
135
  }
135
136
  if (n.type === 'glossary') {
@@ -144,7 +145,7 @@ export function validateArticle(article, ctx = {}) {
144
145
  const cited = new Set();
145
146
  for (const f of article.files) {
146
147
  let section = null;
147
- for (const top of f.tree.children || []) {
148
+ for (const { node: top } of articleContent(f.tree, f.kind)) {
148
149
  if (top.type === 'heading' && top.depth === 2) section = top.label ? String(top.label) : null;
149
150
  visit(top, (n, parents) => {
150
151
  const line = lineOf(f, n);
@@ -192,7 +193,7 @@ export function validateArticle(article, ctx = {}) {
192
193
  else linkedSections.add(id);
193
194
  }
194
195
  // どのスライドにもつながらない節(§9C.8 の SHOULD。スライドがあるときだけ)
195
- // kind: chapter のファイルの節だけ(前書き・付録・後書きはスライドを持たないのが普通。§9C.8)
196
+ // ファイルと節の kind が chapter の節だけ(前書き・付録・後書きはスライドを持たないのが普通。§9C.8)
196
197
  if (ctx.slideIds && ctx.slideIds.size) for (const [id, s] of sections) if (s.kind === 'chapter' && !linkedSections.has(id)) problems.push(D('warn', 'articleSectionUnlinked', '§9C.8', s.file, s.line, { section: id, heading: s.heading.slice(0, 40) }));
197
198
  return { problems, labels, sections };
198
199
  }
@@ -253,7 +254,7 @@ export function assignSectionIds(text, taken = new Set(), rand = (n) => globalTh
253
254
  visit(r.tree, (n) => { if (n.label) used.add(String(n.label).toLowerCase()); });
254
255
  const lines = text.split(/\r?\n/);
255
256
  const added = [];
256
- for (const n of r.tree.children || []) {
257
+ for (const { node: n } of articleContent(r.tree)) {
257
258
  if (n.type !== 'heading' || n.depth !== 2 || n.label || !n.position) continue;
258
259
  let id;
259
260
  for (let k = 0; k < 1000 && (!id || used.has(id)); k++) id = 'sec-' + [...rand(6)].map((b) => B32[b & 31]).join('');
@@ -19,6 +19,7 @@
19
19
  // env.compressAudio(file) 任意。埋め込む音声を小さくしたファイル(できなければ元のまま)。env.audioFailed() で失敗を知る
20
20
  // 書式・記法は kit/build.mjs の頭の注釈、約束事は docs/contract.md
21
21
  import { parse } from 'parse5';
22
+ import { insertCautionLabels } from './caution.mjs';
22
23
  import { short } from './sha1.mjs';
23
24
  import { plural } from './plural.mjs';
24
25
  import { innerJa } from './quote-ja.mjs';
@@ -918,6 +919,9 @@ export function build(env0, srcPath, opts = {}) {
918
919
  });
919
920
  }
920
921
 
922
+ // Labels precede font subsetting so Japanese labels are included in the embedded fonts.
923
+ html = insertCautionLabels(html);
924
+
921
925
  // 数式
922
926
  // 式の一部に色を付けるマクロ(テーマの変数に従う):\hlE{…} 結論・問題、\hlT{…} 用語、\hlM{…} 既知の結果
923
927
  let macros = { '\\hlE': '\\htmlClass{emph}{#1}', '\\hlT': '\\htmlClass{term}{#1}', '\\hlM': '\\htmlClass{muted}{#1}' };
@@ -0,0 +1,49 @@
1
+ // Caution boxes: source-only checks shared by the CLI and editor, and idempotent build markup.
2
+ import { parse } from 'parse5';
3
+
4
+ const hasClass = (n, c) => (n.attrs || []).some((a) => a.name === 'class' && a.value.split(/\s+/).includes(c));
5
+ const textOf = (n) => n.nodeName === '#text' ? n.value : ['script', 'style', 'rt'].includes(n.tagName) ? '' : (n.childNodes || []).map(textOf).join('');
6
+ const labelStart = /^\s*(?:注意|警告|Caution\b|Warning\b)\s*[::]?\s*/i;
7
+ const stateOf = (n) => {
8
+ const label = (n.childNodes || []).find((c) => c.tagName && hasClass(c, 'caution-label'));
9
+ const text = (n.childNodes || []).filter((c) => c !== label).map(textOf).join('').trim();
10
+ return { labelled: !!label, authored: labelStart.test(text), empty: !text.replace(labelStart, '').trim() };
11
+ };
12
+ function walk(n, visit, slide = null, counter = { n: 0 }) {
13
+ if (n.tagName === 'section' && hasClass(n, 'slide')) slide = counter.n++;
14
+ if (n.tagName && hasClass(n, 'caution')) visit(n, slide);
15
+ // Templates and scripts contain examples, not rendered boxes.
16
+ for (const c of n.childNodes || []) walk(c, visit, slide, counter);
17
+ }
18
+
19
+ export function cautionFindings(src) {
20
+ const out = [];
21
+ walk(parse(String(src)), (n, i) => {
22
+ if (i === null) return;
23
+ const s = stateOf(n);
24
+ if (s.empty) out.push({ i, sev: 'error', code: 'cautionEmpty', a: {} });
25
+ if (s.authored) out.push({ i, sev: 'warn', code: 'cautionLabel', a: {} });
26
+ });
27
+ return out;
28
+ }
29
+
30
+ export function insertCautionLabels(src) {
31
+ const doc = parse(src, { sourceCodeLocationInfo: true }), edits = [];
32
+ const html = doc.childNodes.find((n) => n.tagName === 'html');
33
+ const en = /^en\b/i.test((html?.attrs || []).find((a) => a.name === 'lang')?.value || '');
34
+ walk(doc, (n) => {
35
+ const loc = n.sourceCodeLocation;
36
+ if (!loc?.startTag) return;
37
+ const s = stateOf(n);
38
+ if (!s.labelled && !s.authored) {
39
+ const label = hasClass(n, 'warn') ? (en ? 'Warning' : '警告') : (en ? 'Caution' : '注意');
40
+ edits.push({ start: loc.startTag.endOffset, end: loc.startTag.endOffset, text: `<span class="caution-label">${label}</span>` });
41
+ }
42
+ const role = loc.attrs?.role;
43
+ edits.push(role ? { start: role.startOffset, end: role.endOffset, text: 'role="note"' }
44
+ : { start: loc.startTag.endOffset - 1, end: loc.startTag.endOffset - 1, text: ' role="note"' });
45
+ });
46
+ // Preserve the author's bytes, as with the other build annotations.
47
+ for (const e of edits.sort((a, b) => b.start - a.start)) src = src.slice(0, e.start) + e.text + src.slice(e.end);
48
+ return src;
49
+ }
@@ -12,6 +12,7 @@ export const IN_EDITOR = Object.freeze([
12
12
  // 原稿の文字列から(kit/core/check-source.mjs)
13
13
  'slideId', 'legacyDataKey', 'legacyIndex', 'legacyColorClass', 'legacyStepAttr', 'legacyLectureMode', 'colorOutside', 'narrHeadingDiffers',
14
14
  'kickerLong', 'kickerPlace', 'kickerSlide',
15
+ 'cautionEmpty', 'cautionLabel',
15
16
  'narrNote', 'narrFormula', 'turnLong', 'narrLang', 'predictAnswerWithCount', 'predictAnswerNeverShown',
16
17
  // app/main.js・app/llm.js(作業場所の原稿と台本から)
17
18
  'refVoice', 'audioStale', 'narrPlaceholder', 'templateText', 'readingExpr', 'readingSeveral', 'readingGap',
@@ -31,6 +31,7 @@ const ARTICLE = ['articleEncoding', 'articleFrontMatter', 'articleFrontMatterMem
31
31
  'articleAsideTitle', 'articleAsideNested', 'articleNested', 'articleAsideClass', 'articleTableClass', 'articleProofKind', 'articleFootnoteContent', 'articleFootnoteMissing',
32
32
  'articleFootnoteUnused', 'articleFootnoteName', 'articleFootnoteDuplicate', 'articleRuby', 'articleStepSyntax', 'articleSubfigure', 'articleFigureAlt', 'articleGlossary', 'articleSolutionLabel',
33
33
  'articleConverted', 'articleIndex', 'articleConfig', 'articleUnlisted', 'articleRead', 'articleUnsafeParagraph', 'articleTooLarge', 'articleChapterNumber', 'articleChapterTitle',
34
+ 'articleSectionKindValue', 'articleSectionKindMember', 'articleSectionKindPosition', 'articleSectionKindOrder', 'articleSectionKindContext',
34
35
  'articleChapterIncrease', 'articleChapterOrder', 'articleChapterDiffer', 'articleLang', 'articleBibliography', 'articleLabelDuplicate', 'articleLabelSlideId', 'articleXref', 'articleSolution',
35
36
  'articleTerm', 'articleStep', 'articleCite', 'articleReferences', 'articleImage', 'articleDataArticle', 'articleCitations', 'articleCiteStyle', 'articleCiteListChapter', 'articleCiteEngine',
36
37
  'articleUncited', 'articleLinksShape', 'articleLinkStale', 'articleLinkUnconfirmed', 'articleLinkUnlinked', 'articleSummary', 'articleSectionUnlinked'];
@@ -44,6 +45,8 @@ export const RULES = Object.freeze([
44
45
  { id: 'R-title', kind: 'authoring', phase: 'A 体裁', codes: ['titleLong', 'titleLongEn', 'titleColon', 'tateTitle'] },
45
46
  { id: 'R-concl', kind: 'authoring', phase: 'A 体裁', codes: ['conclLong', 'conclLongEn', 'conclOverflow'] },
46
47
  { id: 'R-headings', kind: 'authoring', phase: 'A 体裁', codes: ['secHeading', 'narrHeadingDiffers', 'kickerLong', 'kickerPlace', 'kickerSlide'] },
48
+ // 注意・警告の枠(kit/core/caution.mjs):指示の 1 行そのものが決まり(d5 2026-11-15。修正依頼が AI に書き方の行を指す)
49
+ { id: 'R-caution', kind: 'authoring', phase: 'A 体裁', codes: ['cautionEmpty', 'cautionLabel'] },
47
50
  { id: 'R-style', kind: 'authoring', phase: 'A 体裁', codes: ['desuMasu', 'punctMixed'], applies: (f) => (f.lang === 'ja' ? null : 'lang') },
48
51
  { id: 'R-math', kind: 'authoring', phase: 'A 体裁', codes: ['rawMath', 'katexError'] },
49
52
  { id: 'R-purpose', kind: 'authoring', phase: 'A 体裁', codes: ['cardsHint'] },
@@ -11,6 +11,7 @@ import { analyzeSlideIds, isJapanese } from './build-core.mjs';
11
11
  import { legacyVocabulary } from './legacy-vocab.mjs';
12
12
  import { colorsOutsideVocabulary } from './color-vocab.mjs';
13
13
  import { kickerFindings } from './kicker.mjs';
14
+ import { cautionFindings } from './caution.mjs';
14
15
  import { predictStepProblems } from './predict-steps.mjs';
15
16
  import { parseNarration, normalizeKey, noteProblems } from './narration-parse.mjs';
16
17
  import { narrationLang, textLang, formulaLike, formulaText } from './narration-lint.mjs';
@@ -20,6 +21,7 @@ export function sourceFindings({ deck, narration = '', voiceLang } = {}) {
20
21
  const add = (i, sev, code, a, step = null) => out.push({ i, sev, code, a, step });
21
22
  if (typeof deck !== 'string' || !deck) return out;
22
23
  for (const f of kickerFindings(deck)) add(f.i, f.sev, f.code, f.a);
24
+ for (const f of cautionFindings(deck)) add(f.i, f.sev, f.code, f.a);
23
25
  const ids = analyzeSlideIds(deck);
24
26
  for (const p of ids.problems) add(p.slide, p.sev, 'slideId', { msg: p.msg });
25
27
  for (const s of ids.slides) {
@@ -45,7 +45,7 @@ export const JOB = Object.freeze({ tag: 'tts-job', recordsTag: 'tts-records', v:
45
45
  export const COLAB = Object.freeze({
46
46
  repo: 'egatari/egatari-studio', notebook: 'colab/egatari-tts.ipynb',
47
47
  videoNotebook: 'colab/egatari-video.ipynb', // 動画(MP4)を作るノート(CPU のランタイム。#131)
48
- ref: 'v0.6.12', // バッジの URL は版のタグに固定する(リリースの手順で替える。RELEASING.md)
48
+ ref: 'v0.6.13', // バッジの URL は版のタグに固定する(リリースの手順で替える。RELEASING.md)
49
49
  pause: 0.35,
50
50
  models: Object.freeze({ irodori: 'irodori-tts-500m-v3', kokoro: 'kokoro-82m-v1.0' }),
51
51
  // 後処理の版(records の recipe.processing は PROCESSING に '+colab<ノートブックの版>' を付けたもの):ノートブック(colab/egatari_tts.py)の後処理は audio-core.mjs と同じ数。数を変えたら名前も変える
@@ -73,13 +73,14 @@ export const partSpans = (text, exclude = []) => text.replace(/<!--part:([a-z0-9
73
73
 
74
74
  // gone:組み立てに入らない部品(説明の中でその名前を出す所を除く。<!--part:…--> は make-llm-guide の markRefs が付ける)。
75
75
  // brief:一覧の 1 行だけの部品(説明の節を出さない)
76
- function catalog(D, names, gone = [], brief = []) {
76
+ // free:無料のプラン。部品に無料のプランの説明(free。tools/make-llm-guide.mjs の FREE_EDITS)があればそれを使う
77
+ function catalog(D, names, gone = [], brief = [], free = false) {
77
78
  if (!names.length) return '';
78
79
  const rows = names.map((n) => partSpans(D.components[n].row, gone)).join('\n');
79
80
  const full = names.filter((n) => !brief.includes(n));
80
81
  const sup = full.some((n) => D.components[n].sup);
81
82
  const short = names.length > full.length;
82
- return D.tableHead + '\n' + rows + '\n\n' + (short ? D.briefNote + '\n\n' : '') + (sup ? D.supNote + '\n\n' : '') + full.map((n) => partSpans(D.components[n].entry, gone)).join('\n\n');
83
+ return D.tableHead + '\n' + rows + '\n\n' + (short ? D.briefNote + '\n\n' : '') + (sup ? D.supNote + '\n\n' : '') + full.map((n) => partSpans((free && D.components[n].free) || D.components[n].entry, gone)).join('\n\n');
83
84
  }
84
85
  function extensions(D, set, exclude = [], gone = exclude) {
85
86
  return Object.keys(D.components).sort().filter((n) => !exclude.includes(n) && D.components[n].ext && D.components[n].ext[set])
@@ -100,7 +101,7 @@ export function commonOf(data, lang, { exclude = [], sets = [], off = [], plan =
100
101
  const gone = goneParts(data, lang, exclude, ss);
101
102
  const table = () => (data.purposes ? purposesTable(data.purposes, data.parts || [], lang, data.partsSrc || '', { exclude, sets: ss, off }) : '');
102
103
  return tidy(partSpans(D.common, exclude).replace('{{PURPOSES}}', table)
103
- .replace('{{CATALOG}}', () => catalog(D, membersOf(D, STANDARD).filter((n) => !exclude.includes(n)), gone, briefParts(data, plan, short, full))));
104
+ .replace('{{CATALOG}}', () => catalog(D, membersOf(D, STANDARD).filter((n) => !exclude.includes(n)), gone, briefParts(data, plan, short, full), planName(plan) === 'free')));
104
105
  }
105
106
  // 1 つの束の指示。sets:一緒に入る束(説明の中の名前を残す部品を決める。既定はこの束だけ)
106
107
  export function partOf(data, name, lang, { exclude = [], sets = [name] } = {}) {