diff options
| author | Tom Christie | 2013-03-15 19:25:12 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-03-15 19:25:12 +0000 |
| commit | 1aedf57f4a1eb7261162977944fe233b00d63b59 (patch) | |
| tree | b091b5e765c5cbe03449961643b6887e5acb9b24 /mkdocs.py | |
| parent | b6b686d285e376dbf4f2d2f15bd0e3ef0f1c3a37 (diff) | |
| parent | 22a389d0ba4dd5ac7b4fa3839491ec2708bbe7df (diff) | |
| download | django-rest-framework-1aedf57f4a1eb7261162977944fe233b00d63b59.tar.bz2 | |
Merge branch 'master' into basic-nested-serialization
Diffstat (limited to 'mkdocs.py')
| -rwxr-xr-x | mkdocs.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -57,24 +57,36 @@ for (dirpath, dirnames, filenames) in os.walk(docs_dir): toc = '' text = open(path, 'r').read().decode('utf-8') + main_title = None + description = 'Django, API, REST' for line in text.splitlines(): if line.startswith('# '): title = line[2:].strip() template = main_header + description = description + ', ' + title elif line.startswith('## '): title = line[3:].strip() template = sub_header else: continue + if not main_title: + main_title = title anchor = title.lower().replace(' ', '-').replace(':-', '-').replace("'", '').replace('?', '').replace('.', '') template = template.replace('{{ title }}', title) template = template.replace('{{ anchor }}', anchor) 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']) 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 = 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) |
