FolioReader-Android icon indicating copy to clipboard operation
FolioReader-Android copied to clipboard

Fix attribute class redefined error on some epub files

Open marcqtan opened this issue 5 years ago • 4 comments

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

marcqtan avatar Jul 06 '20 10:07 marcqtan

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?

mrifni avatar Jul 08 '20 13:07 mrifni

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).

marcqtan avatar Jul 09 '20 03:07 marcqtan

@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.

https://github.com/FolioReader/FolioReader-Android/issues/468

yashdevelops avatar Jul 31 '20 16:07 yashdevelops

can someone review these PRs and feedback the contributor ?

mrifni avatar Aug 18 '20 06:08 mrifni