changes proposed to book and website

J. Greenlees lists at
Fri Jun 20 05:10:17 PDT 2008

With all the discussion to the direction of LFS, and to the book(s) 
including changes to the website itself, I wound up running across a 
nice little function that will help with the changes needed for the 
website if these suggestions are implemented.

I attached a text file that is actually a php function to convert a text 
file to an html page.
Since it does need alteration to make a page that would validate, such 
as adding proper headers and meta tags it isn't perfect, yet.

I prefer to work with paragraph tags myself, so I went looking and found 
the function below.

> |Simple function that converts more than one <br>,<br/>,<br />... to a 
> <p></p>. Maybe it's useful for someone =)
> function br2p($string)
> {
>   return preg_replace('#<p>[\n\r\s]*?</p>#m', '', 
> '<p>'.preg_replace('#(<br\s*?/?>){2,}#m', '</p><p>', $string).'</p>');
> }
> Useful used with nl2br:
> br2p(nl2br(...));| is where I found it, in 
the user comments.

The file and the br2p function would be useful in Jeremy's modular book 
script if the book is migrated back to plain text, as Robert suggested 
doing. This would then also make the reading online of the book easily 
kept current with the text files used to publish for the custom book.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: text to html php script.txt
URL: <>

More information about the website mailing list