[CMF-checkins] CVS: CMF - utils.py:1.11
Jeffrey Shell
jeffrey@digicool.com
Thu, 31 May 2001 13:58:01 -0400 (EDT)
Update of /cvs-repository/CMF/CMFCore
In directory korak.digicool.com:/home/jeffrey/InstanceHomes/cmf-dev/CMF/CMFCore
Modified Files:
utils.py
Log Message:
Added named link functionality to our StructuredText subclasses. This
included having to override HTMLClass#namedLink(), which seems to be
broken.
--- Updated File utils.py in package CMF --
--- utils.py 2001/05/30 02:53:16 1.10
+++ utils.py 2001/05/31 17:58:00 1.11
@@ -480,8 +480,13 @@
class CMFDocumentClass( StructuredText.DocumentWithImages.__class__ ):
"""
- Override DWI to get '_' into links.
+ Override DWI to get '_' into links, and also turn on inner/named links.
"""
+ text_types = [
+ 'doc_named_link',
+ 'doc_inner_link',
+ ] + _STXDWI.text_types
+
_URL_AND_PUNC = r'([a-zA-Z0-9_\@\.\,\?\!\/\:\;\-\#\~]+)'
def doc_href( self
, s
@@ -502,6 +507,16 @@
class CMFHtmlWithImages( HTMLWithImages ):
""" Special subclass of HTMLWithImages, overriding document() """
+ def namedLink(self, doc, level, output):
+ """\
+ XXX Trial subclassed implementation of HTMLClass#namedLink(),
+ as default implementation seems to be broken...
+ """
+ name = doc.getNodeValue()
+ if name[:2] == '..':
+ name = name[2:]
+ output('<a name="#%s">[%s]</a>' % (name, name))
+
def document(self, doc, level, output):
"""\
HTMLWithImages.document renders full HTML (head, title, body). For