Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 12-06-2023, 02:51 AM   #166
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
@DNSB. . .Thanks for that, I think I see the reason for your spacing problem now.

In your example, you are initially running the plugin with this html code in your epub:

Code:
<body>
  <p>This<i> </i>is<i> </i>an<i> </i>italic<i> </i>sentence.</p>
</body>
And what you've done is surround each horizontal space in your example text like this:<i> </i>. Why on earth have you done that? Why have you tried to italicize all the blank spaces in your sentence? There will be no effect in other words because you cannot italicize a horizontal blank space, right? And as well, no one would ever try to italicize a blank space like that because it would have no effect at all!

. . . And the reason the blank spaces in your example text are disappearing and your text is joined is because the plugin also automatically converts all <i> </i> tags to <span> tags like this:

Code:
<body>
  <p>This<span style="font-style: italic;"> </span>is<span style="font-style: italic;"> </span>an<span style="font-style: italic;"> </span>italic<span style="font-style: italic;"> </span>sentence.</p>
</body>
. . . And then, later on in the plugins' run, it automatically removes all empty <span></span> tags containing no text as well as removing </span> </span> tags that only contain blank spaces, which leaves all the text in your example joined without spaces. And all that is correct behaviour for the plugin because no one in their right mind would ever seriously try to italicize the blank horizontal spaces in their published ebook, right?

If you were to initially and correctly italicize the whole of your example sentence, it would do it like this:

Code:
<body>
  <p><i>This is an italic sentence.</i></p>
</body>


. . . And after running the plugin you would get this:

Code:
<body>
  <p><span style="font-style: italic;">This is an italic sentence.</span></p>
</body>

Last edited by slowsmile; 12-06-2023 at 03:30 AM.
slowsmile is offline   Reply With Quote
Old 12-06-2023, 09:09 AM   #167
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Hi slowsmile. I think DNSB is aware that is not the correct use of <i> </i>. He stated that a program an author uses put it in there. He was using your plug-in to clean it up and your plug-in had the side effect of removing all the spaces.

Quote:
I ran into a rather odd glitch. One author that I do so work with changed the program they used to generate ePubs. One result is the misuse of <i> tags.
Personally, I would just check for spaces in everything: <i> </i>, <b> </b>, <em> </em>, <strong> </strong>, <span> </span> and replace it with a space before running the delete empty spans routine.
Turtle91 is offline   Reply With Quote
Advert
Old 12-06-2023, 11:28 AM   #168
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 692
Karma: 2180740
Join Date: Jan 2017
Location: Poland
Device: Misc
@slowsmile:

That's how I read this discussion and maybe I'll add my two cents.
I really often get files to correct/clean up where the text can look like this:
Code:
  <p><em>This</em><em> </em><em>is</em><em> </em><em>an</em><em> </em><em>italic</em><em> </em><em>sentence.</em></p>
If I had used option Convert <i>, <b>, <em, <u>, <s> and <strong> tags to span styling. I would have got a nasty surprise:
Code:
<p><span style="font-style: italic;">This</span><span style="font-style: italic;">is</span><span style="font-style: italic;">an</span><span style="font-style: italic;">italic</span><span style="font-style: italic;">sentence.</span></p>
...which in the preview looks like this:

Code:
Thisisanitalicsentence.

Of course, the text should be cleaned before cleaning by this plugin, but – as I have shown in the example – the danger of 'messing up' the text nevertheless exists.
BeckyEbook is offline   Reply With Quote
Old 12-06-2023, 02:06 PM   #169
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
@Turtle91: Unfortunately, the removing empty whatever seems to run even if I have no options selected.

@BeckyEbook: Pretty much what I am seeing where the non-empty <i> </i> string is being converted to a <i/> string.

Once I realized what was happening, I modified my workflow to find <i>, <b>, <em>, </strong>, <span>, etc. tags with only whitespace and change them to a space. This happens with any tags enclosing 1 or more spaces as if the convert whitespace to a single space doesn't stop when a single space remains.

I am wondering is this is related to the earlier issue when a span without a class was being removed.
DNSB is offline   Reply With Quote
Old 12-07-2023, 12:18 PM   #170
nabsltd
Evangelist
nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.
 
