Good stuff, looks handy, I'll have to try it out. On Sat, Apr 25, 2009 at 11:15 PM, Damien Lebrun <[email protected]> wrote: > Hi Mickael, > I already started a project project for it: > http://github.com/dinoboff/github-tools > It comes with the this extension, a PasteScript template and some paver > task. > 2009/4/25 Michael Jones <[email protected]> >> >> HI, >> >> I've created a script to prepare the sphinx html output for github >> pages though your approach is better. Do you mind if I put the code up >> on: >> >> http://github.com/michaeljones/sphinx-to-github/tree/master >> >> As an extension? >> >> Michael >> >> On Fri, Apr 17, 2009 at 8:13 PM, dinoboff <[email protected]> wrote: >> > >> > It seems to work if I replace the pathto template helper and move the >> > folder _static/ to static/ when the documentation is built: >> > >> > import os >> > import shutil >> > >> > >> > def setup(app): >> > app.connect('html-page-context', change_pathto) >> > app.connect('build-finished', move_private_folders) >> > >> > def change_pathto(app, pagename, templatename, context, doctree): >> > """ >> > Replace pathto helper to change paths to folders with a leading >> > underscore. >> > """ >> > pathto = context.get('pathto') >> > def gh_pathto(otheruri, *args, **kw): >> > if otheruri.startswith('_'): >> > otheruri = otheruri[1:] >> > return pathto(otheruri, *args, **kw) >> > context['pathto'] = gh_pathto >> > >> > def move_private_folders(app, e): >> > """ >> > remove leading underscore from folders in in the output folder >> > """ >> > def join(dir): >> > return os.path.join(app.builder.outdir, dir) >> > >> > for item in os.listdir(app.builder.outdir): >> > if item.startswith('_') and os.path.isdir(join(item)): >> > shutil.move(join(item), join(item[1:])) >> > > >> > >> >> > > > > >
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en -~----------~----~----~----~------~----~------~--~---
