This alters hovercraft's main function to support input arguments passed to the command-line parser. The main use case for this is to simplify the creation of custom directives that will be recognized by hovercraft. Custom directives need to be registered in the same process that starts up the hovercraft server, so using hovercraft through the cli entry point makes this difficult.
Allowing users to pass arguments to the main function simplifies use of custom directives. For example
from docutils import nodes
from docutils.parsers.rst import Directive, directives
import hovercraft
class HelloWorld(Directive):
def run(self):
para = nodes.paragraph(text='Hello World')
return [para]
directives.register_directive('hello-world', HelloWorld)
if __name__ == "__main__":
cmd = ['--skip-help', '--template', 'templates/impress1.0.0', 'slides.rst']
hovercraft.main(cmd)
Marking as a work-in-progress for now, since I'd like to add a bit of documentation if this goes forward.
This alters hovercraft's
main
function to support input arguments passed to the command-line parser. The main use case for this is to simplify the creation of custom directives that will be recognized by hovercraft. Custom directives need to be registered in the same process that starts up the hovercraft server, so using hovercraft through the cli entry point makes this difficult.Allowing users to pass arguments to the
main
function simplifies use of custom directives. For exampleMarking as a work-in-progress for now, since I'd like to add a bit of documentation if this goes forward.