The annotated line I gave in my first post: '.', 'result-dir'] # Directory for generated files
actually contains both the source and result directories. In this example, the source is in ".". On Thursday, July 1, 2021 at 6:20:59 PM UTC-4 [email protected] wrote: > Sphinx can turn a ReStructured Text file or series of files into good > looking HTML documentation. But when you read how to get it going, it > seems complicated. You are told the set up a folder and run make to > produce a configuration file, which you will probably tinker with. It's > confusing what all the options and settings mean. > > Turns out you don't have to do all that if you are willing to live with a > basic configuration, but it's probably one you would use most of the time > anyway. Instead of generating a config file, you can just write a small > script that passes the most important options to Sphinx directly. You can > write the script in a Leo node and run it with CNTL-B like any other script. > > Here is an annotated sample. > > import sys > import subprocess > pyexe=sys.executable > cmd=[pyexe,'-m','sphinx','-C', > '-D', 'master_doc=main_doc', # the main RsT file > '-D', 'source_suffix=.rst', # The RsT file extension > # (set by a Leo setting) > '-D', 'html_theme=bizstyle', # Look on web for other themes > '-D', 'project=my project', # Project name, can have spaces > '-D', 'copyright=T. B. Passin', # Optional > '.', 'result-dir'] # Directory for generated files > subprocess.call(cmd) > > I don't recall just now if Sphinx will make the output directory for you > if it doesn't exist. > > You can create the file(s) using the rst3 command on an @rst file, or you > can just write an RsT file (or file tree) by hand yourself, as an @clean > file. Then run your script and when Sphinx is done it will tell you where > to find the output HTML files. If you use it often, you can make it into a > button. > > When I need to create a new Sphinx project, I usually copy the script to a > new outline and change the key names. > > That's it! > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/9f9feae1-e078-4efc-be2a-9ec374adee50n%40googlegroups.com.
