[pmwiki-users] Single Space breaks wrap on entire page

Patrick R. Michaud pmichaud at pobox.com
Tue Sep 20 20:08:17 CDT 2005


On Tue, Sep 20, 2005 at 01:58:13PM -1000, Sivakatirswami wrote:
> Yesterday, someone pasted a huge travel Itinerary from an MS Word doc  
> into a wiki page.
> 
> Somewhere down the page there was a single long paragraph with a  
> space in front of the first word... This caused *all* lines on the  
> entire page, even lines preceding that paragraph, to not wrap.
> 
> Luckily I had solved this problem in another wiki and found the code  
> I used last year:
> 
> Markup('^ ', 'block',
>          '/^(\\s+)(.*)$/e',
>          "'<:pre,1>$1'.wordwrap(PSS('$2'), 40, '\n$1')");
> 
> which solves the problem.
> 
> But, this still seems like a bug to me... should not only that one  
> paragraph with the space in front not wrap? Why all lines on the  
> entire page? Even those preceeding the "pre" paragraph?

Wrapping isn't something that PmWiki does, it's a function of the
browser, the skin, and the semantics of HTML's "box model" for controlling
layout.  

In the absence of any specific width information, text lines that 
wrap do so up to the width of the container of those lines, and the 
width of the container is generally at least as wide as the widest
item within it.

So, if there's a really long preformatted text line, the container
ends up being as wide as the line, and all other wrapping lines
do so at the width of the container.  (If the <pre> line is the widest
element, then none of the other lines wrap simply because they never
hit the right margin.)

The only way I know to avoid this is to explicitly force <pre>
sections to wrap at a certain point (as you've done), or to
do various CSS tricks that don't work in all browsers.

If anyone has any other suggestions, I'm open for them.  :-)

Pm




More information about the pmwiki-users mailing list