Files
MeanField/reports/pandoc_tables.lua
Emily Boudreaux e7e53ce682 Consolidate numerical research and preserve a reproducible handoff
Document the baseline, hypotheses, measured results, failed approaches,
current policy defaults, and remaining rotating n=3 and virial limitations.
Include the authoritative LaTeX report, Pandoc-generated Markdown, compiled
PDF, source provenance, branch decisions, and consolidation validation.

Organize raw results and miscellaneous artifacts under working/ without
deleting them; version the directory guide, relocation hashes, archive
verifier, and report build/conversion checks. Keep build caches at their
original paths and clearly distinguish retained binaries from the validated
research build. Preserve experimental policies without promoting failed
trials to defaults.
2026-09-20 09:10:27 -04:00

29 lines
1.1 KiB
Lua

-- LaTeX longtables repeat their heading on a new PDF page. Pandoc also exposes
-- that repeated heading as the first body row; Markdown needs it only once.
local function row_signature(row)
local cells = {}
for _, cell in ipairs(row.cells) do
cells[#cells + 1] = pandoc.write(pandoc.Pandoc(cell.contents), 'native')
end
return table.concat(cells, '\n--cell--\n')
end
function Table(value)
if #value.head.rows ~= 1 or #value.bodies == 0 then return value end
local rows = value.bodies[1].body
if #rows > 0 and row_signature(rows[1]) == row_signature(value.head.rows[1]) then
table.remove(rows, 1)
end
return value
end
-- GFM headings cannot carry LaTeX's explicit section labels. Preserve those
-- anchors so Pandoc's generated contents links still resolve in the Markdown.
function Header(value)
if value.identifier:find(':', 1, true) then
local id = value.identifier:gsub('&', '&amp;'):gsub('"', '&quot;'):gsub('<', '&lt;'):gsub('>', '&gt;')
return {pandoc.RawBlock('html', '<a id="' .. id .. '"></a>'), value}
end
return value
end