bibledit / cloud

Source code for Bibledit core library and Cloud binary
GNU General Public License v3.0
13 stars 3 forks source link

Formatting error in Web exports for chapters that start as poetry #905

Closed warpok closed 1 year ago

warpok commented 1 year ago

In chapters of Psalms, the chapter number overwrites the start of two lines.

Screenshot 2023-06-19 10 48 12 AM

I closed the other issue where I mentioned about wanting a line separating the footnotes from the body of the text in the web exports. If by any chance that could be taken care of in the process of fixing this issue, please do that.

teusbenschop commented 1 year ago

That looks no good.

aranggitoar commented 1 year ago

I'll look into this while working on the format of table exports in #860.

teusbenschop commented 1 year ago

Likely this is related to interference between the float: left of the chapter number, and the text-indent: -25.4mm of the poetry. I've been digging around to find a solution to this, but did not yet find a solution. Have you got any idea bro how to fix this?

warpok commented 1 year ago

How about a temporary fix, guys?

How about if the chapter number is placed above the first verse and any heading. The problem is that it is being formatted as a DropCap. The reason I request this is because I have to introduce weird formatting stuff to force the dropcap to the top for web exports, and they will be checking more chapters of Psalms soon. You could put it above any text on the left, or you could center it. Either would be fine.

Thanks!

teusbenschop commented 1 year ago

Perhaps a good idea to do so.

teusbenschop commented 1 year ago

In the mean time, editing the stylesheet might well help you too.

For example, style "q2" at https://bibledit.org:8091/styles/view?sheet=test&style=q2 has this

Screenshot 2023-09-07 at 17 04 43

The left margin is huge, and the first line indent is negative. This negative number causes the poetry to intrude into the chapter number. If the left marigin was made smaller, and the first line indent less negative, that already would give you a huge help in this area.

teusbenschop commented 1 year ago

Weird enough the study bible at https://ebible.org/study/, at the Psalms, also puts the chapter number on a separate line above the text, not as drop caps.

teusbenschop commented 1 year ago

How about if the chapter number is placed above the first verse and any heading. The problem is that it is being formatted as a DropCap.

This functionality is already available in Bibledit.

In the standard stylesheet, at the "c" style, the chapter number is set to be output at the first verse.

If this setting is changed, then an export to html or to web format no longer outputs the chapter number at the first verse, in drop caps. Instead it will output the chapter number above the text.

Screenshot 2023-09-08 at 20 06 14

The bug report was set to "invalid" because it is no bug.

warpok commented 1 year ago

Brilliant! That does solve the problem. I never thought to change the \c style! And you didn't suggest that until now. There is still a kind of a bug however. If people use the Standard stylesheet or other stylesheets meant for a format similar to most typeset Bibles, they will automatically get ugly formatting for chapters starting with poetry. Since few users will think to change the \c format for the web export, I think that this still qualifies as a bug.

warpok commented 1 year ago

By the way, I set the chapter number to be centered, but the web export still had the number on the left.

teusbenschop commented 1 year ago

There is still a kind of a bug however. If people use the Standard stylesheet or other stylesheets meant for a format similar to most typeset Bibles, they will automatically get ugly formatting for chapters starting with poetry. Since few users will think to change the \c format for the web export, I think that this still qualifies as a bug.

Yes, probably you are right, it is still a bug then.

A probable solution in CSS would be this:

.dropcaps::first-letter {
font-size: 300%; 
line-height: 0.85em; 
margin-right: 0.03em; 
margin-bottom:-0.25em;
vertical-align: top;
}

The result looks like this:

Screenshot 2023-09-09 at 17 19 28

teusbenschop commented 1 year ago

By the way, I set the chapter number to be centered, but the web export still had the number on the left.

Centering the text works over here:

Screenshot 2023-09-09 at 17 21 36

teusbenschop commented 1 year ago

The given CSS only handles chapter number 1 to 9 since it puts the first letter in drop caps.

The following bit of HTML and CSS would remediate that.

<!DOCTYPE html>
<html>
<head>
<style> 
.dropcaps:nth-of-type(1) {
  font-size: 300%;
}
.dropcaps:nth-of-type(2) {
  font-size: 300%;
}
.dropcaps:nth-of-type(3) {
  font-size: 300%;
}
</style>
</head>
<body>
<p><span class="dropcaps">1</span><span class="dropcaps">2</span><span class="dropcaps">3</span> Verse text.</p>
<p><span>1</span><span>2</span><span>3</span> Verse text.</p>
<p><span class="dropcaps">1</span><span class="dropcaps">2</span><span class="dropcaps">3</span> Verse text.</p>
</body>
</html>
teusbenschop commented 1 year ago

A new way of having a drop caps for the chapter number was devised.

See above for information about how it was implemented, generally, with slight changes.

Here is how it now looks:

Screenshot 2023-09-10 at 10 37 59

warpok commented 1 year ago

How do I install that? It looks quite nice!

warpok commented 1 year ago

Still using the centered chapter number for web export, the centering does work in the browser. However, the chapter number for chapter 1 doesn't show up. This seems so odd! All books don't display the first chapter number. Maybe I selected something I shouldn't have.

Screenshot 2023-09-11 185216
teusbenschop commented 1 year ago

How do I install that? It looks quite nice!

It is version 5.1.006 that has the update you would need.

This new version is now being built on Launchpad, and will be available as a regular update without an hour or so from now.

teusbenschop commented 1 year ago

Still using the centered chapter number for web export, the centering does work in the browser. However, the chapter number for chapter 1 doesn't show up. This seems so odd! All books don't display the first chapter number. Maybe I selected something I shouldn't have.

Over here there's the same problem too. That is weird indeed.

It looks like this is a bug, it needs further investigation.

The good thing is that in version 5.1.006, if the chapter numbers are output at the first verse, in drop caps, that this now works well again, also in poetry.

teusbenschop commented 1 year ago

Weird, I cannot reproduce the error of a missing chapter number.

Here is an export of the entire Sample Bible in Bibledit.

All books, those spot-checked, have their chapter number at the start of each chapter.

web.zip

If you may upload your USFM data, it could be checked, but weird it is.

teusbenschop commented 1 year ago

Okay, the bug, not print the chapter number in the first book, was reproduced and was fixed. The fixed version is version 5.1.007. An Ubuntu package for bibledit-cloud is available with that version number, with the fix.

warpok commented 1 year ago

I installed the new version: Bibledit 5.1.007 I edited the \c style. But the problem remains. It does look slightly better than before. This is viewing using the Chrome browser on my Chromebook. Screenshot 2023-09-15 7 33 50 PM

warpok commented 1 year ago

Screenshot 2023-09-15 7 38 31 PM

teusbenschop commented 1 year ago

The layout of the "34" is clearly from the previous stylesheet. Likely the Chrome browser still has the previous stylesheet in its cache. Empying the Chrome cache will load the new and updated stylesheet, with the fix. Likely this is the case.

warpok commented 1 year ago

You're right. Using another device, the chapter numbers in Psalms are in the right place. With the Chapter number at first verse setting, only one line is used for the Drop Cap. So actually it is no longer a drop cap. But for this web export it is fine. Chapter 1 shows the chapter number also.

Thanks so much for the detailed work on this improvement!