baskerville / plato

Document reader
Other
1.3k stars 109 forks source link

Parsing/rendering ends unexpectedly on HTML5 <br> tags #180

Open momijizukamori opened 3 years ago

momijizukamori commented 3 years ago

When opening HTML documents with HTML5-compliant linebreak tags (<br>, rather than XHTML-style <br \>, nothing is rendered after the tag - the document just ends there. Some quick HTML snippets as examples (as github doesn't allow HTML attachments): Good:

<!DOCTYPE html>
<html lang="en">

<head>
    <title>
        XHTML-style breaks
    </title>
</head>

<body>
    Section 1
    <br />
    Section 2
    <br />
    Section 3
</body>
</html>

Bad:

<!DOCTYPE html>
<html lang="en">

<head>
    <title>
        HTML5-style breaks
    </title>
</head>

<body>
    Section 1
    <br>
    Section 2
    <br>
    Section 3
</body>
</html>
baskerville commented 3 years ago

The HTML renderer was extracted from the EPUB renderer, itself based on a simple XML parser (since EPUB2 is based on XHTML).

TnS-hun commented 1 year ago

This bug is really annoying in dictionaries. For example in Wiktionary-Dictionaries.

theowenyoung commented 11 months ago

In my case, plato also ignores
, and doesn't show newlines, as shown in the following example:

The epub/kepub that comes with kobo can display line breaks normally.

<p class="indent" data-immersive_translate_walked="827a1f24-8b3d-4531-8356-480c5a00c3fa">The striking irony here is that the last possible object that can be linked to the German currency is precisely such a curve: the reichsmark (as the currency was previously called) went from four per dollar to <em data-immersive_translate_walked="827a1f24-8b3d-4531-8356-480c5a00c3fa">four trillion</em> per dollar in the space of a few years during the 1920s, an outcome that tells you that the bell curve is meaningless as a description of the randomness in currency fluctuations. All you need to reject the bell curve is for such a movement to occur once, and only once—just consider the consequences. Yet there was the bell curve, and next to it Herr Professor Doktor Gauss, unprepossessing, a little stern, certainly not someone I’d want to spend time with lounging on a terrace, drinking pastis, and holding a conversation without a subject.

<span class="notranslate immersive-translate-target-wrapper" lang="zh-CN" data-immersive-translate-translation-element-mark="1">
<br />
<span class="notranslate immersive-translate-target-translation-theme-none immersive-translate-target-translation-block-wrapper-theme-none immersive-translate-target-translation-block-wrapper" data-immersive-translate-translation-element-mark="1">
<span class="notranslate immersive-translate-target-inner immersive-translate-target-translation-theme-none-inner" data-immersive-translate-translation-element-mark="1">令人啼笑皆非的是,能与德国货币联系起来的最后一个可能的对象恰恰就是这样一条曲线:在 20 世纪 20 年代的几年时间里,帝国马克(该货币以前的名称)从每美元兑四马克涨到了每美元兑四万亿马克,这一结果告诉你,钟形曲线作为货币波动随机性的描述是毫无意义的。要否定钟形曲线,只需要这样的波动发生一次,而且只有一次--只要考虑一下后果就可以了。然而,钟形曲线就在眼前,旁边是高斯教授先生,他其貌不扬,有点严厉,当然不是我想和他一起在露台上悠闲地喝着清酒,无拘无束地交谈的人。
</span>
</span>
</span>
</p>