def Format(self, indent=0, **kws): charset = 'us-ascii' if self.language and Utils.IsLanguage(self.language): charset = Utils.GetCharSet(self.language) output = ['Content-Type: text/html; charset=%s' % charset] output.append('Cache-control: no-cache\n') if not self.suppress_head: kws.setdefault('bgcolor', self.bgcolor) tab = ' ' * indent output.extend([tab, '<HTML>', '<HEAD>']) if mm_cfg.IMAGE_LOGOS: output.append('<LINK REL="SHORTCUT ICON" HREF="%s">' % (mm_cfg.IMAGE_LOGOS + mm_cfg.SHORTCUT_ICON)) # Hit all the bases output.append('<META http-equiv="Content-Type" ' 'content="text/html; charset=%s">' % charset) if self.title: output.append('%s<TITLE>%s</TITLE>' % (tab, self.title)) # Add CSS to visually hide some labeling text but allow screen # readers to read it. output.append("""\ <style type="text/css"> div.hidden {position:absolute; left:-10000px; top:auto; width:1px; height:1px; overflow:hidden;} </style> """) if mm_cfg.WEB_HEAD_ADD: output.append(mm_cfg.WEB_HEAD_ADD) output.append('%s</HEAD>' % tab) quals = [] # Default link colors if mm_cfg.WEB_VLINK_COLOR: kws.setdefault('vlink', mm_cfg.WEB_VLINK_COLOR) if mm_cfg.WEB_ALINK_COLOR: kws.setdefault('alink', mm_cfg.WEB_ALINK_COLOR) if mm_cfg.WEB_LINK_COLOR: kws.setdefault('link', mm_cfg.WEB_LINK_COLOR) for k, v in kws.items(): quals.append('%s="%s"' % (k, v)) output.append('%s<BODY %s' % (tab, SPACE.join(quals))) # Language direction direction = Utils.GetDirection(self.language) output.append('dir="%s">' % direction) # Always do this... output.append(Container.Format(self, indent)) if not self.suppress_head: output.append('%s</BODY>' % tab) output.append('%s</HTML>' % tab) return NL.join(output)
def Format(self, indent=0, **kws): charset = 'us-ascii' if self.language and Utils.IsLanguage(self.language): charset = Utils.GetCharSet(self.language) output = ['Content-Type: text/html; charset=%s' % charset] output.append('Cache-control: no-cache\n') if not self.suppress_head: kws.setdefault('bgcolor', self.bgcolor) tab = ' ' * indent output.extend([tab, '<HTML>', '<HEAD>']) if mm_cfg.IMAGE_LOGOS: output.append('<LINK REL="SHORTCUT ICON" HREF="%s">' % (mm_cfg.IMAGE_LOGOS + mm_cfg.SHORTCUT_ICON)) # Hit all the bases output.append('<META http-equiv="Content-Type" ' 'content="text/html; charset=%s">' % charset) if self.title: output.append('%s<TITLE>%s</TITLE>' % (tab, self.title)) output.append('%s</HEAD>' % tab) quals = [] # Default link colors if mm_cfg.WEB_VLINK_COLOR: kws.setdefault('vlink', mm_cfg.WEB_VLINK_COLOR) if mm_cfg.WEB_ALINK_COLOR: kws.setdefault('alink', mm_cfg.WEB_ALINK_COLOR) if mm_cfg.WEB_LINK_COLOR: kws.setdefault('link', mm_cfg.WEB_LINK_COLOR) for k, v in kws.items(): quals.append('%s="%s"' % (k, v)) output.append('%s<BODY %s' % (tab, SPACE.join(quals))) # Language direction direction = Utils.GetDirection(self.language) output.append('dir="%s">' % direction) # Always do this... output.append(Container.Format(self, indent)) if not self.suppress_head: output.append('%s</BODY>' % tab) output.append('%s</HTML>' % tab) return NL.join(output)