From 406e46eac930fc49630d757d492cf12dc83bd2db Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sun, 15 Nov 2009 13:15:54 +0000 Subject: [PATCH] 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 --- src/gen/plug/docgen/textdoc.py | 29 +++++++++++++++++++++++++++++ src/plugins/docgen/HtmlDoc.py | 24 ++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/src/gen/plug/docgen/textdoc.py b/src/gen/plug/docgen/textdoc.py index 96245aa0c..c7b57f5bc 100644 --- a/src/gen/plug/docgen/textdoc.py +++ b/src/gen/plug/docgen/textdoc.py @@ -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 diff --git a/src/plugins/docgen/HtmlDoc.py b/src/plugins/docgen/HtmlDoc.py index ecc8e9a94..49bc96690 100644 --- a/src/plugins/docgen/HtmlDoc.py +++ b/src/plugins/docgen/HtmlDoc.py @@ -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()