A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: Add EPUB table omitted placeholder (#372)

## Summary

* **What is the goal of this PR?**: Fix the bug I reported in
https://github.com/daveallie/crosspoint-reader/issues/292
* **What changes are included?**: Instead of silently dropping table
content in EPUBs., replace with an italicized '[Table omitted]' message
where tables appear.

## Additional Context

* Add any other information that might be helpful for the reviewer
(e.g., performance implications, potential risks,
specific areas to focus on).

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**PARTIALLY **_

---------

Co-authored-by: Evan Fenner <evan@evanfenner.com>
Co-authored-by: Warp <agent@warp.dev>

authored by

efenner
Evan Fenner
Warp
and committed by
GitHub
d45f355e 56ec3dfb

+15 -1
+15 -1
lib/Epub/Epub/parsers/ChapterHtmlSlimParser.cpp
··· 25 25 const char* IMAGE_TAGS[] = {"img"}; 26 26 constexpr int NUM_IMAGE_TAGS = sizeof(IMAGE_TAGS) / sizeof(IMAGE_TAGS[0]); 27 27 28 - const char* SKIP_TAGS[] = {"head", "table"}; 28 + const char* SKIP_TAGS[] = {"head"}; 29 29 constexpr int NUM_SKIP_TAGS = sizeof(SKIP_TAGS) / sizeof(SKIP_TAGS[0]); 30 30 31 31 bool isWhitespace(const char c) { return c == ' ' || c == '\r' || c == '\n' || c == '\t'; } ··· 59 59 60 60 // Middle of skip 61 61 if (self->skipUntilDepth < self->depth) { 62 + self->depth += 1; 63 + return; 64 + } 65 + 66 + // Special handling for tables - show placeholder text instead of dropping silently 67 + if (strcmp(name, "table") == 0) { 68 + // Add placeholder text 69 + self->startNewTextBlock(TextBlock::CENTER_ALIGN); 70 + if (self->currentTextBlock) { 71 + self->currentTextBlock->addWord("[Table omitted]", EpdFontFamily::ITALIC); 72 + } 73 + 74 + // Skip table contents 75 + self->skipUntilDepth = self->depth; 62 76 self->depth += 1; 63 77 return; 64 78 }