I found the answer in another post. From a directive you can do:

node = nodes.paragraph()
self.state.nested_parse(ViewList(<content>), 0, node)

On Wednesday, July 31, 2013 5:53:12 PM UTC-6, Daniel Nephin wrote:
>
> I'm trying to do something similar. Did you figure this out?  I am still 
> looking for what I need to call to parse the roles/directives in a 
> docstring.
>
> On Tuesday, May 7, 2013 12:07:56 AM UTC-6, Stefan Urbanek wrote:
>>
>> Hi,
>>
>> I would like to create a custom autodoc-like extension, that would parse 
>> directive like:
>>
>> .. operation:: name(args)
>>
>>     Some documentation here...
>>
>>
>> With output similar to a function documentation generated by ".. 
>> autofunction". The output is going to be a signature, the documentation 
>> from the directive and multiple other documentation chunks that are 
>> extracted from __doc__ strings from other objects. The objects will be 
>> fetched from some other catalogue object based on the signature. There 
>> might be none, one, two or more objects per operation.
>>
>> Example:
>>
>> INPUT 1: doc.rst
>>
>> .. operation:: duplicates
>>
>> INPUT 2: - some.py with list of operation objects for key "duplicates", 
>> for this we have two objects with names "rows" and "sql"
>>
>> OUTPUT:
>>
>> duplicates(obj)
>>
>>     Finds duplicate records in the object.
>>
>> Signatures:
>>
>>     rows
>>         returns an iterator object yielding duplicate records. Consumes 
>> the source.
>>     sql
>>         composes another SQL statement
>>
>> END OF OUTPUT
>>
>> The `Signatures` part is generated list where content of each item might 
>> contain a documentation from __doc__ attribute of given objects in RST 
>> format.
>>
>> I assume there will be nodes:
>>
>> BASIC_SIGNATURE
>> DIRECTIVE_DOC
>> CUSTOM_LABEL
>> LABEL_SIG_1
>> DOC_SIG_1
>> LABEL_SIG_2
>> DOC_SIG_2
>> ...
>>
>> How can I do this? I know how to create an OperationDirective(Directive) 
>> object that emits some nodes in run(). However I do not know how to:
>>
>> * parse and append content of the directive
>> * parse and append any other content
>> * create an index reference
>> * create a list of operations that will link to the operation 
>> documentation
>>
>> I've tried to follow the tutorial on the sphinx documentation, but it was 
>> not sufficient for me.
>>
>> Where I can find more information?
>>
>> Cheers,
>>
>> Stefan
>>
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to