Repository navigation
Built-in engines W30: Word layout, TXT and Markdown output, left-out notices, smaller DjVu PDFs - #1727
Open
KnifeLemon wants to merge 12 commits into
Open
Built-in engines W30: Word layout, TXT and Markdown output, left-out notices, smaller DjVu PDFs#1727KnifeLemon wants to merge 12 commits into
KnifeLemon wants to merge 12 commits into
Conversation
…-in TXT RTF, Word and ODT to TXT on the built-in route: - PAGE / NUMPAGES fields write the number the file showed when it was saved (Word's field result, ODT's text:page-number text, RTF's \fldrslt), kept as HField.Shown; without one, the page counted from the sections and page breaks. Before, the field came out empty. - A Word paragraph that holds only a page break is an empty line, as Word and LibreOffice save it. The DOCX reader still leaves it out of the layout and counts it on the next block (BreakParagraphsBefore). No form feed. - A list number or bullet is followed by a tab, or by the space or nothing a Word list level asks for (w:suff), as Word and LibreOffice write plain text. HWP/HWPX and e-book TXT use the same marker. - The built-in RTF, Word and ODT to TXT edges cost 15, below LibreOffice's fallback (25) with any engine order penalty, so they win wherever LibreOffice stands in the engine list. LibreOffice's separate RTF to TXT edge (10) goes. A Word 6.0 / 95 file still goes to LibreOffice. - ENGINES.md and the hwp-text engine description (all 23 languages) name RTF, Word and ODT to TXT. - bn-BD, fa, vi: the Linux LibreOffice guidance no longer mentions Java and H2Orestart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g, list numbers, page border order - Word 2010-and-older documents (compatibilityMode < 15, or none given) measure tblInd to the first cell's text: the table's edge sits a cell margin further out (layout-only HTable.EdgeBeforeIndent); tblInd also comes from the table style. - A fixed table in the body wider than its column keeps its widths and runs into the margin (both margins when centred) instead of being narrowed. - w:tblCellSpacing: cells inset on every side, the table's border drawn around them; w:wBefore / w:wAfter size the grid columns a row leaves empty; RTF rows with \trautofit1 (and \trwWidth) are sized as Word's autofit tables. - List numbers: w:lvlJc center/right, the number in the paragraph mark's format with the level's w:rPr over it (bullets keep their mapped character's font), and tab stops between a hanging first line's start and the left indent. - Page borders go over the text unless w:zOrder="back". - In columns of their own widths, a table that goes on in a column of another width is laid out again for it from its next row group (list numbers restored). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…boxes, controls and slide decks - DOCX: text boxes written top to bottom (wps:bodyPr vert, VML layout-flow) are named as vertical text set horizontally; ActiveX controls are named as form controls drawn from their saved picture or left out. Both are flagged by the capability check, so such files keep LibreOffice's route. - DOCX: legacy check boxes and drop-downs (w:ffData) are drawn as Word prints them (a checked or empty box, the chosen entry) instead of nothing. - DOCX: a header or footer shared by several sections counts what it leaves out once, not once per section. - Slides: PPTX, PPT and ODP decks drawn by the slide renderer get the same note: the capability check's pass run to the end for PPTX (and what a PPT translation dropped), the ODP reader's own checks counted once per shape. ODG drawings get it through the drawing converter. - 11 new notice texts in all 23 languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… Smmr - PDF masks are coded the smallest way: JBIG2 (the JB2 shapes as a symbol dictionary and a text region, MQ-coded, written from ITU-T T.88), CCITT G4 (own encoder from ITU-T T.6), or Flate for dithered pictures. The DjVu 3 specification goes from 6.0 MB to 1.45 MB, a 115-page scanned book from 13.9 MB to 1.5 MB; the pages draw pixel for pixel as before. - ANTa/ANTz hyperlinks become PDF link annotations: links into the document (by id, name, title, page number or +n/-n) and http, https, ftp and mailto addresses only. NAVM bookmarks become the PDF outline. - Indirect documents read their component files from below the index file's folder only (no "..", roots, drives, ':' or device names, no path through a link); a missing page or included file is still refused with error.djvu_indirect. - Smmr (G4) masks are read, whole or in stripes, inverted or not. - Bound annotation parts (DjvuLimits.MaxAnnotationNodes) and nesting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A page-sized shape (an Smmr mask) no longer needs a padded copy of its pixels while it is coded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # src/Filee.Engines/Hwp/Hwpx/Docx/DocxReader.cs
…s math DOCX, ODT and RTF reached Markdown through the HWPX writer, which gave the equations back as 한글 equation script, written as italic text. The HWP text engine now writes Markdown from them directly (cost 15, direct only, like TXT), so equations come out as TeX math. An equation alone on its line is display math also when tabs centre it, and tabs at the start or end of a paragraph no longer write spaces that turned the paragraph into an indented code block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cell's paragraphs are joined by <br> and its list items marked "•" or "1.", as Pandoc's filter did; before, the built-in writer joined them with spaces. The two #391 tests no longer need Pandoc: DOCX → Markdown goes through hwp-text wherever Pandoc stands, so they check the built-in output (pictures linked relative to the Markdown file, merged cells as a Markdown table). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Wave 30 of the built-in engines: a Word layout batch, built-in TXT output fixes, left-out notices, and smaller DjVu PDFs with links, bookmarks and indirect files.
Word layout
compatibilityModebelow 15 (and no mode given, as Word treats it) places a left-aligned table's edge one first-cell margin out (HTable.EdgeBeforeIndent, layout only);tblIndread from table styles.w:tblCellSpacing(space on each side of a cell, outer border around the cells),w:wBefore/w:wAfterwidths for empty grid columns, RTF\trautofit1with\trwWidthsized like Word autofit.w:lvlJccenter/right, the level'sw:rProver the paragraph mark's format (HListRef.MarkerFormat, layout only); custom tab stops between a hanging first line and the left indent are used.zOrder="back".ListNumbers.Save/Restore).TXT output
HField.Shown: DOCX field results andw:fldSimple, ODT page-number text, RTF\fldrslt); otherwise a count from sections and page breaks.HBlock.BreakParagraphsBefore); layout unchanged.w:suffdefault; space or nothing when the level says so), also for HWP/HWPX and e-book TXT.MarkdownWriter(cost 15, direct only). Before, DOCX → Markdown went through the HWPX writer and the equations came back as 한글 equation script in italics; now they're TeX math (checked on DOCX to PDF conversion causes incorrect equation formatting and corrupted Visio diagrams #356's 114 equations). Pandoc no longer takes RTF → Markdown.$$…$$also when tabs centre it; tabs at a paragraph's start or end no longer write spaces (an indented code block).<br>and its list items marked•/1.(Word → Markdown: tables with merged cells come out as HTML, and picture links are absolute #391), as Pandoc's filter did; the two Word → Markdown: tables with merged cells come out as HTML, and picture links are absolute #391 tests inPandocMarkupTestsnow check the built-in output and run without Pandoc.engine.hwp-text.descriptionin 23 locales; stale Java/H2Orestart line removed from bn-BD, fa, viengines.guidance.linux.libreoffice.Left-out notices
wps:bodyPr vert, VMLlayout-flow:vertical) and ActiveX controls are counted and flagged; legacy check boxes and drop-downs are drawn (☒/☐, chosen entry).DjVu
CcittG4.cs(encoder and decoder) andJbig2Encoder.cs, written from T.6 and T.88.DjvuLimits.MaxAnnotationNodes...,:, device names, symlinks or junctions); a missing page still refuses witherror.djvu_indirect.Merge notes
DocxReader.cs: the TXT branch's PAGE/NUMPAGES field numbers combined with the left-out branch's legacy form fields.Tests
Run locally on the merged branch:
dotnet format --verify-no-changes --severity warnclean on Engines, Core and Engines tests🤖 Generated with Claude Code