sphinx-doc / sphinx-autobuild

Watch a Sphinx directory and rebuild the documentation when a change is detected. Also includes a hot-reload web server.
MIT License
524 stars 75 forks source link

Add capability to select random port and automatically start browser at URL #36

Closed davedittrich closed 8 years ago

davedittrich commented 8 years ago

When working with multiple Sphinx document repositories at one time (e.g., when working with related documents that have cross-referencing intersphinx links), I often need to have multiple browser windows active with multiple sphinx-autobuild processes running. It became tedious and difficult to manually give them all unique port numbers and to start browser windows. These two changes allow a script that includes lines like those below to automatically open browser windows for every Sphinx document I am working on as I run sphinx-autobuild.

Sorry that I didn't include documentation changes and tests. I just don't have the time (but the changes are very minor, with a good bang-for-the-buck value, so I wanted to at least contribute them for consideration).

Clean out any cached content before starting.

make clean 2>/dev/null

Background a trigger for initial build of all files.

(sleep 1 && touch source/*.rst) &

sphinx-autobuild -q \ -p 0 \ --open-browser \ --delay 5 \ --ignore ".swp" \ --ignore ".pdf" \ --ignore ".log" \ --ignore ".out" \ --ignore ".toc" \ --ignore ".aux" \ --ignore ".idx" \ --ignore ".ind" \ --ignore ".ilg" \ --ignore ".tex" \ source \ build/html

davedittrich commented 8 years ago

OK. I actually did need to follow through with changes to requirements.txt and add documentation, but I can't figure out how to amend my pull request. I will add a second to cover those changes. Sorry about the hassle.

davedittrich commented 8 years ago

OK, I learned you can't have two pull requests active at one time. It looks like all the commits are included here, though, so hopefully I haven't made a huge mess.

GaretJax commented 8 years ago

Thanks for the contribution @davedittrich!

Could you please reformat the code to be PEP8 compliant? See https://travis-ci.org/GaretJax/sphinx-autobuild/jobs/88714619#L378-L385 for the details. I'll happily merge it afterwards.

davedittrich commented 8 years ago

I did the reformatting and it passes now. Thanks!

Dave

On Wed, Nov 4, 2015 at 7:02 AM, Jonathan Stoppani notifications@github.com wrote:

Thanks for the contribution @davedittrich https://github.com/davedittrich!

Could you please reformat the code to be PEP8 compliant? See https://travis-ci.org/GaretJax/sphinx-autobuild/jobs/88714619#L378-L385 for the details. I'll happily merge it afterwards.

— Reply to this email directly or view it on GitHub https://github.com/GaretJax/sphinx-autobuild/pull/36#issuecomment-153754764 .

Dave Dittrich dave.dittrich@gmail.com

GaretJax commented 8 years ago

Thanks :+1:

davedittrich commented 8 years ago

You're welcome. Keep up the good work! I like these tools.

On Wed, Nov 4, 2015 at 12:15 PM, Jonathan Stoppani <notifications@github.com

wrote:

Thanks [image: :+1:]

— Reply to this email directly or view it on GitHub https://github.com/GaretJax/sphinx-autobuild/pull/36#issuecomment-153849994 .

Dave Dittrich dave.dittrich@gmail.com