I have solved it - at least as far as I need to for this project. I pinched 
the implementation of the "include" directive to define a new directive 
that does almost exactly what the original did, but puts a filter between 
the underlying io.FileInput object and the run method in my new directive. 
I can now do this:

.. includeluabinding:: ../../blah/thing/foo.cpp

and then in my C++ file I use the arbitrary chosen special comment syntax 
to document Lua APIs:

/*!--
  .. function:: myfunc(position)

    TODO
--*/
static int lua_myfunc(lua_State *L)
{
  ...
}

and this keeps the documentation of the C/C++ lua bindings right with the 
code.

Luke



On Tuesday, 18 March 2014 14:15:26 UTC, Luke Tunmer wrote:
>
> I have used Sphinx on Python-based projects before, and I'm keen to use it 
> again in a project that uses Lua in an embedded C++ environment. Since 
> there are going to be many APIs that are visible in Lua that are actually 
> implemented in C code, I would like to be able to document these APIs by 
> writing the reStructured text in the C++ files themselves. The document 
> builder should then and be able to pull these into the programmers manual. 
> I could, of course, just put all the doc into .rst files in the 
> documentation tree, but that sort of defeats the purpose of having 
> documentation and implementation side-by-side. Is there something like the 
> .. include directive that allows we to write a crude parser that will 
> extract the appropriate sections the C++ file that seem to have 
> reStructuredText in the C++ comments?
>
> TIA
> Luke
>
>

-- 
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/d/optout.

Reply via email to