From f361ace41c16662bb7c6ecb863cc8e8f9ded4d64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Wed, 16 Jun 2010 12:15:01 +0200 Subject: [PATCH] bring back html* methods --- module-tools.py | 84 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/module-tools.py b/module-tools.py index a3e8d5a8..4cd9a2e4 100755 --- a/module-tools.py +++ b/module-tools.py @@ -975,7 +975,89 @@ n: move to next file"""%locals() else: os.unlink(changelog) os.unlink(changelog_svn) - + + + #################### + # store and restitute html fragments + @staticmethod + def html_href (url,text): return '%s'%(url,text) + + @staticmethod + def html_anchor (url,text): return '%s'%(url,text) + + @staticmethod + def html_quote (text): + return text.replace('&','&').replace('<','<').replace('>','>') + + # only the fake error module has multiple titles + def html_store_title (self, title): + if not hasattr(self,'titles'): self.titles=[] + self.titles.append(title) + + def html_store_raw (self, html): + if not hasattr(self,'body'): self.body='' + self.body += html + + def html_store_pre (self, text): + if not hasattr(self,'body'): self.body='' + self.body += '
' + self.html_quote(text) + '
' + + def html_print (self, txt): + if not self.options.www: + print txt + else: + if not hasattr(self,'in_list') or not self.in_list: + self.html_store_raw('') + + @staticmethod + def html_dump_header(title): + nowdate=time.strftime("%Y-%m-%d") + nowtime=time.strftime("%H:%M (%Z)") + print """ + + + + %s + + + + +

%s - status on %s at %s

+" + + @staticmethod + def html_dump_footer(): + print "',self.html_href ('#'+self.friendly_name(),title),'' + + def html_dump_body(self): + if hasattr(self,'titles'): + for title in self.titles: + print '

',self.html_anchor(self.friendly_name(),title),'

' + if hasattr(self,'body'): + print self.body + print '

',self.html_href('#','Back to top'),'

' + ############################## class Main: -- 2.43.0