Posts: 417
Karma: 6913952
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe
Quote:
Originally Posted by slowsmile View Post
as well as removing </span> </span> tags that only contain blank spaces
Why on earth would you remove the span tag and the content inside it?

First, you have the problem this post points out...if the only content inside the tag is whitespace, your plugin is removing it. And, the problem is that there are commercial EPUBs formatted in this way.

Second, there could be valid reasons to wrap whitespace in a formatting tag...changing the background color, etc.
nabsltd is offline   Reply With Quote
Advert
Old 12-08-2023, 07:22 PM   #171
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
@nabsltd . . . I don't think that you have fully understood what I've said. When I say that my plugin "removes empty spans" I mean that it removes all span tags that have no attributes. See example below:

<p class="P1"><span>This is an example of a span tag that does nothing.</span></p>

And after my plugin is run the span tags are removed and the line will look like this:

<p class="P1">This is an example of a span tag that does nothing.</p>

. . . In the above example the span tags contains no attributes like classses or ids and therefore they contribute nothing to the styling of the text and can therefore be removed without causing any problems. This is what I mean when I say that my plugin automatically removes "empty spans". They are referred to as empty because they contain no attributes.

Last edited by slowsmile; 12-08-2023 at 07:28 PM.
slowsmile is offline   Reply With Quote
Old 12-08-2023, 07:32 PM   #172
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: 7,645
Karma: 5433388
Join Date: Nov 2009
Device: many
FWIW,

You can use css descendant combinator classes to actually style your example span:

p.P1 span {
}

or

p.P1 > span {
}

so you can safely only remove "empty spans" if there are no css combinator selectors involving spans.

This also holds true when javascript can be used to style as well.

So you might want to warn people to verify that they are not using "empty spans" in those ways first, to be safest.

Last edited by KevinH; 12-08-2023 at 07:34 PM.
KevinH is offline   Reply With Quote
Old 12-08-2023, 08:01 PM   #173
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
@BeckyEbook , , . Well, quite honestly, if you try to convert this to span tags:

Code:
<p><em>This</em><em> </em><em>is</em><em> </em><em>an</em><em> </em><em>italic</em><em> </em><em>sentence.</em></p>
. . . You will always get a mess because the <em> </em> tags have been incorrectly applied i.e. the tags should never straddle just a blank space. All this plugin feature does is convert all <i>, <b>, <em>, <u> etc code to its span equivalent code using inline styling and that's it. It's not meant to fix mistakes in code or bad code, but it is meant to make your epub code compliant to the epub standard.

A way out for you -- and you probably do this already anyway is my guess -- would be to remove all redundant and unnecessary <em> </em> tags in one swoop using Sigil's search and replace thus:

Search for:"<em> </em>"
Replace with: " "(a space)

Last edited by slowsmile; 12-08-2023 at 08:37 PM.
slowsmile is offline   Reply With Quote
Old 12-08-2023, 08:03 PM   #174
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
I know we've had this conversation before, but I wanted to add my to KevinH's comment.

I (almost always) use "empty spans" when styling with descendant combinator classes. These are very specifically defined and do not need any ID or CLASS to determine the styling. For example:

Code:
<h3>Chapter 1 <span>Chapter Title</span></h3>

h3      {bold,center, yadda yadda}
h3 span {display:block, center, italic, font-size/font family, yadda}

-OR-

<div class="char">
 <p>some stuff</p>
 <p>some more stuff <span>extra info to be differentiated from main 
    line</span></p>
</div>

div.char      {margin,border, whatever}
div.char p    {basic paragraph style in this div}
div.char span {display:block, font-variant, bold...etc.}
Could I add a class to define it? Sure. But I don't have to. It's perfectly legal and unambiguously defined so there is no need to add "bloat" to the code.

I'm not the only one out there that does this, either. I have come across many books that use descendant combinator classes.

Cheers!
Turtle91 is offline   Reply With Quote
Old 12-08-2023, 08:26 PM   #175
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
@KevinH & @Turtle91 . . . OK that makes sense and I'm convinced. So I'll just take out the automatic removal of empty spans in the plugin for the next coming release.

