diff options
| author | Alec Perkins | 2012-09-09 13:23:07 -0400 |
|---|---|---|
| committer | Alec Perkins | 2012-09-09 13:23:07 -0400 |
| commit | 45001033378a49986d4cd7f5bdf4673b083cdbd0 (patch) | |
| tree | e5eb2cd49d122ba56d63058413cb3d4d138dae7a /mkdocs.py | |
| parent | 0ae5500f34a81005ba0161dacb280a94f768a885 (diff) | |
| parent | d4f8b4cf0683923fe85652f8fd572d2931eb3074 (diff) | |
| download | django-rest-framework-45001033378a49986d4cd7f5bdf4673b083cdbd0.tar.bz2 | |
Merge 'tomchristie/restframework2' into 'browsable-bootstrap'
Diffstat (limited to 'mkdocs.py')
| -rwxr-xr-x | mkdocs.py | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -24,11 +24,12 @@ 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() # Copy static files -for static in ['css', 'js']: +for static in ['css', 'js', 'img']: source = os.path.join(docs_dir, 'static', static) target = os.path.join(html_dir, static) if os.path.exists(target): @@ -65,5 +66,9 @@ for (dirpath, dirnames, filenames) in os.walk(docs_dir): if not os.path.exists(build_dir): os.makedirs(build_dir) output = page.replace('{{ content }}', content).replace('{{ toc }}', toc).replace('{{ base_url }}', base_url).replace('{{ suffix }}', suffix).replace('{{ index }}', index) + 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'<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')) |
