View Single Post
Old 09-16-2017, 07:21 PM   #9
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,937
Karma: 6361444
Join Date: Nov 2009
Device: many
The headings call GumboInterface:: get_local_text_of_node which will build up the local text of the node keeping any and all whitespace and that includes carriage returns and line feeds. The h2 node in your example:

Code:
<h2>One<br/>Chapter Title</h2>
has 3 children: a text node "One", an element node br, and a text node "Chapter Title" but since an element node like br has no text value in and of itself you end up seeing what you see.

We can try and detect br element child nodes and convert them to a space on to a newline in that routine instead. The Qt QString.simplified() call should then work properly to remove leading and trailing spaces but leave internal whitespace.
KevinH is offline   Reply With Quote