diff options
Diffstat (limited to 'nikola/plugins/compile_markdown/__init__.py')
| -rw-r--r-- | nikola/plugins/compile_markdown/__init__.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/nikola/plugins/compile_markdown/__init__.py b/nikola/plugins/compile_markdown/__init__.py index 5eb25c8..7aa03a9 100644 --- a/nikola/plugins/compile_markdown/__init__.py +++ b/nikola/plugins/compile_markdown/__init__.py @@ -55,8 +55,10 @@ class CompileMarkdown(PageCompiler): output = markdown(data, ['fenced_code', 'codehilite']) # h1 is reserved for the title so increment all header levels for n in reversed(range(1, 9)): - output = re.sub('<h%i>' % n, '<h%i>' % (n + 1), output) - output = re.sub('</h%i>' % n, '</h%i>' % (n + 1), output) + output = re.sub('<h{0}>'.format(n), '<h{0}>'.format(n + 1), + output) + output = re.sub('</h{0}>'.format(n), '</h{0}>'.format(n + 1), + output) # python-markdown's highlighter uses the class 'codehilite' to wrap # code, # instead of the standard 'code'. None of the standard # pygments stylesheets use this class, so swap it to be 'code' @@ -69,10 +71,10 @@ class CompileMarkdown(PageCompiler): with codecs.open(path, "wb+", "utf8") as fd: if onefile: fd.write('<!-- \n') - fd.write('.. title: %s\n' % title) - fd.write('.. slug: %s\n' % slug) - fd.write('.. date: %s\n' % date) - fd.write('.. tags: %s\n' % tags) + fd.write('.. title: {0}\n'.format(title)) + fd.write('.. slug: {0}\n'.format(slug)) + fd.write('.. date: {0}\n'.format(date)) + fd.write('.. tags: {0}\n'.format(tags)) fd.write('.. link: \n') fd.write('.. description: \n') fd.write('-->\n\n') |
