diff options
| author | Stephan Groß | 2012-11-21 11:56:34 +0100 |
|---|---|---|
| committer | Stephan Groß | 2012-11-21 11:56:34 +0100 |
| commit | 6ba4df8a27016fd5e60a3852eea6c97231a03281 (patch) | |
| tree | 935bb3d51a9c3f4307d2d83d4b4c2e4d884886e3 /mkdocs.py | |
| parent | ed713d0354b67bdc64de9346b9a72e1adfced76e (diff) | |
| parent | 3268c67343f6fc6364a0127a7bfabeb907a4751d (diff) | |
| download | django-rest-framework-6ba4df8a27016fd5e60a3852eea6c97231a03281.tar.bz2 | |
Merge remote-tracking branch 'upstream/master' into regex_field
Conflicts:
docs/topics/release-notes.md
Diffstat (limited to 'mkdocs.py')
| -rwxr-xr-x | mkdocs.py | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -11,6 +11,7 @@ docs_dir = os.path.join(root_dir, 'docs') html_dir = os.path.join(root_dir, 'html') local = not '--deploy' in sys.argv +preview = '-p' in sys.argv if local: base_url = 'file://%s/' % os.path.normpath(os.path.join(os.getcwd(), html_dir)) @@ -80,3 +81,15 @@ for (dirpath, dirnames, filenames) in os.walk(docs_dir): output = re.sub(r'<pre>', r'<pre class="prettyprint lang-py">', output) output = re.sub(r'<a class="github" href="([^"]*)"></a>', code_label, output) open(output_path, 'w').write(output.encode('utf-8')) + +if preview: + import subprocess + + url = 'html/index.html' + + try: + subprocess.Popen(["open", url]) # Mac + except OSError: + subprocess.Popen(["xdg-open", url]) # Linux + except: + os.startfile(url) # Windows |
