Hi,
I love XHTML formatting because it converts special characters into their hex value, curly quotes are the perfect example of this. My problem is that I want to use XHTML formatting without wrapping everything in a <p> because my content is being placed in an <li>. So right now I’m getting this:
<li><p>this is “content”</p></li>
and I’d like to get this.
<li>this is “content”</li>
Thanks
Mark
Update I’ve created a plugin that does just this, use it as follows {exp:strip_p}....{/exp:strip_p}
There are three ways I see to do this. One is sketchy but quick, the other takes moderate work on your part each time you make an entry that uses that field, and the last one takes more extensive effort—but only one time up front.
Sketchy: Open core.typography.php and near the very top, around line 30, you’ll see var $single_line_pgf = TRUE;. Change that to FALSE. The sketchy part is that you will have to keep up with this everytime you update, and it can’t be guaranteed that this change will always work for future builds. Also, that will affect all of your fields that use Auto-XHTML. You will have to manually add <p> tags to single lines of text when you want them.
Moderate: Turn formatting off for that field, and keep a chart handy for your character entities to replace special characters manually.
More Extensive: Create an extension that strips <p> tags from that field using the typography_parse_type_start hook.
That way it will pull the paragraph right up against the end of the content (in case there’s some tabs or spaces on the end). I’ll upload a newer version later today once I get a few more things straightened out with it.
with the ”/s” modifier the period (.) and space (\s) patterns will match newlines, while, like you said, without the ”\s” modifier they wouldn’t.
So, yes, it will match any whitespace (tabs, newlines, carriage returns, spaces, etc) in my example. I would recommend the ”\s” way only because on some systems it may not be a ”\n” it might be a ”\r”.
In the weblog:entries tag i use backspace=“28” to remove the last “divider”-div plus the preceeding spaces.
That works as expected. Only the trailing </p> that goes with {text_body{my_lang}} isn’t stripped, so i end up with an overload of </p> tags ...
If i remove the backslash it works as expected, but i’m stuck with a div too many ...
I was just about to mod Ricks <p> to <br> plug-in and cam across this. Very handy. Like Mark I need to strip paragraphs from around a custom field that I’m outputting into a list.