Added link and underline sections to base and html docgen types; defaults to silent pass so that we can add to other docgen types without breaking anything yet

svn: r13587
This commit is contained in:
Doug Blank 2009-11-15 13:15:54 +00:00
parent 3173c3a942
commit 406e46eac9
2 changed files with 53 additions and 0 deletions

View File

@ -249,3 +249,32 @@ class TextDoc(object):
@param alt: an alternative text to use. Useful for eg html reports
"""
raise NotImplementedError
def start_link(self, link):
"""
Start a link section. This defaults to underlining.
@param link: should be an item that makes sense in this
docgen type, if it implements linking.
"""
self.start_underline()
def stop_link(self):
"""
Stop the link section. Defaults to stoppping the underlining
for docgen types that don't support links.
"""
self.stop_underline()
def start_underline(self):
"""
Start a section of underlining. This passes without error
so that docgen types are not required to have this.
"""
pass
def stop_underline(self):
"""
Stops a section of underlining. This passes without error
so that docgen ntypes are not required to have this.
"""
pass

View File

@ -541,3 +541,27 @@ class HtmlDoc(BaseDoc, TextDoc):
overwrite base method so page break has no effect
"""
pass
def start_link(self, link):
"""
Starts a section to add a link. Link is a URI.
"""
self.htmllist += [Html('a', href=link)]
def stop_link(self):
"""
Stop a section of a link.
"""
self.__reduce_list()
def start_underline(self):
"""
Starts a section of underlining.
"""
self.htmllist += [Html('u')]
def stop_underline(self):
"""
Stop underlining.
"""
self.__reduce_list()