def depart_title(self, node): # XXX Because we want to inject our link into the title, this is # largely copy-pasta'd from sphinx.html.writers.HtmlTranslator. close_tag = self.context[-1] if (self.permalink_text and self.builder.add_permalinks and node.parent.hasattr('ids') and node.parent['ids']): aname = node.parent['ids'][0] if close_tag.startswith('</a></h'): self.body.append('</a>') self.body.append(u'<a class="headerlink" href="#%s" ' % aname + u'title="%s">%s</a>' % ( _('Permalink to this headline'), self.permalink_text)) self.body.append(u'<a class="headerlink" href="%s#%s" ' % ( html.slide_path(self.builder), aname,) + u'title="%s">%s' % ( _('Slides'), self.builder.app.config.slide_html_slide_link_symbol)) if not close_tag.startswith('</a></h'): self.body.append('</a>') BaseTranslator.depart_title(self, node)
def depart_title(self, node): # XXX Because we want to inject our link into the title, this is # largely copy-pasta'd from sphinx.html.writers.HtmlTranslator. close_tag = self.context[-1] if (self.permalink_text and self.builder.add_permalinks and node.parent.hasattr('ids') and node.parent['ids']): aname = node.parent['ids'][0] if close_tag.startswith('</a></h'): self.body.append('</a>') self.body.append( u'<a class="headerlink" href="#%s" ' % aname + u'title="%s">%s</a>' % (_('Permalink to this headline'), self.permalink_text)) self.body.append(u'<a class="headerlink" href="%s#%s" ' % ( html.slide_path(self.builder), aname, ) + u'title="%s">%s' % ( _('Slides'), self.builder.app.config.slide_html_slide_link_symbol, )) if not close_tag.startswith('</a></h'): self.body.append('</a>') BaseTranslator.depart_title(self, node)
def depart_title(self, node): close_tag = self.context[-1] if self.builder.name != 'htmlhelp' and \ (close_tag.startswith('</h') or close_tag.startswith('</a></h')) and \ node.parent.hasattr('ids') and node.parent['ids']: aname = node.parent['ids'][0] # add permalink anchor self.body.append(u'<a class="headerlink" href="#%s" ' % aname + u'title="Permalink to this headline">\u00B6</a>') BaseTranslator.depart_title(self, node)
def depart_title(self, node): close_tag = self.context[-1] if self.builder.name != 'htmlhelp' and \ (close_tag.startswith('</h') or close_tag.startswith('</a></h')) and \ node.parent.hasattr('ids') and node.parent['ids']: aname = node.parent['ids'][0] # add permalink anchor self.body.append(u'<a class="headerlink" href="#%s" ' % aname + u'title="Permalink to this headline">\u00B6</a>') BaseTranslator.depart_title(self, node)
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 = node.parent['ids'][0] # add permalink anchor # replacing anchors with confluence macro before = '<ac:structured-macro ac:name="anchor">' before += '<ac:parameter ac:name="">' after = '</ac:parameter></ac:structured-macro>' self.body.append(before + aname + after) BaseTranslator.depart_title(self, node)
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 = node.parent['ids'][0] # add permalink anchor # replacing anchors with confluence macro before = '<ac:structured-macro ac:name="anchor">' before += '<ac:parameter ac:name="">' after = '</ac:parameter></ac:structured-macro>' self.body.append(before + aname + after) BaseTranslator.depart_title(self, node)
def depart_title(self, node): close_tag = self.context[-1] if ( self.builder.add_header_links and (close_tag.startswith("</h") or close_tag.startswith("</a></h")) and node.parent.hasattr("ids") and node.parent["ids"] ): aname = node.parent["ids"][0] # add permalink anchor self.body.append( u'<a class="headerlink" href="#%s" ' % aname + u'title="%s">\u00B6</a>' % _("Permalink to this headline") ) BaseTranslator.depart_title(self, node)
def depart_title(self, node): close_tag = self.context[-1] if (self.add_permalinks and self.builder.add_permalinks and node.parent.hasattr('ids') and node.parent['ids']): aname = node.parent['ids'][0] # add permalink anchor if close_tag.startswith('</h'): self.body.append(u'<a class="headerlink" href="#%s" ' % aname + u'title="%s">\u00B6</a>' % _('Permalink to this headline')) elif close_tag.startswith('</a></h'): self.body.append( u'</a><a class="headerlink" href="#%s" ' % aname + u'title="%s">\u00B6' % _('Permalink to this headline')) BaseTranslator.depart_title(self, node)
def depart_title(self, node): # type: (nodes.Node) -> None close_tag = self.context[-1] if (self.permalink_text and self.builder.add_permalinks and node.parent.hasattr('ids') and node.parent['ids']): # add permalink anchor if close_tag.startswith('</h'): self.add_permalink_ref(node.parent, None) elif close_tag.startswith('</a></h'): self.body.append(u'</a><a name="%s" >' % node.parent['ids'][0]) elif isinstance(node.parent, nodes.table): self.body.append('</span>') self.add_permalink_ref(node.parent, None) elif isinstance(node.parent, nodes.table): self.body.append('</span>') BaseTranslator.depart_title(self, node)
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"]: # add permalink anchor if close_tag.startswith("</h"): self.add_permalink_ref(node.parent, _("Permalink to this headline")) elif close_tag.startswith("</a></h"): self.body.append( u'</a><a class="headerlink" href="#%s" ' % node.parent["ids"][0] + u'title="%s">%s' % (_("Permalink to this headline"), self.permalink_text) ) elif isinstance(node.parent, nodes.table): self.body.append("</span>") self.add_permalink_ref(node.parent, _("Permalink to this table")) BaseTranslator.depart_title(self, node)
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 = node.parent["ids"][0] # add permalink anchor if close_tag.startswith("</h"): self.body.append( '<a class="headerlink" href="#%s" ' % aname + 'title="%s">%s</a>' % (_("Permalink to this headline"), self.permalink_text) ) elif close_tag.startswith("</a></h"): self.body.append( '</a><a class="headerlink" href="#%s" ' % aname + 'title="%s">%s' % (_("Permalink to this headline"), self.permalink_text) ) BaseTranslator.depart_title(self, node)
def depart_title(self, node): close_tag = self.context[-1] if (self.add_permalinks and self.builder.add_permalinks and node.parent.hasattr('ids') and node.parent['ids']): aname = node.parent['ids'][0] # add permalink anchor if close_tag.startswith('</h'): self.body.append(u'<a class="headerlink" href="#%s" ' % aname + u'title="%s">\u00B6</a>' % _('Permalink to this headline')) elif close_tag.startswith('</a></h'): self.body.append(u'</a><a class="headerlink" href="#%s" ' % aname + u'title="%s">\u00B6' % _('Permalink to this headline')) BaseTranslator.depart_title(self, node)
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']): # add permalink anchor if close_tag.startswith('</h'): self.add_permalink_ref(node.parent, _('Permalink to this headline')) elif close_tag.startswith('</a></h'): self.body.append(u'</a><a class="headerlink" href="#%s" ' % node.parent['ids'][0] + u'title="%s">%s' % ( _('Permalink to this headline'), self.permalink_text)) elif isinstance(node.parent, nodes.table): self.body.append('</span>') self.add_permalink_ref(node.parent, _('Permalink to this table')) BaseTranslator.depart_title(self, node)
def depart_title(self, node): # type: (nodes.Node) -> None close_tag = self.context[-1] if (self.permalink_text and self.builder.add_permalinks and node.parent.hasattr('ids') and node.parent['ids']): # add permalink anchor if close_tag.startswith('</h'): self.add_permalink_ref(node.parent, _('Permalink to this headline')) elif close_tag.startswith('</a></h'): self.body.append(u'</a><a class="headerlink" href="#%s" ' % node.parent['ids'][0] + u'title="%s">%s' % ( _('Permalink to this headline'), self.permalink_text)) elif isinstance(node.parent, nodes.table): self.body.append('</span>') self.add_permalink_ref(node.parent, _('Permalink to this table')) elif isinstance(node.parent, nodes.table): self.body.append('</span>') BaseTranslator.depart_title(self, node)
def depart_title(self, node): h_level = 0 close_tag = self.context[-1] close = close_tag.rfind('>') if close != -1: h_level = close_tag[close - 1] if (h_level and h_level.isdigit() and (close == close_tag.rfind('h%s>' % h_level) + 2) and self.permalink_text and self.builder.add_permalinks and node.parent.hasattr('ids') and node.parent['ids']): aname = node.parent['ids'][0] tags = [] open_tag = "<h%s>" % h_level # Walk back to find open_tag in body for i in reversed(range(len(self.body))): tags.append(self.body.pop()) if tags[-1] == open_tag: self.body.append(tags.pop()) tags.reverse() break # <h1>Manual Installation using Packages<a class="headerlink" href="#manual-installation-using-packages" # title="Permalink to this headline">¶</a></h1> # becomes # <h1><a class="headerlink" href="#manual-installation-using-packages" # title="Permalink to this headline"></a>Manual Installation using Packages</h1> if close_tag.startswith('</h'): self.body.append( u'<a class="headerlink" href="#%s" title="%s"></a>' % (aname, _('Perma-link to this heading'))) elif close_tag.startswith('</a></h'): self.body.append( u'</a><a class="headerlink" href="#%s" title="%s">' % (aname, _('Perma-link to this heading'))) self.body = self.body + tags BaseTranslator.depart_title(self, node)