diff options
| author | Robert Romano | 2012-11-18 21:07:44 -0800 |
|---|---|---|
| committer | Robert Romano | 2012-11-18 21:07:44 -0800 |
| commit | f5f1ac49ec9d9cb180a00c791f2701c3f5a2d65b (patch) | |
| tree | 663e254f3125d1281035d471fc4fa38d7ca3ee3d /mkdocs.py | |
| parent | d541e0c42326443b613df764cbe26a68b852b71d (diff) | |
| parent | d1472740bc5f08871343d1a63e409e34d05504cb (diff) | |
| download | django-rest-framework-f5f1ac49ec9d9cb180a00c791f2701c3f5a2d65b.tar.bz2 | |
Update robromano fork with upstream master
Conflicts:
docs/topics/credits.md
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 |
