summaryrefslogtreecommitdiffstats
path: root/nikola/plugins/compile/markdown
diff options
context:
space:
mode:
Diffstat (limited to 'nikola/plugins/compile/markdown')
-rw-r--r--nikola/plugins/compile/markdown/__init__.py14
-rw-r--r--nikola/plugins/compile/markdown/mdx_gist.py2
-rw-r--r--nikola/plugins/compile/markdown/mdx_nikola.py6
-rw-r--r--nikola/plugins/compile/markdown/mdx_podcast.py2
4 files changed, 15 insertions, 9 deletions
diff --git a/nikola/plugins/compile/markdown/__init__.py b/nikola/plugins/compile/markdown/__init__.py
index b41c6b5..1376b11 100644
--- a/nikola/plugins/compile/markdown/__init__.py
+++ b/nikola/plugins/compile/markdown/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2013 Roberto Alsina and others.
+# Copyright © 2012-2014 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -50,6 +50,12 @@ except ImportError:
gist_extension = None
podcast_extension = None
+
+try:
+ from collections import OrderedDict
+except ImportError:
+ OrderedDict = None # NOQA
+
from nikola.plugin_categories import PageCompiler
from nikola.utils import makedirs, req_missing
@@ -58,6 +64,7 @@ class CompileMarkdown(PageCompiler):
"""Compile markdown into HTML."""
name = "markdown"
+ demote_headers = True
extensions = [gist_extension, nikola_extension, podcast_extension]
site = None
@@ -75,7 +82,10 @@ class CompileMarkdown(PageCompiler):
out_file.write(output)
def create_post(self, path, onefile=False, **kw):
- metadata = {}
+ if OrderedDict is not None:
+ metadata = OrderedDict()
+ else:
+ metadata = {}
metadata.update(self.default_metadata)
metadata.update(kw)
makedirs(os.path.dirname(path))
diff --git a/nikola/plugins/compile/markdown/mdx_gist.py b/nikola/plugins/compile/markdown/mdx_gist.py
index 3c3bef9..d92295d 100644
--- a/nikola/plugins/compile/markdown/mdx_gist.py
+++ b/nikola/plugins/compile/markdown/mdx_gist.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (c) 2013 Michael Rabbitt.
+# Copyright © 2013 Michael Rabbitt.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
diff --git a/nikola/plugins/compile/markdown/mdx_nikola.py b/nikola/plugins/compile/markdown/mdx_nikola.py
index b0ad2f7..b7c29a5 100644
--- a/nikola/plugins/compile/markdown/mdx_nikola.py
+++ b/nikola/plugins/compile/markdown/mdx_nikola.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright © 2012-2013 Roberto Alsina and others.
+# Copyright © 2012-2014 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
@@ -34,10 +34,6 @@ from markdown.extensions import Extension
class NikolaPostProcessor(Postprocessor):
def run(self, text):
output = text
- # 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)
# python-markdown's highlighter uses the class 'codehilite' to wrap
# code, instead of the standard 'code'. None of the standard
diff --git a/nikola/plugins/compile/markdown/mdx_podcast.py b/nikola/plugins/compile/markdown/mdx_podcast.py
index be8bb6b..b38b969 100644
--- a/nikola/plugins/compile/markdown/mdx_podcast.py
+++ b/nikola/plugins/compile/markdown/mdx_podcast.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright (c) 2013 Michael Rabbitt, Roberto Alsina
+# Copyright © 2013-2014 Michael Rabbitt, Roberto Alsina and others.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the