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
22a389d0
Commit
22a389d0
authored
Mar 15, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better titles & descriptions
parent
da76bd70
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
docs/template.html
+3
-3
mkdocs.py
+12
-0
No files found.
docs/template.html
View file @
22a389d0
...
@@ -2,11 +2,11 @@
...
@@ -2,11 +2,11 @@
<html
lang=
"en"
>
<html
lang=
"en"
>
<head><meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<head><meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<title>
Django REST framework - APIs made easy.
</title>
<title>
{{ title }}
</title>
<link
href=
"{{ base_url }}/img/favicon.ico"
rel=
"icon"
type=
"image/x-icon"
>
<link
href=
"{{ base_url }}/img/favicon.ico"
rel=
"icon"
type=
"image/x-icon"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"description"
content=
""
>
<meta
name=
"description"
content=
"
{{ description }}
"
>
<meta
name=
"author"
content=
""
>
<meta
name=
"author"
content=
"
Tom Christie
"
>
<!-- Le styles -->
<!-- Le styles -->
<link
href=
"{{ base_url }}/css/prettify.css"
rel=
"stylesheet"
>
<link
href=
"{{ base_url }}/css/prettify.css"
rel=
"stylesheet"
>
...
...
mkdocs.py
View file @
22a389d0
...
@@ -57,24 +57,36 @@ for (dirpath, dirnames, filenames) in os.walk(docs_dir):
...
@@ -57,24 +57,36 @@ for (dirpath, dirnames, filenames) in os.walk(docs_dir):
toc
=
''
toc
=
''
text
=
open
(
path
,
'r'
)
.
read
()
.
decode
(
'utf-8'
)
text
=
open
(
path
,
'r'
)
.
read
()
.
decode
(
'utf-8'
)
main_title
=
None
description
=
'Django, API, REST'
for
line
in
text
.
splitlines
():
for
line
in
text
.
splitlines
():
if
line
.
startswith
(
'# '
):
if
line
.
startswith
(
'# '
):
title
=
line
[
2
:]
.
strip
()
title
=
line
[
2
:]
.
strip
()
template
=
main_header
template
=
main_header
description
=
description
+
', '
+
title
elif
line
.
startswith
(
'## '
):
elif
line
.
startswith
(
'## '
):
title
=
line
[
3
:]
.
strip
()
title
=
line
[
3
:]
.
strip
()
template
=
sub_header
template
=
sub_header
else
:
else
:
continue
continue
if
not
main_title
:
main_title
=
title
anchor
=
title
.
lower
()
.
replace
(
' '
,
'-'
)
.
replace
(
':-'
,
'-'
)
.
replace
(
"'"
,
''
)
.
replace
(
'?'
,
''
)
.
replace
(
'.'
,
''
)
anchor
=
title
.
lower
()
.
replace
(
' '
,
'-'
)
.
replace
(
':-'
,
'-'
)
.
replace
(
"'"
,
''
)
.
replace
(
'?'
,
''
)
.
replace
(
'.'
,
''
)
template
=
template
.
replace
(
'{{ title }}'
,
title
)
template
=
template
.
replace
(
'{{ title }}'
,
title
)
template
=
template
.
replace
(
'{{ anchor }}'
,
anchor
)
template
=
template
.
replace
(
'{{ anchor }}'
,
anchor
)
toc
+=
template
+
'
\n
'
toc
+=
template
+
'
\n
'
if
filename
==
'index.md'
:
main_title
=
'Django REST framework - APIs made easy'
else
:
main_title
=
'Django REST framework - '
+
main_title
content
=
markdown
.
markdown
(
text
,
[
'headerid'
])
content
=
markdown
.
markdown
(
text
,
[
'headerid'
])
output
=
page
.
replace
(
'{{ content }}'
,
content
)
.
replace
(
'{{ toc }}'
,
toc
)
.
replace
(
'{{ base_url }}'
,
base_url
)
.
replace
(
'{{ suffix }}'
,
suffix
)
.
replace
(
'{{ index }}'
,
index
)
output
=
page
.
replace
(
'{{ content }}'
,
content
)
.
replace
(
'{{ toc }}'
,
toc
)
.
replace
(
'{{ base_url }}'
,
base_url
)
.
replace
(
'{{ suffix }}'
,
suffix
)
.
replace
(
'{{ index }}'
,
index
)
output
=
output
.
replace
(
'{{ title }}'
,
main_title
)
output
=
output
.
replace
(
'{{ description }}'
,
description
)
output
=
output
.
replace
(
'{{ page_id }}'
,
filename
[:
-
3
])
output
=
output
.
replace
(
'{{ page_id }}'
,
filename
[:
-
3
])
output
=
re
.
sub
(
r'a href="([^"]*)\.md"'
,
r'a href="\1
%
s"'
%
suffix
,
output
)
output
=
re
.
sub
(
r'a href="([^"]*)\.md"'
,
r'a href="\1
%
s"'
%
suffix
,
output
)
output
=
re
.
sub
(
r'<pre><code>:::bash'
,
r'<pre class="prettyprint lang-bsh">'
,
output
)
output
=
re
.
sub
(
r'<pre><code>:::bash'
,
r'<pre class="prettyprint lang-bsh">'
,
output
)
...
...
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