buildtable.pl accepts EOF after all required fields even when the closing preamble fence or </pre> is missing. Track the terminator and reject truncated preambles. A temporary-fixture shell test covers accepted and rejected forms for both file formats.
Command: bash scripts/buildtable-test.sh. Passed the focused check.