Skip to content

Commit 37803c0

Browse files
committed
Fix new errors in WolfTPM PDF generation due to long lines
1 parent cbeb4c6 commit 37803c0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

wolfTPM/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ html-prep: api
6363
# 4. Three regexes to remove metadata which outputs in the PDF text
6464
# 5. Fix titles of the header files Markdown
6565
# 6. Two regexes to handle bad Doxygen that didn't convert and the LaTeX processor thinks is LaTeX commands
66+
# 7. For oversized enum table rows (>2000 chars), keep table formatting intact
67+
# by splitting enum values across continuation rows to avoid LaTeX
68+
# "Dimension too large" errors in longtable
6669
.PHONY: pdf-prep
6770
pdf-prep: api
6871
$(Q)perl -i -pe "s/# /## /g" api/md/*.md
@@ -78,10 +81,11 @@ pdf-prep: api
7881
$(Q)perl -i -pe "s/(?<=md\#function\-)(.*)(?=\))/\$$1=~s#-#_#gr/ge" api/md/*.md
7982
$(Q)perl -i -pe "s/(?<=md\#typedef\-)(.*)(?=\))/\$$1=~s#-#_#gr/ge" api/md/*.md
8083
$(Q)perl -i -pe "s/(?<=md\#enum\-)(.*)(?=\))/\$$1=~s#-#_#gr/ge" api/md/*.md
84+
$(Q)perl -i -pe 's!^\| enum\| (\*\*\[.*?\]\(.*?\)\*\*) \{(.*)\} \|\s*$$!do { my ($$name, $$vals) = ($$1, $$2); my @items = split(/, /, $$vals); my @chunks; my $$cur = ""; for my $$item (@items) { my $$cand = $$cur eq "" ? $$item : "$$cur, $$item"; if (length($$cand) > 220 && $$cur ne "") { push @chunks, $$cur; $$cur = $$item; } else { $$cur = $$cand; } } push @chunks, $$cur if $$cur ne ""; @chunks <= 1 ? "| enum| $$name { $$vals} |" : "| enum| $$name { $$chunks[0] |\n" . join("", map { "| | $$chunks[$$_]" . ($$_ == $$#chunks ? " }" : "") . " |\n" } 1..$$#chunks) }!ge if length > 2000' api/md/*.md
8185
$(Q)rm -rf build/pdf/chapter05.md
8286
$(Q)echo '# API Reference' >> build/pdf/chapter05.md
8387
ifeq ($(DOC_LANG),JA)
8488
$(Q)cat header-ja/group__TPM2__Proprietary.md header-ja/tpm2_8h.md header-ja/tpm2__wrap_8h.md header-ja/group__wolfTPM2__Wrappers.md >> build/pdf/chapter05.md
8589
else
8690
$(Q)cat api/md/group__TPM2__Proprietary.md api/md/tpm2_8h.md api/md/tpm2__wrap_8h.md api/md/tpm__io_8h.md api/md/group__wolfTPM2__Wrappers.md >> build/pdf/chapter05.md
87-
endif
91+
endif

0 commit comments

Comments
 (0)