Last edited by slowsmile; 12-08-2023 at 08:37 PM.
slowsmile is offline   Reply With Quote
Old 12-08-2023, 09:11 PM   #176
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Would empty spans also include <span class="foobar"> <i class="foobar">, <b class="foobar">, etc. with only spaces enclosed? Sample below was tested with 1 to 28 spaces with the same output.

Code:
<p>This is a test<span class="italic">     </span>for <span class="italic">spaces</span> inside a tag.</p>
after running CustomCleanerPlus comes out as:

Code:
<p>This is a test<span class="italic"/>for <span class="italic">spaces</span> inside a tag.</p>
It doesn't seem to matter how many spaces are inside the tags, they all get removed. Almost as if the code is supposed to remove multiple spaces and then doesn't stop at a single space.

Last edited by DNSB; 12-08-2023 at 09:16 PM.
DNSB is offline   Reply With Quote
Old 12-08-2023, 10:01 PM   #177
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
@DNSB . . .I'll just reiterate what I said in my post to @BeckyeBook, which was that surrounding empty spaces in html text with <i>, <b>, <em> tags etc is the wrong way to do it and is therefore a user coding error. I also said that the plugin is meant to try and make the epub compliant -- however, the plugin was never meant to automatically fix bad html code.

Last edited by slowsmile; 12-08-2023 at 10:12 PM.
slowsmile is offline   Reply With Quote
Old 12-08-2023, 11:04 PM   #178
slowsmile
Witchman
slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.slowsmile ought to be getting tired of karma fortunes by now.
 
Posts: 628
Karma: 788808
Join Date: May 2013
Location: Philippines
Device: Android S5
Update: v0.5.5

-- Fixed a problem where the preselected saved option for the Remove empty spans option was not working correctly.

This fixed problem has nothing to do with the current discussion above. Again I reiterate that the Remove empty spans option has always been selectable. So if you don't want to use that option then don't select it. And for reference, the Remove empty spans option is the very last list item in the second plugin dialog.

Last edited by slowsmile; 12-08-2023 at 11:14 PM.
slowsmile is offline   Reply With Quote
Old 12-08-2023, 11:15 PM   #179
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by slowsmile View Post
Update(v0.5.5)

-- Fixed a problem where the preselected saved option for the Remove empty spans option was not working correctly.

This fixed problem has nothing to do with the current discussion above. Again I reiterate that the Remove empty spans option has always been selectable. So if you don't want to use that option then don't select it.
Unfortunately, the Remove empty spans option removes the span tags and leaves the content as I remember when I originally complained about <span> being removed since the span was given a default style defined in the CSS stylesheet.

The issue I'm seeing is that whether the span or other tag has a class, if it is enclosing spaces, the spaces are entirely removed but the tag is left.
DNSB is offline   Reply With Quote
Old 12-08-2023, 11:23 PM   #180
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 35,464
Karma: 145525534
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Forma, Clara HD, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Installed 0.55 and here's the results with no options selected:
Code:
<p>This is a test<span class="italic"> </span>for<span class="italic"> spaces </span>inside a tag.</p>

<p>This is a test<span class="italic"> </span>for<span> spaces </span>inside a tag.</p>

Code:
  <p>This is a test<span class="italic"/>for<span class="italic"> spaces </span>inside a tag.</p>

  <p>This is a test<span class="italic"/>for<span> spaces </span>inside a tag.</p>
DNSB is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[FileType Plugin] YVES Bible Plugin ClashTheBunny Plugins 27 01-16-2023 01:25 AM
Problem with my ScrambleEbook plugin and the Plugin Updater tool jackie_w Development 14 01-19-2017 10:49 PM
Plugin not customizable: Plugin: HTML Output does not need customization flyingfoxlee Conversion 2 02-24-2012 02:24 AM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM
New Plugin Type Idea: Library Plugin cgranade Plugins 3 09-15-2010 12:11 PM


All times are GMT -4. The time now is 08:55 AM.


MobileRead.com is a privately owned, operated and funded community.