After my last problem prompted so fast (and helpful) a response, I thought I'd ask here about the proper use of the #TEXTE.
I'm working on another SPIP based site and have seen some behaviour that surprised me (and we all know about the principle of least surprise): the type of output I get from #TEXTE seems to depend on the content. If the article contains more than one block level element (paragraph, heading, etc.) then #TEXTE gives me back some HTML that fits nicely into my template. If, however, the article contains a single paragraph of text, #TEXTE gives me some bare text which I need to wrap with <p>'s. I can use the `paragrapher` filter to make it work properly but I find the need to do so unusual (given my experiences with markdown and textile).
Now the question: can someone explain the reason for this behaviour (or if it is just a bug)?
this is not a bug, but I recognize that it's quite disturbing :
The basic idea is that we don't know wich usage will be used with some
text fields like #PS, etc..
Sometime the use of <p> would break templates where #PS must contain
one line only.
The 'paragrapher' filter enables to force the use of <p> even if it's
a one paragraphe-only content.
Historically, this behaviour already existed before this filter was
created to solve situations like yours. When the problem was
discussed, it was decided not to break the existing templates. That's
why it was decided not to change the default treatment.
.Gilles
---
On Nov 5, 2007 3:49 AM, Thomas Sutton <thomas@bouncingorange.com> wrote:
Hi all,
After my last problem prompted so fast (and helpful) a response, I
thought I'd ask here about the proper use of the #TEXTE.
I'm working on another SPIP based site and have seen some behaviour
that surprised me (and we all know about the principle of least
surprise): the type of output I get from #TEXTE seems to depend on
the content. If the article contains more than one block level
element (paragraph, heading, etc.) then #TEXTE gives me back some
HTML that fits nicely into my template. If, however, the article
contains a single paragraph of text, #TEXTE gives me some bare text
which I need to wrap with <p>'s. I can use the `paragrapher` filter
to make it work properly but I find the need to do so unusual (given
my experiences with markdown and textile).
Now the question: can someone explain the reason for this behaviour
(or if it is just a bug)?
personally, I never understood that behaviour, but as Gilles says, it stayed in SPIP to keep a backward compatibility with older templates and sites.
If you know all the #TEXTE tags should went through the |paragrapher filter, then you can add the line:
$table_des_traitements['TEXTE'] = "paragrapher(%s)";
in your mes_options.php file.
This will apply the filter automatically to all #TEXTE tags. Just beware that this will apply to all loops with a #TEXTE tag, not only the ARTICLES one.
Pierre
PS: Say Hi to Niek
Thomas Sutton wrote:
Hi all,
After my last problem prompted so fast (and helpful) a response, I thought I'd ask here about the proper use of the #TEXTE.
I'm working on another SPIP based site and have seen some behaviour that surprised me (and we all know about the principle of least surprise): the type of output I get from #TEXTE seems to depend on the content. If the article contains more than one block level element (paragraph, heading, etc.) then #TEXTE gives me back some HTML that fits nicely into my template. If, however, the article contains a single paragraph of text, #TEXTE gives me some bare text which I need to wrap with <p>'s. I can use the `paragrapher` filter to make it work properly but I find the need to do so unusual (given my experiences with markdown and textile).
Now the question: can someone explain the reason for this behaviour (or if it is just a bug)?