Repository navigation
Add py-doc new, and keep table captions with their table in Word - #133
Merged
Merged
Conversation
py-doc new writes <number>-<Title>.yaml in the legacy build file format and its Markdown in the current folder, ready for py-doc build --legacy. It asks for the title, type, format, author (git user.name), classification and description; each has an option, and -y asks nothing. The number is [prefix-][type-]NNN, one counter for every type, from doc-numbers.yml at the repository root (number, title and file of every document). The first run makes the register from the document_number of the legacy build files already there, so a new number cannot repeat one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ket2UPXgz46XKSUqpuPixk
…number --scan adds the legacy build files below the repository root that are not in doc-numbers.yml yet, keeps numbers that clash and lists them. --start N is kept in the register: new numbers begin at N and skip any number already taken. Neither makes a document. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ket2UPXgz46XKSUqpuPixk
A caption below a table could fall to the next page on its own, because nothing held it to the table. Word has no keep-with-previous, so the last row of the table (which may not split) is now kept with the caption, and a caption above a table is kept with the table. A caption between two tables is the next table's, as markers.lua decides for HTML and PDF. It runs after [[CAPTION:]] lines have become Caption paragraphs. The reference had two sentences over the 30 words Vale allows, which failed py-doc lint --strict in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ket2UPXgz46XKSUqpuPixk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
py-doc newStarts one document in the current folder in the legacy build file format, ready for
py-doc build --legacy:<number>-<Title>.yamlwithmeta(title, author, version0.1.0, today's date, description,document_number, classification),cli(emit-docx+output, or a.pptxoutput) and one entry, plus<number>-<Title>.mdstarting with the title.git config user.name), classification and description. Each has an option;-yasks nothing. An existing file is never replaced.Number register
doc-numbers.ymlat the repository root (found from any folder below it): an optionalprefix, an optionalstart, anddocumentswith onlynumber,titleandfile.[prefix-][type-]NNN; prefix and type are optional, andNNNis one counter for every type.document_numberof the legacy build files already in the repository, and asks for the prefix.Register upkeep (no document made)
--scanadds the legacy build files not in the register yet, matched by file, numbers that clash included, and lists each clash. A second scan adds nothing.--start Nis kept asstart: N: new numbers begin atNand skip any number already taken. Without it, the next is one more than the highest.Table captions stay with their table (Word)
A caption below a table could fall to the top of the next page on its own. Word has no "keep with previous", so
keep_captions_with_tables:markers.luadoes for HTML and PDF.It runs after
apply_explicit_stylesandformat_all_tables, so[[CAPTION:]]lines are already Caption paragraphs.Docs
README command table and layout, the guide's command list, and a "New legacy documents" section in the reference (two sentences shortened to pass Vale's 30-word limit in
py-doc lint --strict).Testing
tests/test_new.py(13 tests) forpy-doc new, the register,--scanand--start;tests/test_logging_policy.pycoversnew.tests/test_word_layout.py: a caption below, a caption between two tables and a caption above, checked in the Word XML (cantSplitandkeepNext). It fails on the old code.tests/test_examples.pyfailures that also occur onmainhere (no Graphviz, Mermaid or PlantUML in this environment);ruff checkis clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ket2UPXgz46XKSUqpuPixk