Skip to content

DoHyun468/claw-hwp / plugins/claw-hwp/skills/hwp

FileKindSize
SKILL.mdskill md101.9 KB
references/README.mdmarkdown834 B
references/equation-syntax.mdmarkdown5.9 KB
references/hwp-internals.mdmarkdown4.9 KB
references/hwp-object-placement.mdmarkdown5.8 KB
references/hwpx-edit-ops.mdmarkdown52.8 KB
references/hwpx-format.mdmarkdown14.8 KB
references/hwpx-object-placement.mdmarkdown7.1 KB
references/hwpx-style-spacing.mdmarkdown10.7 KB
references/rhwp-api.mdmarkdown15.8 KB
scripts/README.mdmarkdown2.4 KB
scripts/cell-inspect.jsscript4.9 KB
scripts/cell-patch.jsscript525.8 KB
scripts/create.jsexecutablebinary235.8 KB
scripts/extract_text.jsexecutablescript12.0 KB
scripts/hwpx-edit.jsscript292.7 KB
scripts/launcher/preview-linux.shexecutablescript2.0 KB
scripts/launcher/preview-mac.commandexecutablescript1.9 KB
scripts/launcher/preview-windows.batscript2.1 KB
scripts/make_seal.pyscript3.4 KB
scripts/pack.pyexecutablescript8.0 KB
scripts/package-lock.jsonmanifest2.0 KB
scripts/package.jsonmanifest298 B
scripts/preview-server.jsscript5.3 KB
scripts/preview-viewer.htmlother11.5 KB
scripts/preview-viewer.jsscript17.2 KB
scripts/references/chart-templates/chart-0.jsonconfig6.4 KB
scripts/references/chart-templates/chart-1.jsonconfig6.4 KB
scripts/references/chart-templates/chart-10.jsonconfig6.3 KB
scripts/references/chart-templates/chart-11.jsonconfig6.3 KB
scripts/references/chart-templates/chart-12.jsonconfig6.5 KB
scripts/references/chart-templates/chart-13.jsonconfig6.5 KB
scripts/references/chart-templates/chart-14.jsonconfig6.5 KB
scripts/references/chart-templates/chart-15.jsonconfig6.5 KB
scripts/references/chart-templates/chart-16.jsonconfig5.9 KB
scripts/references/chart-templates/chart-17.jsonconfig5.9 KB
scripts/references/chart-templates/chart-18.jsonconfig6.3 KB
scripts/references/chart-templates/chart-19.jsonconfig6.3 KB
scripts/references/chart-templates/chart-2.jsonconfig6.4 KB
scripts/references/chart-templates/chart-3.jsonconfig6.4 KB
scripts/references/chart-templates/chart-4.jsonconfig6.4 KB
scripts/references/chart-templates/chart-5.jsonconfig6.3 KB
scripts/references/chart-templates/chart-6.jsonconfig5.9 KB
scripts/references/chart-templates/chart-7.jsonconfig5.9 KB
scripts/references/chart-templates/chart-8.jsonconfig5.9 KB
scripts/references/chart-templates/chart-9.jsonconfig6.3 KB
scripts/secure-fill.mjsscript38.0 KB
scripts/templates/hancom_native_stub.hwpxbinary128.0 KB
scripts/unpack.pyexecutablescript2.5 KB
scripts/validate.pyexecutablescript3.7 KB
themes/arctic-frost.mdmarkdown777 B
themes/botanical-garden.mdmarkdown751 B
themes/desert-rose.mdmarkdown748 B
themes/forest-canopy.mdmarkdown755 B
themes/golden-hour.mdmarkdown778 B
themes/midnight-galaxy.mdmarkdown766 B
themes/modern-minimalist.mdmarkdown766 B
themes/ocean-depths.mdmarkdown758 B
themes/sunset-boulevard.mdmarkdown811 B
themes/tech-innovation.mdmarkdown729 B

scripts/cell-inspect.js

View on GitHub
// cell-inspect.js — Read .hwp table structure + cell text via rhwp WASM.
//
// `describeTable` and `enumerateTables` were moved here verbatim from
// create.js (logic unchanged) so that every consumer shares ONE table-cell
// read mechanism:
//   - create.js   — set_cell_text / set_cell_text_by_label cell sweep (write)
//   - extract_text.js — --inspect --with-cell-text cell-text dump (read)
// Keeping the sweep in a single place is deliberate: if the dump read a cell
// differently than the writer addresses it, edits would silently target the
// wrong cell. Read and write must walk tables identically.
//
// All functions take an already-constructed rhwp `HwpDocument`. Loading the
// WASM and installing the `globalThis.measureTextWidth` layout stub (required
// before `new HwpDocument(...)`) is the caller's responsibility.

