-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am 15.12.2010 19:21, schrieb JohnKitchin07:
> I would like to include a directory in the build directory using
> Sphinx, preferrably with the same relative path as the directory in
> the source.  This would be helpful for including directories
> containing prebuilt html (e.g. the output from published matlab files)
> or videos that have several files. Is there a way to do this?
> 
> the markup might look something like:
> 
> .. includedir:: somedirectory
> 
> I could not figure out how to build an extension to do this, since it
> seems like the builder might have to be modified with a function to do
> the copying. Any hints on how to do this?

I think this is best solved using a hook for the "build-finished" event.
Put this in your conf.py:

def build_finished_handler(app, exception):
    if app.builder.format != 'html' or exception is not None:
        # not a HTML build, or a failed one
        return
    # ...copy the files here...
    # interesting values are app.srcdir, app.outdir
    # also, check out the sphinx.util.copy_static_entry function
    # for a template on copying a directory tree


def setup(app):
    app.connect('build-finished', build_finished_handler)


cheers,
Georg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (GNU/Linux)

iEYEARECAAYFAk0o8XoACgkQN9GcIYhpnLAH+wCgnUUp/71Dm11kUlWSfb002dR4
efoAnRXXwEo33uE/rOFwpgtp6GJCgWPs
=CsdS
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-...@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to