Make your own directive that runs your command.  You can probably use the 
programoutput extension code as a reference for how to make the directive.  
Then use the nested_parse_with_titles function:
from docutils import nodes
from docutils.statemachine import ViewList     

def run(self):
    new_content = command.output
    node = nodes.Element()
    node.document = self.state.document
    env = self.state.document.settings.env
    sphinx.util.nodes.nested_parse_with_titles(self.state, 
                                               ViewList(new_content.
splitlines(), source=env.docname),
                                               node)
    return node.children

--Peter

On Friday, January 17, 2020 at 1:56:38 AM UTC-8, DexterMagnific wrote:
>
> Dear all,
>
> I have some script that generates ReST content. I'd like to call this 
> script from inside the rst document:
>
> blah blah blah
>
> .. execute-program:: generate-content.py myfile.bin
>
> I know there is sphinxcontrib.programoutput, but this extension inserts 
> the output of the program. What i'd like to is that this output be 
> interpreted by the parser as a rest content.
>
> Do you have any idea on how to achieve this ?
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/533e8dd9-23c4-4844-aa28-8b3e94743139%40googlegroups.com.

Reply via email to