Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
3cfb23e4
Commit
3cfb23e4
authored
Nov 16, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #419 from markotibold/the_feature_nobody_asked_for
./mkdocs.py -p opens a preview in your default browser
parents
2f2bde69
cba181f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
mkdocs.py
+13
-0
No files found.
mkdocs.py
View file @
3cfb23e4
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment