Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

OCD Driving me crazy with line breaks SugarCube2.X

Okay, so I have a bit of code that is a pretty standard <<if>> macro. It plays out something like this.

<<if $Theother is 1>>
Slect your character's thing.
* This <<radiobutton "$PC.thing" 0>>
* That <<radiobutton "$PC.thing" 1>>
* The Other <<radiobutton "$PC.thing" 2>>
NextPlace
<<elseif $Theother is 0>>
Select your character's thing.
* This <<radiobutton "$PC.thing" 0>>
* That <<radiobutton "$PC.thing" 1>>
NextPlace
<<endif>>

Everything works as intended. Except the blank spaces. If $Theother is 0, an extra blank line appears above "Select your character's thing", where as if $Theother is 1, it isn't there. I tried using <<nobr>><<endnobr>> but that messes up the line breaks I actually do want for the radio buttons. And you can't separate an <<if>> statement from it's closing <<endif>> either. I guess what I am really asking here is is there a way to force a line break within a <<nobr>><<endnobr>>

I apologize if this was asked already. I didn't really no how to word what I was trying to say in a search box and it make sense.

Comments

  • edited June 2015
    What about write it all on one line and use <br> or <p> tags to force a line break.

    E.g.

    <<elseif $Theotheris 0>><p>Select your character's thing.</p>

    or

    <<elseif $Theotheris 0>><br>Select your character's thing.

    In general, use of <p>paragraph text</p> tags to activate line breaks is how HTML is "supposed" to be written. Carriage returns (enter) can introduce problems.
  • That certainly solves the uneven lining. However it does add an extra line between each option. Cures my OCD, but kind of plays with the format in a way I didn't expect. Using just <br> doesn't really help at all, adding an extra line up top still. <p></p> makes everything even. I suppose this will have to do. Thanks for the help.
  • You can define the line spacing between <p> in your css if you want to reduce it.
  • Claretta wrote: »
    You can define the line spacing between <p> in your css if you want to reduce it.

    Right >.< CSS. I should have realized that. Thanks again.
  • You could simply use the line continuation markup (\) after the <<if>>/<<elseif>> clauses. For example:
    <<if $Theother is 1>>\
    Select your character's thing.
    * This <<radiobutton "$PC.thing" 0>>
    * That <<radiobutton "$PC.thing" 1>>
    * The Other <<radiobutton "$PC.thing" 2>>
    [[Continue|NextPlace]]
    <<elseif $Theother is 0>>\
    Select your character's thing.
    * This <<radiobutton "$PC.thing" 0>>
    * That <<radiobutton "$PC.thing" 1>>
    [[Continue|NextPlace]]
    <</if>>
    
    Alternatively, you could try the config.cleanupWikifierOutput configuration property.
  • You could simply use the line continuation markup (\) after the <<if>>/<<elseif>> clauses. For example:
    <<if $Theother is 1>>\
    Select your character's thing.
    * This <<radiobutton "$PC.thing" 0>>
    * That <<radiobutton "$PC.thing" 1>>
    * The Other <<radiobutton "$PC.thing" 2>>
    [[Continue|NextPlace]]
    <<elseif $Theother is 0>>\
    Select your character's thing.
    * This <<radiobutton "$PC.thing" 0>>
    * That <<radiobutton "$PC.thing" 1>>
    [[Continue|NextPlace]]
    <</if>>
    
    Alternatively, you could try the config.cleanupWikifierOutput configuration property.

    Oh wow. That is much stupid easier. I knew it had to be something small. Thanks to @Claretta anyway, but this is exactly what I was looking for.
Sign In or Register to comment.