// Walk a table's cells via getCellInfo until rhwp errors (= past last cell).
// Returns { rowCount, colCount, cells: [{idx,row,col,rowSpan,colSpan,text}],
//           indexByRowCol(r,c) } or null if the control isn't a table.
export function describeTable(doc, sec, para, ctrl) {
  const cells = [];
  let rowCount = 0, colCount = 0;
  for (let i = 0; i < 10000; i++) {
    let info;
    try {
      info = JSON.parse(doc.getCellInfo(sec, para, ctrl, i));
    } catch {
      break;
    }
    if (!info || typeof info.row !== "number") break;
    // Read EVERY paragraph of the cell, not just the first — Korean forms split
    // a label across lines ("사업장"/"소재지", "공"/"급"/"자"), and getTextInCell
    // returns one paragraph at a time. Join with "\n" so the full label is
    // visible (set_cell_text_by_label normalises whitespace before matching).
    let text = "";
    try {
      const nPara = doc.getCellParagraphCount(sec, para, ctrl, i);
      const parts = [];
      for (let pi = 0; pi < nPara; pi++) {
        try { parts.push(doc.getTextInCell(sec, para, ctrl, i, pi, 0, 100000)); } catch {}
      }
      text = parts.join("\n");
    } catch {
      try { text = doc.getTextInCell(sec, para, ctrl, i, 0, 0, 100000); } catch {}
    }
    cells.push({
      idx: i,
      row: info.row,
      col: info.col,
      rowSpan: info.rowSpan ?? 1,
      colSpan: info.colSpan ?? 1,
      text,
    });
    rowCount = Math.max(rowCount, info.row + (info.rowSpan ?? 1));
    colCount = Math.max(colCount, info.col + (info.colSpan ?? 1));
  }
  if (cells.length === 0) return null;
  const byRowCol = new Map();
  for (const c of cells) byRowCol.set(`${c.row},${c.col}`, c.idx);
  return {
    rowCount,
    colCount,
    cells,
    indexByRowCol(r, c) {
      return byRowCol.get(`${r},${c}`);
    },
  };
}

// Walk every paragraph in every section, asking rhwp for table cells at
// each (sec, para, ctrl) tuple. Returns [{sec, para, ctrl}] for every
// table control encountered.
//
// Why we don't break on the first failing control index: a paragraph can
// hold non-table controls (textboxes, pictures, fields) interleaved with
// tables — government forms in particular use cover paragraphs that pack
// a logo (ctrl 0), a checkbox (ctrl 1), a textbox (ctrl 2), and only
// THEN the actual table (ctrl 3). rhwp errors "지정된 컨트롤이 표가
// 아닙니다" for those non-table indices, which is a "skip" signal, not a
// "no more controls" signal. We keep scanning up to MAX_CONTROL_IDX —
// well past anything seen in real forms — and only stop on a different
// error class. The cost is ~64 cheap wasm calls per paragraph, negligible.
export const MAX_CONTROL_IDX = 64;
export function enumerateTables(doc) {
  const out = [];
  const sectionCount = (() => {
    try { return doc.getSectionCount(); } catch { return 1; }
  })();
  for (let sec = 0; sec < sectionCount; sec++) {
    const paraCount = (() => {
      try { return doc.getParagraphCount(sec); } catch { return 0; }
    })();
    for (let p = 0; p < paraCount; p++) {
      for (let c = 0; c < MAX_CONTROL_IDX; c++) {
        let info;
        try { info = JSON.parse(doc.getCellInfo(sec, p, c, 0)); } catch { continue; }
        if (!info || typeof info.row !== "number") continue;
        out.push({ sec, para: p, ctrl: c });
      }
    }
  }
  return out;
}

// Convenience for the cell-text dump path: enumerate every table in the doc
// and read all of its cells. Returns
//   [{ sec, para, ctrl, rowCount, colCount,
//      cells: [{idx,row,col,rowSpan,colSpan,text}] }]
// in deterministic document order (section ASC, paragraph ASC, control ASC —
// the enumerateTables sweep order). The caller must have constructed `doc`
// with the measureTextWidth layout stub already installed.
export function dumpTables(doc) {
  const tables = [];
  for (const { sec, para, ctrl } of enumerateTables(doc)) {
    const grid = describeTable(doc, sec, para, ctrl);
    if (!grid) continue;
    tables.push({
      sec,
      para,
      ctrl,
      rowCount: grid.rowCount,
      colCount: grid.colCount,
      cells: grid.cells,
    });
  }
  return tables;
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall