[Zope-CMF] Re: Changing the H level in STX
tseaver at zope.com
Tue Apr 20 22:36:28 EDT 2004
Tonico Strasser wrote:
> is it possible to change the level of generated headlines in STX in CMF?
> I'd like to change the default level from <h1> to <h2>, since the title
> of the document is already <h1>. Two <h1>s in the same section (the
> content section in this case) is considered as a wrong document
> structure .
> If this isn't possible right now, I'd love to see that feature in CMF 1.5.
>  7.5.5 Headings: The H1, H2, H3, H4, H5, H6 elements
- Derive a new class and override the default '_stx_level'::
from Products.CMFDefault.Document import Document
class FussilyCorrectDocument( Document ): # ;)
_stx_level = 2
Then, register your new class in place of the "stock" document.
- You could arrange to tweak the level directly on the instance,
e.g. via an ExternalMethod calling 'handleText' (which happens
to be private for reasons which escape me right now).
- You could override the level by passing your own value to the
'CookedBody' method. Note that this defeats the caching done
by "cooking" the text when it is saved, which makes it a less
efficient solution; nevertheless, you can implement it today
just by customizing the 'document_view' template.
Tres Seaver tseaver at zope.com
Zope Corporation "Zope Dealers" http://www.zope.com
More information about the Zope-CMF