Skip to content

feat(html): warn on the element types the renderer drops, instead of dropping them silently - #805

Merged
andiwand merged 1 commit into
mainfrom
feat/log-unhandled-elements
Sep 2, 2026
Merged

feat(html): warn on the element types the renderer drops, instead of dropping them silently#805
andiwand merged 1 commit into
mainfrom
feat/log-unhandled-elements

Conversation

@andiwand

@andiwand andiwand commented Sep 2, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

The render half of #150. translate_element's default: carried a // TODO log and threw the element and its whole subtree away without a word. It now names the type through state.logger(), which WritingState has carried all along.

default:
  ODR_WARNING(state.logger(), "html: dropped unhandled element "
                                  << element_type_name(element.type()));
  break;

element_type_name is a switch over every ElementType enumerator with no default, so a type added to the enum has to be named here too or the build stops.

The corpus test was logging into the void

html_output_test.cpp called the three-argument html::translate, so the renderer got Logger::null() — nothing it has ever reported was read. It now gets a logger, at warning level: at verbose the pre-existing per-pdf-operator and per-svm-action debug lines take the run from 1.7k to 23k lines and bury everything. At warning it is 2.0k lines.

What the corpus says

That is the point of the issue — turning "support X" into a ranking. Over all 281 corpus renders:

type dropped files
page_break 312 30

Nothing else. page_break is the renderer's only element-level gap, 240 of them in odt and 72 in doc. Worst offenders: efficiency+style-big+various-1.odt (87), 785KB.doc (64), style+svm-various-1.odt (38).

That is #174, and it now has a number on it.

The only other warning the whole corpus raises is one pdf cross-reference recovery.

Verification

  • ./odr_test --gtest_filter='all_test_files/HtmlOutputTests.*' — 281 tests, pass.
  • No markup changes, so the reference output needs no regeneration.

…dropping them silently

`translate_element`'s `default:` carried a `// TODO log` and threw the element
and its whole subtree away without a word. It now names the type through
`state.logger()`, which `WritingState` has carried all along.

The corpus test was handing the renderer the null logger, so nothing it
reported has ever been read; it now passes one, at warning level so the pdf
and svm per-operator debug output does not bury the run.

Across the whole corpus that measures exactly one gap: 312 dropped
`page_break` elements in 30 files, 240 in odt and 72 in doc. No other element
type reaches the default case.

Towards #150.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018cMYRXLJdiCkH65Jm2W9B5
@andiwand
andiwand merged commit 26d30aa into main Sep 2, 2026
36 checks passed
@andiwand
andiwand deleted the feat/log-unhandled-elements branch September 2, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant