def prepare_html(self): yield build_html_tag(u"dt", class_=self.class_, style=self.style, id=self.id) yield escape(self.term) yield u"</dt>" yield build_html_tag(u"dd", class_=self.class_) for item in Element.prepare_html(self): yield item yield u"</dd>"
def prepare_html(self): yield build_html_tag(u'dt', class_=self.class_, style=self.style, id=self.id) yield escape(self.term) yield u'</dt>' yield build_html_tag(u'dd', class_=self.class_) for item in Element.prepare_html(self): yield item yield u'</dd>'
def test_build_html_tag(self): self.assertEqual(build_html_tag('a'), u'<a>') self.assertEqual(build_html_tag('a', href='http://example.com'), u'<a href="http://example.com">') self.assertEqual(build_html_tag('a', class_='stunning', href='http://abc.xy'), u'<a href="http://abc.xy" class="stunning">') self.assertEqual(build_html_tag('a', classes=('stunning', 'awesome'), href='http://abc.xy'), u'<a href="http://abc.xy" class="stunning awesome">') # test for empty tags self.assertEqual(build_html_tag('br'), u'<br>')
def prepare_html(self): style = self.style and self.style + "; " or "" style += u"font-size: %.2f%%" % self.size yield build_html_tag(u"span", id=self.id, style=style, class_=self.class_) for item in Element.prepare_html(self): yield item yield u"</span>"
def prepare_html(self): style = self.style and self.style + "; " or "" style += u"color: %s" % self.value yield build_html_tag(u"span", id=self.id, style=style, class_=self.class_) for item in Element.prepare_html(self): yield item yield u"</span>"
def prepare_html(self): yield build_html_tag(u'dl', id=self.id, style=self.style, class_=self.class_) for item in Element.prepare_html(self): yield item yield u'</dl>'
def prepare_html(self): yield build_html_tag(u'tbody', style=self.style, id=self.id, class_=self.class_) for item in Element.prepare_html(self): yield item yield u'</tbody>'
def prepare_html(self): yield build_html_tag(u'span', id=self.id, style=self.style, classes=(u'underline', self.class_)) for item in Element.prepare_html(self): yield item yield u'</span>'
def prepare_html(self): classes = ["highlighted"] if self.class_: classes.append(self._class) yield build_html_tag(u"strong", id=self.id, style=self.style, classes=classes) for item in Element.prepare_html(self): yield item yield u"</strong>"
def prepare_html(self): style = [] if self.align: style.append(u"text-align: " + self.align) if self.valign: style.append(u"vertical-align: " + self.valign) if self.style: style.append(self.style) yield build_html_tag(u"div", id=self.id, style=style and u" ".join(style) or None, classes=(self.class_,)) if self.title is not None: yield build_html_tag(u"h3", class_=self.class_) yield escape(self.title) yield u"</h3>" yield build_html_tag(u"div", classes=(u"contents",)) for item in Element.prepare_html(self): yield item yield u"</div></div>"
def prepare_html(self): yield build_html_tag(u'div', id=self.id, style=self.style, classes=(u'error', self.class_)) for item in Element.prepare_html(self): yield item yield u'</div>'
def prepare_html(self): class_ = u"section_%d" % self.level if self.class_: class_ += u" " + self.class_ yield build_html_tag(u"div", id=self.id, style=self.style, class_=class_) for item in Element.prepare_html(self): yield item yield u"</div>"
def prepare_html(self): yield build_html_tag(u'tr', id=self.id, class_=self.class_, style=self.style) for item in Element.prepare_html(self): yield item yield u'</tr>'
def prepare_html(self): yield build_html_tag(u'sup', id=self.id, style=self.style, class_=self.class_) yield u'<a href="#source-%d">' % self.target for item in Element.prepare_html(self): yield item yield u'</a></sup>'
def prepare_html(self): style = self.style and self.style + "; " or "" style += u"font-family: %s" % u", ".join( x in ("serif", "sans-serif", "fantasy") and x or u"'%s'" % x for x in self.faces ) yield build_html_tag(u"span", id=self.id, style=style, class_=self.class_) for item in Element.prepare_html(self): yield item yield u"</span>"
def prepare_html(self): yield build_html_tag(u'h%d' % (self.level + 1), id=self.id, style=self.style, class_=self.class_) for item in Element.prepare_html(self): yield item yield u'<a href="#%s" class="headerlink">¶</a>' % self.id yield u'</h%d>' % (self.level + 1)
def prepare_docbook(self): yield build_html_tag( u'entry', morerows=(self.rowspan and self.rowspan - 1) or None, align=self.align, ) for item in Element.prepare_docbook(self): yield item yield u'</entry>'
def prepare_html(self): style = self.style and self.style + '; ' or '' style += u'font-size: %.2f%%' % self.size yield build_html_tag(u'span', id=self.id, style=style, class_=self.class_) for item in Element.prepare_html(self): yield item yield u'</span>'
def prepare_html(self): style = self.style and self.style + '; ' or '' style += u'color: %s' % self.value yield build_html_tag(u'span', id=self.id, style=style, class_=self.class_) for item in Element.prepare_html(self): yield item yield u'</span>'
def prepare_html(self): style = [] if self.align: style.append(u'text-align: ' + self.align) if self.valign: style.append(u'vertical-align: ' + self.valign) if self.style: style.append(self.style) yield build_html_tag(u'div', id=self.id, style=style and u' '.join(style) or None, classes=(self.class_, )) if self.title is not None: yield build_html_tag(u'h3', class_=self.class_) yield escape(self.title) yield u'</h3>' yield build_html_tag(u'div', classes=(u'contents', )) for item in Element.prepare_html(self): yield item yield u'</div></div>'
def prepare_html(self): class_ = u'section_%d' % self.level if self.class_: class_ += u' ' + self.class_ yield build_html_tag(u'div', id=self.id, style=self.style, class_=class_) for item in Element.prepare_html(self): yield item yield u'</div>'
def prepare_html(self): if self.type == "unordered": tag = u"ul" cls = None else: tag = u"ol" cls = self.type yield build_html_tag(tag, id=self.id, style=self.style, classes=(self.class_, cls)) for item in Element.prepare_html(self): yield item yield u"</%s>" % tag
def prepare_html(self): classes = ['highlighted'] if self.class_: classes.append(self._class) yield build_html_tag(u'strong', id=self.id, style=self.style, classes=classes) for item in Element.prepare_html(self): yield item yield u'</strong>'
def prepare_html(self): style = self.style and self.style + '; ' or '' style += u"font-family: %s" % u', '.join( x in ('serif', 'sans-serif', 'fantasy') and x or u"'%s'" % x for x in self.faces) yield build_html_tag(u'span', id=self.id, style=style, class_=self.class_) for item in Element.prepare_html(self): yield item yield u'</span>'
def prepare_html(self): if self.id is None: yield build_html_tag(u"small", id=self.id, style=self.style, classes=(u"note", self.class_)) for item in Element.prepare_html(self): yield item yield u"</small>" else: yield u'<a href="#fn-%d" id="bfn-%d" class="footnote">' u'<span class="paren">[</span>%d<span class="paren">]' u"</span></a>" % ( self.id, self.id, self.id, )
def prepare_html(self): if self.id is None: yield build_html_tag(u'small', id=self.id, style=self.style, classes=(u'note', self.class_)) for item in Element.prepare_html(self): yield item yield u'</small>' else: yield u'<a href="#fn-%d" id="bfn-%d" class="footnote">' \ u'<span class="paren">[</span>%d<span class="paren">]' \ u'</span></a>' % (self.id, self.id, self.id)
def prepare_html(self): if self.type == 'unordered': tag = u'ul' cls = None else: tag = u'ol' cls = self.type yield build_html_tag(tag, id=self.id, style=self.style, classes=(self.class_, cls)) for item in Element.prepare_html(self): yield item yield u'</%s>' % tag
def prepare_html(self): style = [] if self.align: style.append(u'text-align: ' + self.align) if self.valign: style.append(u'vertical-align: ' + self.valign) if self.style: style.append(self.style) yield build_html_tag(self._html_tag, colspan=self.colspan or None, rowspan=self.rowspan or None, style=style and u'; '.join(style) or None, id=self.id, class_=self.class_) for item in Element.prepare_html(self): yield item yield u'</%s>' % self._html_tag
def get_html(self, key, value, nolink=False): """ Returns a HTML link for sorting the table. This function is usually called inside the template. Usage example in the template file: .. sourcecode:: html+jinja <tr> <th> {{ table.get_html('id', '#') }} </th> <th> {{ table.get_html('username', 'Username') }} </th> </tr> {% for user in users %} (...) {% endfor %} :parameter key: The name of the database column that should be used for sorting. :param value: The name that is displayed for the link. :param nolink: Don't make this column sortable but display a cool link. """ ocol = self.order_by.lstrip('-') order = self.order_by.startswith('-') if key == ocol: new_order = '%s%s' % (('-', '')[order], ocol) button = ('down', 'up')[order] src = href('static', file='img/%s.png' % button) img = build_html_tag('img', src=src) else: new_order = key img = '' if nolink: return value return Markup(u'<a href="?order=%s">%s</a>%s' % (new_order, value, img))
def prepare_html(self): if self.scheme == "javascript": yield escape(self.caption) return rel = None if ( not self.netloc or self.netloc == ctx.cfg["base_domain_name"] or self.netloc.endswith("." + ctx.cfg["base_domain_name"]) ): class_ = u"crosslink" else: class_ = u"external" rel = u"nofollow" yield build_html_tag( u"a", rel=rel, id=self.id, style=self.style, title=self.title, classes=(class_, self.class_), href=self.href ) for item in Element.prepare_html(self): yield item yield u"</a>"
def prepare_html(self): style = [] if self.align: style.append(u"text-align: " + self.align) if self.valign: style.append(u"vertical-align: " + self.valign) if self.style: style.append(self.style) yield build_html_tag( self._html_tag, colspan=self.colspan or None, rowspan=self.rowspan or None, style=style and u"; ".join(style) or None, id=self.id, class_=self.class_, ) for item in Element.prepare_html(self): yield item yield u"</%s>" % self._html_tag
def get_html(self, key, value, nolink=False): """ Returns a HTML link for sorting the table. This function is usually called inside the template. Usage example in the template file: .. sourcecode:: html+jinja <tr> <th> {{ table.get_html('id', '#') }} </th> <th> {{ table.get_html('username', 'Username') }} </th> </tr> {% for user in users %} (...) {% endfor %} :parameter key: The name of the database column that should be used for sorting. :param value: The name that is displayed for the link. :param nolink: Don't make this column sortable but display a cool link. """ ocol = self.order_by.lstrip('-') order = self.order_by.startswith('-') if key == ocol: new_order = '%s%s' % (('-', '')[order], ocol) button = ('down', 'up')[order] src = href('static', file='img/%s.png' % button) img = build_html_tag('img', src=src) else: new_order = key img = '' if nolink: return value return Markup(u'<a href="?order=%s">%s</a>%s' % (new_order, value, img))
def prepare_html(self): if self.scheme == 'javascript': yield escape(self.caption) return rel = None if not self.netloc or self.netloc == ctx.cfg['base_domain_name'] or \ self.netloc.endswith('.' + ctx.cfg['base_domain_name']): class_ = u'crosslink' else: class_ = u'external' rel = u'nofollow' yield build_html_tag(u'a', rel=rel, id=self.id, style=self.style, title=self.title, classes=(class_, self.class_), href=self.href) for item in Element.prepare_html(self): yield item yield u'</a>'
def prepare_html(self): yield build_html_tag(u"div", id=self.id, style=self.style, classes=(u"error", self.class_)) for item in Element.prepare_html(self): yield item yield u"</div>"
def prepare_html(self): yield build_html_tag(u"h%d" % (self.level + 1), id=self.id, style=self.style, class_=self.class_) for item in Element.prepare_html(self): yield item yield u'<a href="#%s" class="headerlink">¶</a>' % self.id yield u"</h%d>" % (self.level + 1)
def prepare_html(self): yield build_html_tag(u"sup", id=self.id, style=self.style, class_=self.class_) yield u'<a href="#source-%d">' % self.target for item in Element.prepare_html(self): yield item yield u"</a></sup>"
def prepare_html(self): yield build_html_tag(u"span", id=self.id, style=self.style, classes=(u"underline", self.class_)) for item in Element.prepare_html(self): yield item yield u"</span>"
def prepare_html(self): yield build_html_tag(u"tbody", style=self.style, id=self.id, class_=self.class_) for item in Element.prepare_html(self): yield item yield u"</tbody>"
def prepare_docbook(self): yield build_html_tag(u"entry", morerows=(self.rowspan and self.rowspan - 1) or None, align=self.align) for item in Element.prepare_docbook(self): yield item yield u"</entry>"
def prepare_html(self): yield build_html_tag(u"dl", id=self.id, style=self.style, class_=self.class_) for item in Element.prepare_html(self): yield item yield u"</dl>"
def prepare_html(self): yield build_html_tag(u"tr", id=self.id, class_=self.class_, style=self.style) for item in Element.prepare_html(self): yield item yield u"</tr>"