Skip to content

Keep HTML 4 pages intact and convert a WoltLab forum - #5

Open
mgroeber9110 wants to merge 2 commits into
mainfrom
claude/project-thread-7upd59
Open

mgroeber9110 wants to merge 2 commits into
mainfrom
claude/project-thread-7upd59

Conversation

@mgroeber9110

Copy link
Copy Markdown
Owner

Requested by Marcus · project thread

Summary

Three new test pages (kept in the project folder, not in the repo):

  • thobipix.de and geos-infobase.de: hand-written HTML 4 table layouts. They should come out unchanged, but the converter lost link colors, the body background, &nbsp; and left alignment inside <center>, and resized headings inside <font size="-1">.
  • GEOS-InfoBase forum (WoltLab Suite 6): needed several CSS features.

Old-style pages

  • Presentational attributes (<font>, bgcolor, align, nowrap, <body text link>) now take part in the cascade. The page's own <font> tags are no longer wrapped in another <font>.
  • Pages with an old or missing doctype are read in quirks mode, so tables do not inherit font size and alignment. Cells inside centered content set their own align, because legacy browsers differ on whether cells inherit it.
  • <body bgcolor/link/vlink/alink> are kept. Links in the page's link color need no extra color.
  • collapse() no longer turns &nbsp; (and U+202F) into normal spaces. A cell that contains only &nbsp; keeps it, so its background still shows in old browsers.
  • Table and row elements no longer get font CSS, because each cell sets its own.

Forum patterns

  • Text from ::before / ::after (":", " · ", attr()). Icon font glyphs (private use area, or icon fonts that draw letters) and absolutely positioned pseudo-elements are left out.
  • A grid where one item spans all rows ("icon content lastPosts" "icon stats lastPosts") becomes one row with stacked columns. As table rows, the stacked items were pulled apart.
  • Wrapping flex rows of plain text items (lists of names) become running text that the browser wraps.
  • Horizontal margins between flex items are added to the gap cell (not next to empty icon items) and count in width estimates.
  • p and h1–h6 with zero vertical margins become <div>, and inline headings become <span>. To make this work, the UA stylesheet now has the default heading and paragraph margins.
  • max-height scales images with the same aspect ratio. A transparent border-color counts as no border.

Effect on the other test pages

Text coverage stays at 100% everywhere. Pages wider than 800px got narrower: heise went from 824 to 800 px and spiegel from 1786 to 1415 px. csstricks went from 1185 to 1207 px; its already known overflow comes from the slider headings. Pages are shorter because headings with margin: 0 lose their blank lines. Spot checks of tagesschau, t3n, ndr and heise against the original look closer than before.

Test plan

  • python -m pytest (101 passed). New unit tests are in tests/test_convert.py. The new pattern pages tests/pages/legacy-homepage.html and tests/pages/forum-board.html use neutral text.
  • python tools/testpages.py on all 16 saved pages
  • Playwright screenshots at 800px: original without JS, then main, then this branch (in the project folder as testpages/vergleich-thobipix.png, vergleich-geos.png, vergleich-geos-forum.png)

Generated by Claude Code

New test pages: thobipix.de and geos-infobase.de (hand-written HTML 4
table layouts that should not change) and the GEOS-InfoBase forum
(WoltLab Suite 6).

Old-style pages:
- Presentational attributes (<font>, bgcolor, align, nowrap, <body text
  link>) take part in the cascade; the page's own <font> tags are not
  wrapped in another <font>.
- Quirks mode for old or missing doctypes: tables do not inherit font
  size and alignment. Cells inside centered content set their own align.
- <body bgcolor/link/vlink/alink> are kept; links in the page's link
  color need no extra color.
- Non-breaking spaces are no longer collapsed, also in otherwise empty
  cells. No font CSS on table and row elements (cells set their own).

Forum patterns:
- Text from ::before / ::after (separators, attr()), without icon font
  glyphs or absolutely positioned pseudo-elements.
- Grids with an item spanning all rows become one row with stacked
  columns; nowrap grid items get nowrap cells.
- Wrapping flex rows of plain text items become running text.
- Horizontal margins between flex items add to the gap.
- p/h1-h6 with zero margins become <div>, inline headings <span>.
- max-height scales images; transparent borders are no borders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1zAu3pLpJpZYnnFGdV5mm
Boxes with only vertical padding (cards with py-2) got cellpadding 0,
so stacked teasers ran together. Vertical padding up to 8px now counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K1zAu3pLpJpZYnnFGdV5mm
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.

2 participants