tmedwards / sugarcube-2

SugarCube is a free (gratis and libre) story format for Twine/Twee.
https://www.motoslave.net/sugarcube/2/
BSD 2-Clause "Simplified" License
177 stars 41 forks source link

``` ``` seems to be discarded by 2.37.0 alpha 17 #280

Closed selden closed 10 months ago

selden commented 11 months ago

Describe the bug. A "bare"   on a line by itself at the beginning of a paragraph seems to be ignored (or discarded) by 2.37.0 alpha 17.

To Reproduce: insert a   as the first line of a paragraph when paragraph indentation is enabled.

Expected behavior. The visible text of that paragraph should not be indented.

Screenshots. no_indent_2 36 indent_2 37

Project details.

Desktop details.

Smartphone/tablet details. n/a

Additional context.Background:

My IFs enable automatic paragraph indentation:

in "Story Javascript" they specify

Config.cleanupWikifierOutput = true;

and in "Story Stylesheet" they declare

.passage p {
       margin-left: 1.0em;
       margin-right: 1.0em;
       text-indent: 2.0em;
       }

When using 2.36.1, I can "disable" indentation on a case-by-case basis by specifying a non-breakable space   as the first line of text of a paragraph. The invisible space gets indented but the visible part of the paragraph is not.

This no longer works in 2.37.0 alpha 17. Instead, the visible text of the paragraph is indented.

If this feature cannot be easily restored, is there some other invisible character which can be used for the some purpose? (A global search-and-replace would be too difficult for me.)

The attached zip includes test_nbsp.tw and the corresponding html and images (as above) demonstrating the problem.

test_nbsp.zip

tmedwards commented 10 months ago

Frankly. What you were doing was abusing v2.36.1's substandard Config.cleanupWikifierOutput feature. While adjustments and fixes can be made if something is truly off with the new code, in general the new behavior is staying. Thus, your whitespace trick is not coming back.

That said. You can accomplish the same effect by switching to a non-hacky HTML tag-based solution. It should work in both v2.36.1 and v2.37.0. It also doesn't generate a unwanted extra line break as your old technique did.

HTML tag:

<hr no-indent>

Styles:

.passage p {
    margin-left: 1.0em;
    margin-right: 1.0em;
    text-indent: 2.0em;
}

hr[no-indent] {
    display: none;
}
hr[no-indent] + p {
    text-indent: 0;
}

Example:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nec enim interdum, commodo eros sit amet, interdum ex. Aliquam faucibus neque non libero dapibus aliquam. Nulla facilisi.

<hr no-indent>
Sed at rhoncus diam, sit amet commodo libero. Duis facilisis, dui varius fringilla consequat, purus urna tincidunt nulla, nec maximus elit nisi ut diam. Nulla aliquam ac erat et interdum.

Phasellus eu euismod velit. Proin placerat gravida lacus, ac tempus tortor volutpat quis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. 
selden commented 10 months ago

Thanks. That does seem a bit more reliable!

Selden


From: Thomas M. Edwards @.> Sent: Sunday, November 5, 2023 3:13:47 PM To: tmedwards/sugarcube-2 @.> Cc: Selden E. Ball, Jr @.>; Author @.> Subject: Re: [tmedwards/sugarcube-2] &nbsp; seems to be discarded by 2.37.0 alpha 17 (Issue #280)

Frankly. What you were doing was abusing v2.36.1's substandard Config.cleanupWikifierOutput feature. It was very, very hacky. While adjustments and fixes can be made if something is truly off with the new code, in general the new behavior is staying. Thus, your whitespace trick is not coming back.

That said. You can accomplish the same effect by switching to a non-hacky HTML tag-based solution. It should work in both v2.36.1 and v2.37.0.

HTML tag:


Styles:

.passage p { margin-left: 1.0em; margin-right: 1.0em; text-indent: 2.0em; }

hr[no-indent] { display: none; } hr[no-indent] + p { text-indent: 0; }

Example:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris nec enim interdum, commodo eros sit amet, interdum ex. Aliquam faucibus neque non libero dapibus aliquam. Nulla facilisi.


Sed at rhoncus diam, sit amet commodo libero. Duis facilisis, dui varius fringilla consequat, purus urna tincidunt nulla, nec maximus elit nisi ut diam. Nulla aliquam ac erat et interdum.

Phasellus eu euismod velit. Proin placerat gravida lacus, ac tempus tortor volutpat quis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

— Reply to this email directly, view it on GitHubhttps://github.com/tmedwards/sugarcube-2/issues/280#issuecomment-1793834013, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AACWNDAG2QRMTPRUMRE56DTYC7QOXAVCNFSM6AAAAAA657EK2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTHAZTIMBRGM. You are receiving this because you authored the thread.Message ID: @.***>