feat: Add CSS parsing and CSS support in EPUBs

This commit is contained in:
Jake Kenneally
2026-01-17 17:57:04 -05:00
parent 21277e03eb
commit 94ce987f2c
19 changed files with 1290 additions and 46 deletions

View File

@@ -8,6 +8,7 @@
#include <vector>
#include "Epub/BookMetadataCache.h"
#include "Epub/css/CssParser.h"
class ZipFile;
@@ -24,11 +25,14 @@ class Epub {
std::string cachePath;
// Spine and TOC cache
std::unique_ptr<BookMetadataCache> bookMetadataCache;
// CSS parser for styling
std::unique_ptr<CssParser> cssParser;
bool findContentOpfFile(std::string* contentOpfFile) const;
bool parseContentOpf(BookMetadataCache::BookMetadata& bookMetadata);
bool parseTocNcxFile() const;
bool parseTocNavFile() const;
bool parseCssFiles();
public:
explicit Epub(std::string filepath, const std::string& cacheDir) : filepath(std::move(filepath)) {
@@ -63,4 +67,5 @@ class Epub {
size_t getBookSize() const;
uint8_t calculateProgress(int currentSpineIndex, float currentSpineRead) const;
const CssParser* getCssParser() const { return cssParser.get(); }
};