On this page... (hide)
Overview
Addon Authors: plushpuffin and Parahead
Version: build 2
Last Release Date: January 21, 2005
Works with: Tested with Coranto v1.24
Available at: Paraheadīs Coranto Corner
Linebreaks and Coranto
In a multi-line text box, like the one used for the main input area on the Coranto submit news page, each time you press the return key on the keyboard Coranto converts this to either <br> or <br />. You can disable this for any multi-line text box on the settings page. In this case the effect is that any newlines entered disappear and when you go back to edit the item it will all be run together on one line.
Most of the time the substitution of the <br> or <br /> for a newline is the desired behavior. If you want to enter html or any other text that you want preserved exactly as entered this behavior is a problem.
If you have the convert newlines setting off for a multi-line text field the html for a list that you enter as:
<ul>
<li>Item One</li>
<li>Item Two</li>
<li>Item Three</li>
</ul>
Will look like this:
<ul> <li>Item One</li> <li>Item Two</li> <li>Item Three</li> </ul>
When you attempt to edit it. If this were a longer list or a complicated html table editing becomes difficult.
Prisoner's Dilemma
Prisoner's Dilemma is an addon that allows to keep using the multi-line text boxes on your submit pages as you normally would and to enter formatted code without the <br> or <br /> tag being added.
It does this by adding two new formatting tags for you to use. They are:
<BRESCAPE> and </BRESCAPE>
They look like this in action:
Text here.
Another line of text here.
Sample address
12345 Maple St.
Somewhere, IN 12345
<BRESCAPE>
<ul>
<li>Item One</li>
<li>Item Two</li>
<li>Item Three</li>
</ul>
</BRESCAPE>
More lines
of text here
and here
The list of items between the <BRESCAPE> tags will keep the linebreaks, but Coranto will not add the <br> or <br /> tag at the end of each line preventing errors in your html.
Required Settings
For this to work as described above you need to have the settings for the multi-line text field set as follows:
Disable HTML? NO
Convert Newlines? YES
You can find these settings at:
Administration -> Edit News Fields -> Edit (under the desired field)
Other Considerations
Valid HTML
The default Text field in Coranto will be wrapped in <p></p> tags when your news is built. This will cause your html to be invalid when you include an <ul> or a <table> in you input. So to keep the html valid the example above should look like this:
Text here.
Another line of text here.
Sample address
12345 Maple St.
Somewhere, IN 12345
<BRESCAPE>
</p> (close the opening paragraph tag Coranto inserts)
<ul>
<li>Item One</li>
<li>Item Two</li>
<li>Item Three</li>
</ul>
<p> (open a new paragraph to match the end tag Coranto will insert)
</BRESCAPE>
More lines
of text here
and here
The </p> (end paragraph) and <p> (start paragraph) in the above example will result in valid html.
Using <br> tags
Between the <BRESCAPE> tags you can insert <br> or <br /> tags wherever you need them and they will be preserved when saved and be displayed when the item is edited.
Further Reading
Addon Release: Prisoner's Dilemma, build 2
Addon Requests ~ Prisoner's Dilemma request
You can leave comments using this form.
