12-06-2023, 02:51 AM | #166 |
Witchman
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 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>
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. |
12-06-2023, 09:09 AM | #167 | |
A Hairy Wizard
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:
|
|
Advert | |
|
12-06-2023, 11:28 AM | #168 |
Guru
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> 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> 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. |
12-06-2023, 02:06 PM | #169 |
Bibliophagist
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. |
12-07-2023, 12:18 PM | #170 | |
Evangelist
Posts: 417
Karma: 6913952
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe
|
Quote:
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. |
|
Advert | |
|
12-08-2023, 07:22 PM | #171 |
Witchman
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. |
12-08-2023, 07:32 PM | #172 |
Sigil Developer
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. |
12-08-2023, 08:01 PM | #173 |
Witchman
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>
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. |
12-08-2023, 08:03 PM | #174 |
A Hairy Wizard
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.} I'm not the only one out there that does this, either. I have come across many books that use descendant combinator classes. Cheers! |
12-08-2023, 08:26 PM | #175 |
Witchman
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. |
12-08-2023, 09:11 PM | #176 |
Bibliophagist
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> Code:
<p>This is a test<span class="italic"/>for <span class="italic">spaces</span> inside a tag.</p> Last edited by DNSB; 12-08-2023 at 09:16 PM. |
12-08-2023, 10:01 PM | #177 |
Witchman
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. |
12-08-2023, 11:04 PM | #178 |
Witchman
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. |
12-08-2023, 11:15 PM | #179 | |
Bibliophagist
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:
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. |
|
12-08-2023, 11:23 PM | #180 |
Bibliophagist
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> |
|
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 |