aboutsummaryrefslogtreecommitdiffstats
path: root/mkdocs.py
diff options
context:
space:
mode:
authorTom Christie2012-09-08 22:06:13 +0100
committerTom Christie2012-09-08 22:06:13 +0100
commit247696e820dfe4535b3141d744129d654f9b6aea (patch)
treefee3e54b16f459b0b0501ee83122cc4b9b06c3cb /mkdocs.py
parent5d9dfcd8ae10db37f0cca043d3b9977e27197487 (diff)
downloaddjango-rest-framework-247696e820dfe4535b3141d744129d654f9b6aea.tar.bz2
Links to source files in docs
Diffstat (limited to 'mkdocs.py')
-rwxr-xr-xmkdocs.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/mkdocs.py b/mkdocs.py
index 0acb14d1..7fb0bc17 100755
--- a/mkdocs.py
+++ b/mkdocs.py
@@ -24,6 +24,7 @@ else:
main_header = '<li class="main"><a href="#{{ anchor }}">{{ title }}</a></li>'
sub_header = '<li><a href="#{{ anchor }}">{{ title }}</a></li>'
+code_label = r'<a class="github" href="https://github.com/tomchristie/django-rest-framework/blob/restframework2/djangorestframework/\1"><span class="label label-info">\1</span></a>'
page = open(os.path.join(docs_dir, 'template.html'), 'r').read()
@@ -68,4 +69,5 @@ for (dirpath, dirnames, filenames) in os.walk(docs_dir):
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>', r'<pre class="prettyprint lang-py">', output)
+ output = re.sub(r'<a class="github" href="([^"]*)"></a>', code_label, output)
open(build_file, 'w').write(output.encode('utf-8'))