diff options
Diffstat (limited to 'mkdocs.py')
| -rwxr-xr-x | mkdocs.py | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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() @@ -66,4 +67,7 @@ for (dirpath, dirnames, filenames) in os.walk(docs_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 = 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')) |
