[wp-hackers] Save/edit hooks

m at tidakada.com m at tidakada.com
Tue Oct 12 09:59:49 UTC 2004


Quoting Matthew Mullenweg <m at mullenweg.com>:

> Alex King wrote:
> > I was thinking about this recently, would we translate from XHTML back
> > to Markdown, etc. for editing already saved posts?
>
> I think that's the ideal situation. As long as there are advanced enough
> functions to translate to and from HTML (ignoring anything they can't
> handle) then there's no reason not just to store HTML and nothing else.
> Then if you decided you liked Markdown better than Textile or whatever
> you could flip a switch and immediately be able to edit all your content
> past and present in your preferred syntax.
>
> There's also no reason we couldn't use this for autop as well, that
> would also speed things up quite a bit.


There used to be an idea floating around on IRC or an ML: storing the rendered
html alongside the raw content in the posts table.

While I don't think we could foresee all filters that are going to be applied at
display time, I think we could do this with filters that are applied using the
posting interface.

We would then store three fields: the raw content (with whatever markup), the
filters applied to it (textile, and so on, in a comma separated list, or a
serialised table -- keeping in mind a serialised table would allow passing args
to per-post filters), the content with these filters applied.
The template functions would fetch the filtered content, and then apply
additionnal ilters, and we could have template functions (or an additionnal
arg) that override this behaviour and just fetch the raw content.

The problems with this approach are that it's rather moot if one is using a
staticize plugin, and it makes for a larger posts table. The advantage is a
gain of time+performance (unless you use staticize), since regexp-heavy filters
like wpautop do not have to be used at display time anymore.
I think the advantage really warrants the additionnal space used...

--
Michel Valdrighi
http://zengun.org/weblog/



More information about the hackers mailing list