help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reading newer oreilly books / shr rendering removes whitespace


From: Marcus Kammer
Subject: Reading newer oreilly books / shr rendering removes whitespace
Date: Mon, 15 Aug 2022 19:21:21 +0200

Hello,

There is some strange rendering behavior around shr.

When I start reading one of the newer epub ebooks from oreilly, in some
sentences the whitespace between two words is missing.

For instance:

#+begin_example
Wecan’t stress enough the importance of experimentation as you learn new 
concepts here and throughout the book.
#+end_example

Here, the whitespace is missing between `We` and `can't`.

So I did checked the xhtml source of the epub:

#+begin_src html
<p>We<a data-type="indexterm" data-primary="code examples" 
data-secondary="downloading" id="idm45654236145288"/><a data-type="indexterm" 
data-primary="online resources" data-secondary="code examples" 
id="idm45654236144280"/><a data-type="indexterm" data-primary="GitHub, code 
examples from" id="idm45654236143336"/> can’t stress enough the importance of 
experimentation as you learn new concepts here and throughout the book.
#+end_src

As you can see, there is an anchor tag between the words.

So I started `debug-on-entry` on the function `libxml-parse-html-region` to see
what happened with the dom.

This is my debug log:

#+begin_example
Debugger entered--entering a function:
* undo-auto--undoable-change()
* shr-insert(" can’t stress enough the importance of experimenta...")
* shrface-tag-p((p nil "We" (a ((data-type . "indexterm") (data-primary . "code 
examples") (data-secondary . "downloading") (id . "idm45654236145288"))) (a 
((data-type . "indexterm") (data-primary . "online resources") (data-secondary 
. "code examples") (id . "idm45654236144280"))) (a ((data-type . "indexterm") 
(data-primary . "GitHub, code examples from") (id . "idm45654236143336"))) " 
can’t stress enough the importance of experimenta..."))
* shr-descend((p nil "We" (a ((data-type . "indexterm") (data-primary . "code 
examples") (data-secondary . "downloading") (id . "idm45654236145288"))) (a 
((data-type . "indexterm") (data-primary . "online resources") (data-secondary 
. "code examples") (id . "idm45654236144280"))) (a ((data-type . "indexterm") 
(data-primary . "GitHub, code examples from") (id . "idm45654236143336"))) " 
can’t stress enough the importance of experimenta..."))
* shr-tag-body((body nil (p nil "We" (a ((data-type . "indexterm") 
(data-primary . "code examples") (data-secondary . "downloading") (id . 
"idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online 
resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a 
((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . 
"idm45654236143336"))) " can’t stress enough the importance of 
experimenta...")))
* shr-descend((body nil (p nil "We" (a ((data-type . "indexterm") (data-primary 
. "code examples") (data-secondary . "downloading") (id . 
"idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online 
resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a 
((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . 
"idm45654236143336"))) " can’t stress enough the importance of 
experimenta...")))
* shr-tag-html((html nil (body nil (p nil "We" (a ((data-type . "indexterm") 
(data-primary . "code examples") (data-secondary . "downloading") (id . 
"idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online 
resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a 
((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . 
"idm45654236143336"))) " can’t stress enough the importance of 
experimenta..."))))
* shr-descend((html nil (body nil (p nil "We" (a ((data-type . "indexterm") 
(data-primary . "code examples") (data-secondary . "downloading") (id . 
"idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . "online 
resources") (data-secondary . "code examples") (id . "idm45654236144280"))) (a 
((data-type . "indexterm") (data-primary . "GitHub, code examples from") (id . 
"idm45654236143336"))) " can’t stress enough the importance of 
experimenta..."))))
* #<subr shr-insert-document>((html nil (body nil (p nil "We" (a ((data-type . 
"indexterm") (data-primary . "code examples") (data-secondary . "downloading") 
(id . "idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . 
"online resources") (data-secondary . "code examples") (id . 
"idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, 
code examples from") (id . "idm45654236143336"))) " can’t stress enough the 
importance of experimenta..."))))
* apply(#<subr shr-insert-document> (html nil (body nil (p nil "We" (a 
((data-type . "indexterm") (data-primary . "code examples") (data-secondary . 
"downloading") (id . "idm45654236145288"))) (a ((data-type . "indexterm") 
(data-primary . "online resources") (data-secondary . "code examples") (id . 
"idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, 
code examples from") (id . "idm45654236143336"))) " can’t stress enough the 
importance of experimenta..."))))
* shr-insert-document((html nil (body nil (p nil "We" (a ((data-type . 
"indexterm") (data-primary . "code examples") (data-secondary . "downloading") 
(id . "idm45654236145288"))) (a ((data-type . "indexterm") (data-primary . 
"online resources") (data-secondary . "code examples") (id . 
"idm45654236144280"))) (a ((data-type . "indexterm") (data-primary . "GitHub, 
code examples from") (id . "idm45654236143336"))) " can’t stress enough the 
importance of experimenta..."))))
  shr-render-buffer(#<buffer test.xhtml>)
  funcall-interactively(shr-render-buffer #<buffer test.xhtml>)
  call-interactively(shr-render-buffer record nil)
  command-execute(shr-render-buffer record)
  execute-extended-command(nil "shr-render-buffer" "shr-re")
  funcall-interactively(execute-extended-command nil "shr-render-buffer" 
"shr-re")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)
#+end_example

The whitespace is inserted correctly. But after calling
`undo-auto--undoable-change()` I did see that the whitespace was removed in the
*html* buffer.

What is happening here?

Thank you!

--
Cheers Marcus (Nuremberg . Germany)
GnuPG Key: https://meta.sr.ht/~marcuskammer.pgp
Fingerprint: 86DB 0F30 F9F1 661A 54E2 1664 C374 817B E285 268F

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]