MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   ePub (https://www.mobileread.com/forums/forumdisplay.php?f=179)
-   -   Problem adding extra lines in text (https://www.mobileread.com/forums/showthread.php?t=331195)

andy9279 07-02-2020 11:31 AM

Problem adding extra lines in text
 
I am trying to edit an epub in Sigil before I use Calibre to remove spaces between paragraphs. Normally I don't have a problem doing this, but either Calibre adds space between paragraphs I do not want, or it removes the space between scenes inside of paragraphs I would like to maintain.

I would like to add something like this ***** between scene breaks inside of chapters where there's currently a space, or add multiple spaces, or something. But when I try to edit it in Sigil I see this command, not at the END of the paragraph where the scene break is, but at the start of the paragraph that will have the break at the end of it...

<p class="Normal-space-after">

Is there some way to search and replace all of these into something like, just as an example...

<p class="Normal-*****-after">

I know I cannot do this of course, but I think you get the idea.


Thank you for any help,
Andy

KevinH 07-02-2020 01:44 PM

This really has nothing to do with Sigil or Calibre. Please ask your question in the Epub forum instead since it has to do with basic css.

Turtle91 07-02-2020 01:44 PM

dang it - Ninja'd again...


There are a lot of things that Calibre can do, but you certainly don't need to switch to it for simple spaces between lines.

One thing I think you may be getting confused about... Sigil can 'clean up' the display of your code so that it looks nice on the screen. This has zero effect on your epub. ePub readers/apps ignore blank space between the html tags like <p></p><p> etc. The tidying up that Sigil does just makes it easier to see your code and work on it. If you really don't like it doing this, you can go into Sigil's preferences and turn off the feature. I'm pretty sure it is default to run on open and on save. I personally have both of them turned off and then just right click on a file when I want to use this feature.

As a matter of style - it really makes book makers shudder if there are any blank/empty paragraphs just to create space between paragraphs like this:
Code:

<p>This is a normal paragraph.</p>
<p></p>
<p>This is a normal paragraph with space before and after.</p>
<p></p>
<p>This is a normal paragraph.</p>

It is much better to put your desired spacing in the css file.

eg.
Code:

.spacing {margin:2em 0}

<p>This is a normal paragraph.</p>
<p class="spacing">This is a normal paragraph with space before and after.</p>
<p>This is a normal paragraph.</p>

-- and don't forget to link your css file to your html files...

In your case, where you want to add asterisks to make a scene break, I would just put the asterisks in its own <div> and use css to style it however you want.

Code:

.SceneBreak {margin:2em auto; text-align:center; letter-spacing:1.5em}

<p>This is a normal paragraph.</p>
<div class="SceneBreak">*****</div>
<p>This is a normal paragraph after a scene break.</p>
<p>This is a normal paragraph.</p>

Be aware, also, that there is another discussion going on, in this thread, about the accessibility standards recommend using an <hr class="SceneBreak" /> to make your ePub more compliant.

As for a way to search and replace you can try the following regex. Caution: make a backup of your file, and don't use 'replace all' until you are sure the pattern is working for you.

find: <p class="Normal-space-after">(.*?)</p>
replace: <p>\1</p>\n<div class="SceneBreak">*****</div>

Cheers!

DiapDealer 07-02-2020 02:59 PM

Prettify in Sigil has been a manual, opt-in-only process for quite a while now. You can turn off Mend on open/save, but there's no prettifying being done unless you right-click in Code View and manually do it.

Turtle91 07-02-2020 03:08 PM

hmmm....I thought they were both combined. Maybe I'm thinking that they did both 'cuz when you right click in Code View it does both??

andy9279 07-02-2020 03:24 PM

Thank you Turtle91! Using those commands and finding the right tags to replace I was able to figure it out.

It was a little confusing because in some epubs the paragraph BEFORE the scene break has the tag signifying a break, and in others it is the paragraph following it, but by changing around the Regex commands around it has worked with all the files I've needed to edit.

Thanks!

DiapDealer 07-02-2020 04:32 PM

Quote:

Originally Posted by Turtle91 (Post 4007048)
hmmm....I thought they were both combined. Maybe I'm thinking that they did both 'cuz when you right click in Code View it does both??

You have the choice of "Mend", or "Mend and Prettify" when right-clicking in Code View (both for the current file or for all files). But the Mend on Open/Save preference settings are just that: Mend only. Prettify only happens when you manually do it.

Mend only attempts to fix malformed xhtml. I myself haven't found a good reason to NOT leave both Mend on Open and Mend on Save enabled for a long, long time now. *shrug*

Too much more of this, and I'll have to move the thread back to the Sigil forum! :D

Tex2002ans 07-02-2020 06:15 PM

Quote:

Originally Posted by Turtle91 (Post 4007016)
Be aware, also, that there is another discussion going on, in this thread, about the accessibility standards recommend using an <hr class="SceneBreak" /> to make your ePub more compliant.

For scene breaks, best to just Keep It Simple Stupid (KISS) with centered asterisks. See my 2019 post in "Why is it so hard to preserve blank lines?"

JSWolf 07-02-2020 07:31 PM

If my padding-top: 2em fails, then the program in used is not just garbage, but a garbage dump.

DiapDealer 07-02-2020 07:35 PM

So helpful, Jon. :rolleyes:

JSWolf 07-03-2020 06:47 AM

Quote:

Originally Posted by DiapDealer (Post 4007143)
So helpful, Jon. :rolleyes:

It is being suggested to use something like asterisks instead of blank space. In case the program doesn't render the blank space correctly. If the program won't render the blank space correctly, then the program is not worth using and it's time to find one that will work.

Jellby 07-03-2020 07:20 AM

Just to add to the confusion: some print books use spacing as "scene break", but if the scene break happens to fall at a page boundary, it is marked with an asterism of some sort. This makes the reader aware that there is a scene break, something that would be easily missed if it was only marked with spacing/indent.

1. Has this been successfully done in ePub books?

2. Since I believe it cannot be reliably done, I prefer to always use asterisms. Sure, extra spacing can be enforced, but it's easy to miss at the top/bottom of a page.

3. Unfortunately, it makes too many ebook conversions to "exactly" match the print version and have two kinds of scene breaks: with spacing and with asterism. It looks like they have different meanings, but they have not!

JSWolf 07-03-2020 07:41 AM

Quote:

Originally Posted by Jellby (Post 4007336)
Just to add to the confusion: some print books use spacing as "scene break", but if the scene break happens to fall at a page boundary, it is marked with an asterism of some sort. This makes the reader aware that there is a scene break, something that would be easily missed if it was only marked with spacing/indent.

1. Has this been successfully done in ePub books?

2. Since I believe it cannot be reliably done, I prefer to always use asterisms. Sure, extra spacing can be enforced, but it's easy to miss at the top/bottom of a page.

3. Unfortunately, it makes too many ebook conversions to "exactly" match the print version and have two kinds of scene breaks: with spacing and with asterism. It looks like they have different meanings, but they have not!

2. Empty space can be reliably done. I use padding-top: 2em and that works even if the section/scene break falls at the bottom/top of the screen. Plus, you should have the first paragraph of the new section be non-indented. Using margin-top: 2em is not reliable and doesn't work for the bottom/top of the page.

Jellby 07-03-2020 09:13 AM

I'm not talking about reliable spacing, but about reliably replacing the spacing with asterisms when at a page border.

DiapDealer 07-03-2020 09:18 AM

Jon's stuck on the failure of margin-top to be reliably honored by all rendering engines for the time being. So he'll be incapable of discussing anything else. ;)


All times are GMT -4. The time now is 10:50 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.