Commit c3832e4
committed
docs: deduplicate built HTML images into a shared image/ tree
The HTML doc build copies every referenced image into each language and
topic directory, so the built tree carries the same bytes many times over
(238 MB of images, only 30 MB unique).
Add docs/src/tools/dedup-images.py: it collapses byte-identical images
(SHA-256) into a shared root image/ tree, keeps only translated overrides
under <lang>/image/, and rewrites every src and click-to-enlarge href to
match. Dry-run by default, idempotent, and self-verifying: after --apply it
re-resolves every reference and fails if any is broken.
Wire it into the htmldocs build as a final .dedup-images-stamp step. The
tool preserves the mtime of every HTML file it rewrites, so a second
`make htmldocs` does no work.
On the full translated tree this takes the build output from 325 MB to
119 MB (images 238 MB to 30 MB) with all references verified.1 parent 7565f7a commit c3832e4
2 files changed
Lines changed: 387 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
576 | | - | |
| 576 | + | |
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
| |||
595 | 595 | | |
596 | 596 | | |
597 | 597 | | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
598 | 605 | | |
599 | 606 | | |
600 | 607 | | |
| |||
705 | 712 | | |
706 | 713 | | |
707 | 714 | | |
708 | | - | |
| 715 | + | |
709 | 716 | | |
710 | 717 | | |
711 | 718 | | |
| |||
1313 | 1320 | | |
1314 | 1321 | | |
1315 | 1322 | | |
| 1323 | + | |
1316 | 1324 | | |
1317 | 1325 | | |
1318 | 1326 | | |
| |||
0 commit comments