Problems with display formatting

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
rhibbert
Posts: 4
Joined: Sun Apr 09, 2006 4:23 pm

Problems with display formatting

Post by rhibbert »

I cannot get my blog entry to display properly. Tables have a vast space before them. I'm guessing that this is a problem with the CSS template (I am using the Blue Streak theme).

What do I need to do to fix this?

Thanks
--
Richard

**UPDATE**
I have tried various themes and they all have the same display problem. Hmmm...
Last edited by rhibbert on Tue Apr 11, 2006 3:52 am, edited 1 time in total.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Problems with display formatting

Post by garvinhicking »

Hi!

The problem is that you are using the "nl2br" markup plugin. This introduces a "<br />" after every whitespace you type -- including in HTML markup.

To solve this, you either need to disable the nl2br markup globally, or you need to type your HTML in one single row.

OR you can install the entryproperties plugin, and with this you can conditionally disable nl2br for specific entries.

OR you can patch the nl2br plugin so that it recognizes if it's within HTML code, and only applies nl2br functions outside of it. So far, nobody of us has succeeded with such a patch, because it's quite regExp intense. :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rhibbert
Posts: 4
Joined: Sun Apr 09, 2006 4:23 pm

Post by rhibbert »

I guess that nl2br is installed by default as all I installed was serendipity 1.0 beta2.
However, thanks for the pointer. I managed to resolve the issue by changing

<blockquote>
<table>
<tr>
<th>Parameter</th>
<th>Meaning</th>
</tr>
<tr>
<td>x</td>
<td>Extract files</td>
</tr>
<tr>
<td>z</td>
<td>Filter archive through gzip</td>
</tr>
<tr>
<td>v</td>
<td>Verbose output</td>
</tr>
<tr>
<td>f</td>
<td>Use archive file</td>
</tr>
</table>
</blockquote>

to a single line

<blockquote><table><tr><th>Parameter</th><th>Meaning</th></tr><tr><td>x</td><td>Extract files</td></tr><tr><td>z</td><td>Filter archive through gzip</td></tr><tr><td>v</td><td>Verbose output</td></tr><tr><td>f</td><td>Use archive file</td></tr></table></blockquote>

It looks like nl2br puts a linefeed before the table for every linefeed within the code for the table.

Thanks again. Out of interest, how would I disable nl2br?

--
Richard
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Yes, nl2br is a default plugin, because most users want to enter text straighly into the box without using HTML.

nl2br inserts \n<br /> linebreaks in between the HTML markup, but most browser render any usual code within <table> markup to appear BEFORE the <table>. :)

Disabling the plugin would take you to the s9y admin interface, then click on "Configure Plugins", on the right go to the listing of "event" plugins. Then look for the nl2br plugin, tick the box next to it, go below and click on "Delete". :)

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
rhibbert
Posts: 4
Joined: Sun Apr 09, 2006 4:23 pm

Post by rhibbert »

Thanks Gavin. Demon support! :D
hyperorbiter
Regular
Posts: 19
Joined: Thu Mar 30, 2006 3:58 am
Location: New Zealand

what do you do if you want <p> instead of <br>?

Post by hyperorbiter »

it would be useful if i could set this because my paragraph styles aren't working too well : all the paragraphs are rammed together and i wouldn't mind putting an indent in there or space between...thoughts?
i'm not cool enough to have a signature
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: what do you do if you want <p> instead of <br&g

Post by garvinhicking »

hyperorbiter: The s9y default CSS sets the "margin" of a "p" element to 0px, to ratify problems with inserting WYSIWYG pasted code.

You can edit your style.css stylesheet and remove this margin on the p element!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
hyperorbiter
Regular
Posts: 19
Joined: Thu Mar 30, 2006 3:58 am
Location: New Zealand

thanks for the suggestion but:

Post by hyperorbiter »

thanks garvin, but the issue is that the nl2br plugin converts paragraph endings into line breaks wihtin a paragraph, rather than actual paragraph breaks. i'd like them to be '<' p '>' rather than '<' br '>'
i'm not cool enough to have a signature
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: thanks for the suggestion but:

Post by garvinhicking »

Hi!

Ah, that won't work. <p> Tags are by definition double-tags. Using "<p>" alone is invalid HTML markup. You would need to wrap each line into a <p>...</p>, which nl2br does not support. So you would need to create your own plugin for this text transformation...

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
dogshed
Regular
Posts: 20
Joined: Tue Jul 18, 2006 3:54 pm

ending paragraph tag

Post by dogshed »

Since when is the ending paragraph tag not optional?

SGML allows you to make an ending tag optional and for many years it was in html. Did someone change that? -Jeff
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: ending paragraph tag

Post by garvinhicking »

Hi!
dogshed wrote:Since when is the ending paragraph tag not optional?
Since XHTML, which Serendipity is strifed for. Optional end tags were removed then, about 5 years ago. :-)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply