Mobileread
Two problems with splitting files
#11  DiapDealer 01-26-2021, 01:32 PM
Thanks, Kevin.
Reply 

#12  KevinH 01-26-2021, 02:24 PM
@BeckyEbook,

I looked at the SplitSection code and the actual split position is *not* included in the spilt (it grabs everything before that char) so I can check for the text[pos] == '<' and special case that in SplitSection so |<tag> would then work as a split point.
I will push that to master so you can try it and let us know if that works for you.

Kevin
Reply 

#13  KevinH 01-26-2021, 02:37 PM
@BeckyEbook
Okay just pushed that change. It appears to work to me.

I had it look like the following:

Code
<div>top</div>|<div>bottom</div>
with the cursor being represented by the '|' char and hit Split At Cursor.
I got back what I expected.

If this actually worked in Sigil 1.4.3 and earlier it was by accident.
Now it will make all earlier behaviour official.

Thanks for your bug reports!
Reply 

#14  BeckyEbook 01-26-2021, 05:37 PM
I had exactly this idea for solving the first problem, but the idea and the implementation in code are two different things.

Splitting works great now! Thank you, again.
I will try to do more tests in the near future.

BTW, your sample code from the previous post causes an unexpected side effect.
Paste this fragment and call Mend & Prettify several times:
Code
<div>top</div>|<div>bottom</div>
I know this is an incredibly rare situation, I report it as a curiosity.
Reply 

#15  DNSB 01-26-2021, 08:33 PM
Quote BeckyEbook
BTW, your sample code from the previous post causes an unexpected side effect.
Paste this fragment and call Mend & Prettify several times:
Code
<div>top</div>|<div>bottom</div>
I know this is an incredibly rare situation, I report it as a curiosity.
Cute. So no naked pipe symbols allowed.
Reply 

#16  KevinH 01-26-2021, 08:52 PM
Actually any naked text in the body tag, will make the prettify code I wrote a while back mess up a bit. Luckily the days of having text directly in the body tag should be pretty rare.

If for example you wrap that text "|" in any tag including a simple <span> the prettify should no longer add extra space that will never show up in the xhtml version.
Reply 

#17  KevinH 01-27-2021, 09:43 AM
I think I have a way to fix this without impacting anything else. I will give that a try.

Update:

Pushed a fix to master for repeated prettyprint of bare text in the body tag.
Reply 

#18  BeckyEbook 01-28-2021, 06:57 AM
If the file was previously "prettified" then the changes are subtle, in most files there is no difference. After applying "Mend & Prettify Code - All HTML Files", there was not even an asterisk next to the file name, which means that the command made absolutely no changes.

Unfortunately, it's not good. Because eg multiple spaces and line breaks in paragraphs remain in the code, which contradicts "prettification".

Bare text is less important than the one in paragraphs.
So although some elements of "prettification" may or may not be subjectively liked, it was better before.
Reply 

#19  KevinH 01-28-2021, 09:26 AM
Your latest suggested fix, seems to work properly. Where are you seeing problems still? Please provide a specific example and what you expected to see but do not?

Please remember multiple newlines and multiple spaces are ignored by Preview so whitespace and breaks are added to make the code itself more readable but should not impact what is seen in Preview in any way.
Reply 

#20  KevinH 01-28-2021, 12:12 PM
Given your change, the only way multiple spaces can exist inside a paragraph is because they are wrapped in non-structual tags, so perhaps we need to add "is_inline" to your change as they used to be the only ones not being condensed that were previously.

I will give that a try.

Actually p tags are part of the Other_text_holders class. So that would not help.

So I am going to stop restricting things and only test for keepwhitespace or not when deciding to condense text.

I will push that for testing.


Kevin
Reply 

 « First  « Prev   (2/2)
Today's Posts | Search this Thread | Login | Register