# -*- coding: utf-8 -*- """ big_button tags for reStructuredText ============================== This plugin allows you to use big_button tags from within reST documents. .. big_button:: :title: Title :link: "" :color: default Description """ from __future__ import unicode_literals from docutils import nodes from docutils.parsers.rst import directives, Directive class BigButton(Directive): optional_arguments = 0 final_argument_whitespace = True has_content = True required_arguments = 0 optional_arguments = 0 final_argument_whitespace = False option_spec = { "title": directives.unicode_code, "link": directives.path, } def settings(self): self.options['content'] = '\n'.join(self.content) if not self.options.get('title'): self.options['title'] = 0 if not self.options.get('link'): self.options['link'] = 0 def html(self): html = "
\n" if self.options["link"]: html += f"" else: html += f"" html += "
" return html def run(self): self.settings() return [nodes.raw('', self.html(), format='html')] def register(): directives.register_directive("big_button", BigButton)