From 44dd3a049caad972cb5a4da4cb7145a698093d80 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Wed, 30 May 2012 13:47:53 +0000 Subject: [PATCH] Added interface to insert global attributes on to a-href tags for HtmlDoc svn: r19707 --- src/plugins/docgen/HtmlDoc.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/docgen/HtmlDoc.py b/src/plugins/docgen/HtmlDoc.py index e705bb882..da020a889 100644 --- a/src/plugins/docgen/HtmlDoc.py +++ b/src/plugins/docgen/HtmlDoc.py @@ -105,6 +105,7 @@ class HtmlDoc(BaseDoc, TextDoc): self._empty = 1 self.title = '' self.__title_written = -1 # -1 = not written, 0 = writing, 1 = written + self.__link_attrs = {} # additional link attrs, eg {"style": "...", "class": "..."} def set_css_filename(self, css_filename): """ @@ -580,7 +581,7 @@ class HtmlDoc(BaseDoc, TextDoc): """ Starts a section to add a link. Link is a URI. """ - self.htmllist += [Html('a', href=link)] + self.htmllist += [Html('a', href=link, **self.__link_attrs)] def stop_link(self): """ @@ -599,3 +600,10 @@ class HtmlDoc(BaseDoc, TextDoc): Stop underlining. """ self.__reduce_list() + + def set_link_attrs(self, attrs): + """ + Set some a attributes/values. attrs is a dictionary, eg + {"style": "...", "class": "..."} + """ + self.__link_attrs = attrs