def get_filename(self): """ Return the filename of the current code block (optional). :return: The filename associated with the current code block, or an empty string. """ filename = self.attrs.get(self.filename_attr_name, '') return unescape_html_entities(filename)
def get_alt_text(self): """ Get the image alt text. :return The image alternative text as string, or an empty string. """ alt_text = self.attrs.get(self.alt_attr_name, '') return unescape_html_entities(alt_text)
def get_alert_title(self): """ Return the title of this alert. The title can be set by setting the ``alert_title_attr_name`` attribute of the tag or simply by setting the tag name attribute. The lookup order is: tag name (first), ``alert_title_attr_name``. :return The alert title if set or an empty string. """ alert_title = self.get_attribute_value("", self.alert_title_attr_name) return unescape_html_entities(alert_title)
def get_language_name(self): """ Return the language name of this code block for syntax highlighting. The language name can be set by setting the ``language_attr_name`` attribute of the tag or simply by setting the tag name attribute. The lookup order is: tag name (first), ``language_attr_name``. :return The language name of this code block, or the default one if not specified. """ language_name = self.get_attribute_value('', self.language_attr_name, default=self.default_language_name) return unescape_html_entities(language_name)
def render_text(self, inner_text, **kwargs): """ Callback function for rendering text. :param inner_text: The inner text of this tree node. :param kwargs: Extra keyword arguments for rendering. :return The rendered text of this node. """ content = self.content content = unescape_html_entities(content) return content
def get_acronym_title(self): """ Get the title for this acronym. The title can be set by setting the ``acronym_title_attr_name`` attribute of the tag or simply by setting the tag name attribute. The lookup order is: tag name (first), ``acronym_title_attr_name``. :return The acronym title if set, or an empty string. """ abbr_title = self.get_attribute_value('', self.acronym_title_attr_name) return unescape_html_entities(abbr_title)
def get_alert_title(self): """ Return the title of this alert. The title can be set by setting the ``alert_title_attr_name`` attribute of the tag or simply by setting the tag name attribute. The lookup order is: tag name (first), ``alert_title_attr_name``. :return The alert title if set or an empty string. """ alert_title = self.get_attribute_value('', self.alert_title_attr_name) return unescape_html_entities(alert_title)
def get_quote_author_name(self): """ Return the quote author name. The author name can be set by setting the ``author_attr_name`` attribute of the tag or simply by setting the tag name attribute. The lookup order is: tag name (first), ``author_attr_name``. :return The quote author name, or an empty string. """ author_name = self.get_attribute_value('', self.author_attr_name) return unescape_html_entities(author_name)
def get_acronym_title(self): """ Get the title for this acronym. The title can be set by setting the ``acronym_title_attr_name`` attribute of the tag or simply by setting the tag name attribute. The lookup order is: tag name (first), ``acronym_title_attr_name``. :return The acronym title if set, or an empty string. """ abbr_title = self.get_attribute_value("", self.acronym_title_attr_name) return unescape_html_entities(abbr_title)
def get_language_name(self): """ Return the language name of this code block for syntax highlighting. The language name can be set by setting the ``language_attr_name`` attribute of the tag or simply by setting the tag name attribute. The lookup order is: tag name (first), ``language_attr_name``. :return The language name of this code block, or the default one if not specified. """ language_name = self.get_attribute_value( '', self.language_attr_name, default=self.default_language_name) return unescape_html_entities(language_name)
def render_html(self, inner_html, **kwargs): """ Callback function for rendering HTML. :param inner_html: The inner HTML of this tree node. :param kwargs: Extra keyword arguments for rendering. :return The rendered HTML of this node. """ content = self.content content = unescape_html_entities(content) content = escape_html(content) return content
def get_title_link(self): """ Return the title of this link, or an empty string. """ link_title = self.attrs.get(self.title_attr_name, '') return unescape_html_entities(link_title)