Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix attribute class redefined error on some epub files #457

Open
wants to merge 32 commits into
base: master
Choose a base branch
from

Conversation

marcqtan
Copy link

@marcqtan marcqtan commented Jul 6, 2020

Some epubs, have an html content with "class" attribute. FolioReader
will fail since it's also defining its class attribute.

Fixed this by adding a logic to check if the class attribute already exist,
if it does then just append the class attribute of FolioReader to the already
existing class attribute of the Epub file. Otherwise, just add the class attribute
directly to the htmlcontent.

Example epub html content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:epub="http://www.idpf.org/2007/ops"
 xml:lang="ja"
 class="hltr"  ------->  class attr already defined here
>
<head>
<meta charset="UTF-8"/>
<title> Vol.1</title>
<link rel="stylesheet" type="text/css" href="../style/book-style.css"/>
</head>

<body class="image-page">
<div id="m016" class="main">
<h1><img class="fit" src="../image/tobira.jpg" alt=""/></h1>
</div>
</body>
</html>

With my fix the class attribute will become like class="lora nightmode hltr" (sample only)

Will fix #456

Some epubs, have an html content with "class" attribute. FolioReader
will fail since it's also defining its class attribute.

Fixed this by adding a logic to check if the class attribute already exist,
if it does then just append the class attribute of FolioReader to the already
existing class attribute of the Epub file. Otherwise, just add the class attribute
directly to the htmlcontent.
@mrifni
Copy link

mrifni commented Jul 8, 2020

how are you finding this library so far, i am looking for a open source epub reader for ios and android and couldnt find anything so far except this, also is there a flutter version if you know?

@marcqtan
Copy link
Author

marcqtan commented Jul 9, 2020

how are you finding this library so far, i am looking for a open source epub reader for ios and android and couldnt find anything so far except this, also is there a flutter version if you know?

yes. i'm actually using flutter to display epub files. I'm using epub_kitty package which is also using this library (folioreader).

@yashdevelops
Copy link

yashdevelops commented Jul 31, 2020

@marcqtan Please help me bro ! I'm getting a crash in my folio reader app opening EPUB books. I have raised a issue please have a look and help. I have been stuck in this since weeks. Please.

#468

@mrifni
Copy link

mrifni commented Aug 18, 2020

can someone review these PRs and feedback the contributor ?

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.

Issue when opening EPUB 3 files
4 participants