def depart_title(self, node): close_tag = self.context[-1] if (self.permalink_text and self.builder.add_permalinks and node.parent.hasattr('ids') and node.parent['ids']): aname = '' for id in node.parent['ids']: if self.builder.env.domaindata['std']['labels'].has_key(id): ref_text = '. Label :ref:`%s`' % id aname = id break if aname: link_text = ':ref:' else: ref_text = '' aname = node.parent['ids'][0] link_text = self.permalink_text # add permalink anchor if close_tag.startswith('</h'): what = u'<a class="headerlink" href="#%s" ' % aname + u'title="%s">%s</a>' % ( _('Permalink to this headline') + ref_text, link_text) if 0: print 'what:', repr(what) print 'aname:', repr(aname) self.body.append(what) elif close_tag.startswith('</a></h'): what = u'</a><a class="headerlink" href="#%s" ' % aname + u'title="%s">%s' % ( _('Permalink to this headline') + ref_text, link_text) if 0: print 'what:', repr(what) print 'aname:', repr(aname) self.body.append(what) HTMLTranslator.depart_title(self, node)
def depart_title(self, node): if node.parent.hasattr('ids') and node.parent['ids'] and \ self.section_level == 2: print "TITLE",self.section_level,node.parent['ids'][0] #self._title = node.parent['ids'][0] self._title = striptags(''.join(self.body[1:])) print "\t",str(node)[:50] print "\tBODY", self.body[:4] HTMLTranslator.depart_title(self, node)
def depart_title(self, node): if self.current_slide and isinstance(node.parent, (nodes.section, slide)): self.current_slide.title = "".join(self.body) self.pop_body() else: HTMLTranslator.depart_title(self, node) title = "".join(self.body) self.pop_body() self.body.append(title)
def depart_title(self, node): if self.current_slide and isinstance(node.parent, (nodes.section, slide)): self.current_slide.title = ''.join(self.body) self.pop_body() else: HTMLTranslator.depart_title(self, node) title = ''.join(self.body) self.pop_body() self.body.append(title)
def depart_title(self, node): if node.parent.hasattr("ids") and node.parent["ids"]: aname = node.parent["ids"][0] if self.builder.app.config.slide_link_to_html: self.body.append( u'<a class="headerlink" href="%s#%s" ' % (html.html_path(self.builder), aname) + u'title="%s">%s</a>' % (_("View HTML"), self.builder.app.config.slide_html_slide_link_symbol) ) HTMLTranslator.depart_title(self, node)
def depart_title(self, node): # print "--TITLE", node.text if not self._title: self._title = striptags(''.join(self.body[1:])) print "\n\n**title", self.section_level, ''.join(self.body[1:])[:150] low_level = self.section_level \ <= int(self.builder.config.mobi_chapter_level) if node.parent.getattr('ids', False) and low_level: print "TITLE", self.section_level, node.parent['ids'][0] self._title = striptags(''.join(self.body[1:])) print "\t", str(node)[:50] print "\tBODY", self.body[:4] else: print "FALSE" HTMLTranslator.depart_title(self, node)
def depart_title(self, node): if node.parent.hasattr('ids') and node.parent['ids']: aname = node.parent['ids'][0] if self.builder.app.config.slide_link_to_html: self.body.append(u'<a class="headerlink" href="%s#%s" ' % ( html.html_path(self.builder), aname, ) + u'title="%s">%s</a>' % ( _('View HTML'), self.builder.app.config.slide_html_slide_link_symbol, )) HTMLTranslator.depart_title(self, node)
def depart_title(self, node): SphinxHTMLTranslator.depart_title(self, node) # The second to last element added contains a "headerlink" class. # See https://bitbucket.org/birkenfeld/sphinx/src/72dceb35264e9429c8d9bb1a249a638ac21f0524/sphinx/writers/html.py#lines-501 if len(self.body) > 2 and "headerlink" in self.body[-2]: match = HREF.search(self.body[-2]) if match: link = match.group(1) # If header link was injected and the href could be # found, then change the href node to a closing </a> # anchor tag. Look at most at the 10 most recent nodes # to find where the anchor was opened. for i in range(-2, max(-10, -len(self.body)), -1): if self.body[i].startswith("<h"): self.body[i] += '<a href="' + link + '">' self.body[-2] = "</a>"
def depart_title(self, node): BaseTranslator.depart_title(self, node) h_level = self.section_level + self.initial_header_level - 1 if h_level == 1: del self.body[1:]