Skip to content
Permalink
Browse files
Merge pull request #2838 from getnikola/v8-cleanup
v8: cleanup and a few features
  • Loading branch information
Kwpolska committed Jun 16, 2017
2 parents a6164a4 + d71da82 commit 4f2574cad09d4a67849e2277193c918472cf4f02
Showing with 276 additions and 1,350 deletions.
  1. +0 −1 .travis.yml
  2. +22 −0 CHANGES.txt
  3. +1 −1 README.rst
  4. +0 −1 appveyor.yml
  5. +12 −11 docs/creating-a-theme.txt
  6. +13 −28 docs/manual.txt
  7. +1 −2 docs/template-variables.rst
  8. +2 −5 docs/theming.txt
  9. +5 −2 nikola/__init__.py
  10. +4 −14 nikola/__main__.py
  11. +3 −29 nikola/conf.py.in
  12. +13 −13 nikola/data/samplesite/pages/quickstart.rst
  13. +2 −1 nikola/data/themes/base-jinja/templates/base_helper.tmpl
  14. +2 −2 nikola/data/themes/base-jinja/templates/math_helper.tmpl
  15. +1 −1 nikola/data/themes/base/assets/css/ipython.min.css
  16. +0 −63 nikola/data/themes/base/assets/css/nikola_ipython.css
  17. +1 −3 nikola/data/themes/base/messages/messages_ar.py
  18. +1 −3 nikola/data/themes/base/messages/messages_az.py
  19. +1 −3 nikola/data/themes/base/messages/messages_bg.py
  20. +1 −3 nikola/data/themes/base/messages/messages_bs.py
  21. +1 −3 nikola/data/themes/base/messages/messages_ca.py
  22. +1 −3 nikola/data/themes/base/messages/messages_cs.py
  23. +1 −3 nikola/data/themes/base/messages/messages_da.py
  24. +1 −3 nikola/data/themes/base/messages/messages_de.py
  25. +1 −3 nikola/data/themes/base/messages/messages_el.py
  26. +1 −3 nikola/data/themes/base/messages/messages_en.py
  27. +1 −3 nikola/data/themes/base/messages/messages_eo.py
  28. +1 −3 nikola/data/themes/base/messages/messages_es.py
  29. +1 −3 nikola/data/themes/base/messages/messages_et.py
  30. +1 −3 nikola/data/themes/base/messages/messages_eu.py
  31. +1 −3 nikola/data/themes/base/messages/messages_fa.py
  32. +1 −3 nikola/data/themes/base/messages/messages_fi.py
  33. +1 −3 nikola/data/themes/base/messages/messages_fil.py
  34. +1 −3 nikola/data/themes/base/messages/messages_fr.py
  35. +1 −3 nikola/data/themes/base/messages/messages_gl.py
  36. +1 −3 nikola/data/themes/base/messages/messages_he.py
  37. +1 −3 nikola/data/themes/base/messages/messages_hi.py
  38. +1 −3 nikola/data/themes/base/messages/messages_hr.py
  39. +1 −3 nikola/data/themes/base/messages/messages_hu.py
  40. +1 −3 nikola/data/themes/base/messages/messages_id.py
  41. +1 −3 nikola/data/themes/base/messages/messages_it.py
  42. +1 −3 nikola/data/themes/base/messages/messages_ja.py
  43. +1 −3 nikola/data/themes/base/messages/messages_ko.py
  44. +1 −3 nikola/data/themes/base/messages/messages_lt.py
  45. +1 −3 nikola/data/themes/base/messages/messages_nb.py
  46. +1 −3 nikola/data/themes/base/messages/messages_nl.py
  47. +1 −3 nikola/data/themes/base/messages/messages_pa.py
  48. +1 −3 nikola/data/themes/base/messages/messages_pl.py
  49. +1 −3 nikola/data/themes/base/messages/messages_pt.py
  50. +1 −3 nikola/data/themes/base/messages/messages_pt_br.py
  51. +1 −3 nikola/data/themes/base/messages/messages_ru.py
  52. +1 −3 nikola/data/themes/base/messages/messages_si_lk.py
  53. +1 −3 nikola/data/themes/base/messages/messages_sk.py
  54. +1 −3 nikola/data/themes/base/messages/messages_sl.py
  55. +1 −3 nikola/data/themes/base/messages/messages_sq.py
  56. +1 −3 nikola/data/themes/base/messages/messages_sr.py
  57. +1 −3 nikola/data/themes/base/messages/messages_sr_latin.py
  58. +1 −3 nikola/data/themes/base/messages/messages_sv.py
  59. +1 −3 nikola/data/themes/base/messages/messages_te.py
  60. +1 −3 nikola/data/themes/base/messages/messages_tl.py
  61. +1 −3 nikola/data/themes/base/messages/messages_tr.py
  62. +1 −3 nikola/data/themes/base/messages/messages_uk.py
  63. +1 −3 nikola/data/themes/base/messages/messages_ur.py
  64. +1 −3 nikola/data/themes/base/messages/messages_zh_cn.py
  65. +1 −3 nikola/data/themes/base/messages/messages_zh_tw.py
  66. +2 −1 nikola/data/themes/base/templates/base_helper.tmpl
  67. +2 −2 nikola/data/themes/base/templates/math_helper.tmpl
  68. +0 −5 nikola/data/themes/bootstrap3-jinja/templates/base.tmpl
  69. +0 −5 nikola/data/themes/bootstrap3-jinja/templates/base_helper.tmpl
  70. +0 −5 nikola/data/themes/bootstrap3/templates/base.tmpl
  71. +0 −5 nikola/data/themes/bootstrap3/templates/base_helper.tmpl
  72. +0 −1 nikola/hierarchy_utils.py
  73. +0 −1 nikola/image_processing.py
  74. +20 −180 nikola/nikola.py
  75. +1 −10 nikola/plugin_categories.py
  76. +0 −2 nikola/plugins/__init__.py
  77. +1 −3 nikola/plugins/basic_import.py
  78. +1 −8 nikola/plugins/command/auto/__init__.py
  79. +0 −1 nikola/plugins/command/bootswatch_theme.py
  80. +1 −2 nikola/plugins/command/check.py
  81. +0 −1 nikola/plugins/command/console.py
  82. +0 −1 nikola/plugins/command/deploy.py
  83. +0 −1 nikola/plugins/command/github_deploy.py
  84. +1 −11 nikola/plugins/command/import_wordpress.py
  85. +3 −6 nikola/plugins/command/init.py
  86. +0 −13 nikola/plugins/command/install_theme.plugin
  87. +0 −91 nikola/plugins/command/install_theme.py
  88. +0 −1 nikola/plugins/command/new_page.py
  89. +2 −3 nikola/plugins/command/new_post.py
  90. +0 −1 nikola/plugins/command/orphans.py
  91. +0 −1 nikola/plugins/command/plugin.py
  92. +1 −2 nikola/plugins/command/rst2html/__init__.py
  93. +1 −3 nikola/plugins/command/serve.py
  94. +0 −1 nikola/plugins/command/status.py
  95. +0 −1 nikola/plugins/command/theme.py
  96. +0 −1 nikola/plugins/command/version.py
  97. +1 −2 nikola/plugins/compile/html.py
  98. +2 −2 nikola/plugins/compile/ipynb.plugin
  99. +19 −36 nikola/plugins/compile/ipynb.py
  100. +1 −2 nikola/plugins/compile/markdown/__init__.py
  101. +0 −1 nikola/plugins/compile/markdown/mdx_gist.py
  102. +0 −1 nikola/plugins/compile/markdown/mdx_nikola.py
  103. +0 −1 nikola/plugins/compile/markdown/mdx_podcast.py
  104. +0 −1 nikola/plugins/compile/pandoc.py
  105. +1 −2 nikola/plugins/compile/php.py
  106. +1 −7 nikola/plugins/compile/rest/__init__.py
  107. +0 −1 nikola/plugins/compile/rest/listing.py
  108. +4 −22 nikola/plugins/compile/rest/post_list.py
  109. +0 −1 nikola/plugins/compile/rest/slides.py
  110. +0 −12 nikola/plugins/misc/post_encryption.plugin
  111. +0 −118 nikola/plugins/misc/post_encryption.py
  112. +0 −1 nikola/plugins/misc/scan_posts.py
  113. +0 −1 nikola/plugins/misc/taxonomies_classifier.py
  114. +0 −1 nikola/plugins/task/authors.py
  115. +0 −1 nikola/plugins/task/bundles.py
  116. +0 −7 nikola/plugins/task/categories.py
  117. +1 −2 nikola/plugins/task/copy_assets.py
  118. +0 −1 nikola/plugins/task/galleries.py
  119. +0 −1 nikola/plugins/task/indexes.py
  120. +0 −1 nikola/plugins/task/listings.py
  121. +0 −1 nikola/plugins/task/page_index.py
  122. +0 −1 nikola/plugins/task/pages.py
  123. +0 −13 nikola/plugins/task/py3_switch.plugin
  124. +0 −103 nikola/plugins/task/py3_switch.py
  125. +0 −1 nikola/plugins/task/redirect.py
  126. +0 −1 nikola/plugins/task/robots.py
  127. +0 −1 nikola/plugins/task/sections.py
  128. +8 −13 nikola/plugins/task/sitemap/__init__.py
  129. +0 −1 nikola/plugins/task/tagcloud.py
  130. +0 −7 nikola/plugins/task/tags.py
  131. +0 −1 nikola/plugins/task/taxonomies.py
  132. +0 −1 nikola/plugins/template/jinja.py
  133. +0 −10 nikola/plugins/template/mako.py
  134. +0 −8 nikola/post.py
  135. +0 −84 nikola/rc4.py
  136. +5 −7 nikola/shortcodes.py
  137. +2 −7 nikola/state.py
  138. +14 −56 nikola/utils.py
  139. +0 −1 nikola/winutils.py
  140. +1 −0 requirements.txt
  141. +2 −2 scripts/baseline.sh
  142. +1 −2 scripts/document_path_handlers.py
  143. +2 −5 scripts/import_po.py
  144. +0 −3 setup.cfg
  145. +4 −11 setup.py
  146. +1 −11 tests/base.py
  147. +0 −8 tests/data/translated_titles/conf.py
  148. +0 −1 tests/import_wordpress_and_build_workflow.py
  149. +0 −1 tests/test_command_import_wordpress.py
  150. +0 −1 tests/test_command_init.py
  151. +0 −1 tests/test_commands.py
  152. +0 −1 tests/test_compile_markdown.py
  153. +12 −12 tests/test_integration.py
  154. +2 −7 tests/test_locale.py
  155. +0 −1 tests/test_plugin_importing.py
  156. +0 −1 tests/test_rss_feeds.py
  157. +0 −3 tests/test_rst_compiler.py
  158. +0 −1 tests/test_scheduling.py
  159. +15 −26 tests/test_shortcodes.py
  160. +0 −1 tests/test_slugify.py
  161. +9 −16 tests/test_template_shortcodes.py
  162. +2 −3 tests/test_utils.py
@@ -11,7 +11,6 @@ addons:
- language-pack-en-base
- language-pack-pl-base
python:
- '2.7'
- '3.3'
- '3.4'
- '3.5'
@@ -1,3 +1,25 @@
New in master
=============

Features
--------

* Use ``PRETTY_URLS`` by default on all sites (Issue #1838)

Bugfixes
--------
* Use Jupyter name more consistently in docs
* Support CODE_COLOR_SCHEME in Jupyter notebooks (Issue #2093)


Removed features
----------------
* Drop Python 2 support
* Remove ``nikola install_theme`` — use ``nikola theme`` instead
* Drop insecure post encryption feature
* Stop supporting all deprecated config options
* Drop annotations support (annotateit.org closed down in March 2017)

New in v7.8.8
=============

@@ -43,7 +43,7 @@ It has many features, but here are some of the nicer ones:
* Syntax highlighting for almost any programming language or markup
* Multilingual sites, `translated to 50 languages.`__
* Doesn't reinvent wheels, leverages existing tools.
* Python 2.7, 3.3, 3.4, 3.5 and 3.6 compatible.
* Python 3.3+ compatible.

.. _Nikola Handbook: https://getnikola.com/handbook.html#why-static
__ https://users.getnikola.com/
@@ -2,7 +2,6 @@
build: false
environment:
matrix:
- PYTHON: "C:/Python27"
- PYTHON: "C:/Python36"
init:
- "ECHO %PYTHON%"
@@ -17,7 +17,7 @@ create themes. Since I **suck** at designing websites, I asked for opinions on t
and got some feedback. Since this is **Not So Hard™**, I will try to make time to port a few
and see what happens.

If you are looking for a reference, check out `Theming reference <theming.html>`_ and `Template variables <https://getnikola.com/template-variables.html>`_.
If you are looking for a reference, check out :doc:`Theming reference <theming>` and `Template variables <https://getnikola.com/template-variables.html>`_.

Today’s theme is `Lanyon <https://github.com/poole/lanyon>`__ which is written by `@mdo <https://twitter.com/mdo>`__
and released under a MIT license, which is liberal enough.
@@ -176,7 +176,7 @@ see something fairly similar:
<meta name="viewport" content="width=device-width">
<title>My Nikola Site | My Nikola Site</title>

<link href="assets/css/rst.css" rel="stylesheet" type="text/css">
<link href="assets/css/html4css1.css" rel="stylesheet" type="text/css">
<link href="assets/css/code.css" rel="stylesheet" type="text/css">
<link href="assets/css/theme.css" rel="stylesheet" type="text/css">

@@ -199,10 +199,11 @@ in a particular way, using a setting called ``CODE_COLOR_SCHEME`` where you can
what color scheme the syntax highlighter uses. You can use your own ``assets/css/code.css`` if you
don’t like the provided ones.

Nikola **requires** ``assets/css/rst.css`` and ``assets/css/code.css`` to function properly.
We will also add themes for IPython Notebook (``assets/css/ipython.min.css``
Nikola **requires** ``assets/css/html4css1.css`` and ``assets/css/code.css`` to function properly.
We will also add themes for Jupyter (``assets/css/ipython.min.css``
and ``assets/css/nikola_ipython.css``) into the template; note that they are
activated only if you configured your ``POSTS``/``PAGES`` with ipynb support.
There’s also ``assets/css/nikola_rst.css``, which adds Bootstrap 3-style reST notes etc.

But how do I tell **our** lanyon theme to use those CSS files instead of whatever it’s using now?
By giving our theme its own base_helper.tmpl.
@@ -226,7 +227,8 @@ The part we want to change is this:
<link href="/assets/css/all-nocdn.css" rel="stylesheet" type="text/css">
%endif
%else:
<link href="/assets/css/rst.css" rel="stylesheet" type="text/css">
<link href="/assets/css/html4css1.css" rel="stylesheet" type="text/css">
<link href="/assets/css/nikola_rst.css" rel="stylesheet" type="text/css">
<link href="/assets/css/code.css" rel="stylesheet" type="text/css">
<link href="/assets/css/theme.css" rel="stylesheet" type="text/css">
%if has_custom_css:
@@ -247,7 +249,8 @@ And we will change it so it uses the lanyon styles instead of theme.css (again,
%if use_bundles:
<link href="/assets/css/all.css" rel="stylesheet" type="text/css">
%else:
<link href="/assets/css/rst.css" rel="stylesheet" type="text/css">
<link href="/assets/css/html4css1.css" rel="stylesheet" type="text/css">
<link href="/assets/css/nikola_rst.css" rel="stylesheet" type="text/css">
<link href="/assets/css/poole.css" rel="stylesheet" type="text/css">
<link href="/assets/css/lanyon.css" rel="stylesheet" type="text/css">
<link href="/assets/css/code.css" rel="stylesheet" type="text/css">
@@ -326,7 +329,6 @@ all the interesting stuff:
<%namespace name="base" file="base_helper.tmpl" import="*"/>
<%namespace name="header" file="base_header.tmpl" import="*"/>
<%namespace name="footer" file="base_footer.tmpl" import="*"/>
<%namespace name="annotations" file="annotation_helper.tmpl"/>
${set_locale(lang)}
${base.html_headstart()}
<%block name="extra_head">
@@ -362,7 +364,6 @@ So, first, lets change that base template to be more lanyon-like:
<%namespace name="base" file="base_helper.tmpl" import="*"/>
<%namespace name="header" file="base_header.tmpl" import="*"/>
<%namespace name="footer" file="base_footer.tmpl" import="*"/>
<%namespace name="annotations" file="annotation_helper.tmpl"/>
${set_locale(lang)}
${base.html_headstart()}
<%block name="extra_head">
@@ -401,7 +402,7 @@ So, first, lets change that base template to be more lanyon-like:
And that’s after I exposed the sidebar by clicking on an invisible widget!

One problem, which causes that yellow color in the sidebar is a CSS conflict.
We are loading ``rst.css`` which specifies
We are loading ``html4css1.css`` which specifies
the background color of ``div.sidebar`` which is more specific than
``lanyon.css``, which specifies for ``.sidebar`` alone.

@@ -505,7 +506,7 @@ and at the bottom a label for the sidebar toggle. Easy to do in ``base.tmpl``

Getting there!

The sidebar looks bad because of yet more CSS conflicts with ``rst.css``. By
The sidebar looks bad because of yet more CSS conflicts with ``html4css1.css``. By
adding some extra styling in ``lanyon.css``, it will look better.

.. code:: css
@@ -815,7 +816,7 @@ which makes sites load faster. To do that, your theme needs a ``bundles`` file w

For the Lanyon theme, it should be like this::

assets/css/all.css=rst.css,code.css,poole.css,lanyon.css,custom.css
assets/css/all.css=html4css1.css,nikola_rst.css,code.css,poole.css,lanyon.css,custom.css

**Note:** Some themes also support the ``USE_CDN`` option meaning that in some cases it will load one bundle with all CSS and in other will load some CSS files
from a CDN and others from a bundle. This is complicated and probably not worth the effort.
@@ -78,7 +78,7 @@ Nikola can't do:
* Twitter
* Facebook
* An Issue tracker
* Anything with forms, really (except for `comments <#comments-and-annotations>`_!)
* Anything with forms, really (except for `comments`_!)

Keep in mind that "static" doesn't mean **boring**. You can have animations, slides
or whatever fancy CSS3/HTML5 thingie you like. It only means all that HTML is
@@ -136,7 +136,7 @@ Obsolescence
You may say those are long term issues, or that they won't matter for years. Well,
I believe things should work forever, or as close to it as we can make them.
Nikola's static output and its input files will work as long as you can install
a Python 2.7/3.3 or newer under Linux, Windows, or OS X and can find a server
Python 3.3 or newer under Linux, Windows, or OS X and can find a server
that sends files over HTTP. That's probably 10 or 15 years at least.

Also, static sites are easily handled by the Internet Archive.
@@ -227,7 +227,7 @@ easier to keep it in a single location.
The contents of your post have to be written (by default) in `reStructuredText <http://docutils.sf.net>`__
but you can use a lot of different markups using the ``-f`` option.

Currently, Nikola supports reStructuredText, Markdown, Jupyter (IPython) Notebooks, HTML as input,
Currently, Nikola supports reStructuredText, Markdown, Jupyter Notebooks, HTML as input,
can also use Pandoc for conversion, and has support for BBCode, CreoleWiki, txt2tags, Textile
and more via plugins — for more details, read the `input format documentation
<#multiple-input-formats>`__.
@@ -326,9 +326,6 @@ author
Author of the post, will be used in the RSS feed and possibly in the post
display (theme-dependent)

annotations / noannotations
Override the value of the ``ANNOTATIONS`` option for this specific post or page.

enclosure
Add an enclosure to this post when it's used in RSS. See `more information about enclosures <http://en.wikipedia.org/wiki/RSS_enclosure>`__

@@ -1035,7 +1032,7 @@ Nikola supports multiple input formats. Out of the box, we have compilers avail

* reStructuredText (default and pre-configured)
* `Markdown`_
* `Jupyter/IPython Notebook`_
* `Jupyter Notebook`_
* `HTML`_
* `PHP`_
* anything `Pandoc`_ supports (including Textile, DocBook, LaTeX, MediaWiki,
@@ -1093,12 +1090,12 @@ config option:
Nikola comes with some Markdown Extensions built-in and enabled by default,
namely a gist directive, a podcast directive, and ``~~strikethrough~~`` support.

Jupyter/IPython Notebook
````````````````````````
Jupyter Notebook
````````````````

To use Jupyter Notebooks (previously known as IPython Notebooks) as posts/pages,
make sure ``ipynb`` is in your ``COMPILERS`` and that the ``.ipynb`` extension
is defined in ``POSTS`` and ``PAGES``.
To use Jupyter Notebooks as posts/pages, make sure ``ipynb`` is in your
``COMPILERS`` and that the ``.ipynb`` extension is defined in ``POSTS`` and
``PAGES``.

The ``-f`` argument to ``new_post`` should be used in the ``ipynb@KERNEL`` format.
It defaults to Python in the version used by Nikola if not specified.
@@ -1411,7 +1408,7 @@ CSS tweaking
for minimal disruption of the provided CSS files.

If you feel tempted to touch other files in assets, you probably will be better off
with a `custom theme <theming.html>`__.
with a :doc:`custom theme <theming>`.

If you want to use LESS_ or Sass_ for your custom CSS, or the theme you use
contains LESS or Sass code that you want to override, you will need to install
@@ -1425,7 +1422,7 @@ CSS tweaking

Template tweaking and creating themes
If you really want to change the pages radically, you will want to do a
`custom theme <theming.html>`__.
:doc:`custom theme <theming>`.

Navigation Links
The ``NAVIGATION_LINKS`` option lets you define what links go in a sidebar or menu
@@ -1718,8 +1715,8 @@ GitLab also offers rebuild automation if you want to use Nikola with GitLab
Pages. Check out the example `Nikola site on GitLab
<https://gitlab.com/pages/nikola>`_.

Comments and Annotations
------------------------
Comments
--------

While Nikola creates static sites, there is a minimum level of user interaction you
are probably expecting: comments.
@@ -1799,18 +1796,6 @@ You can disable comments for a post by adding a "nocomments" metadata field to i
You need jQuery, but not because Facebook wants it (see Issue
#639).

An alternative or complement to comments are annotations. Nikola integrates
the annotation service provided by `AnnotateIt. <http://annotateit.org/>`_
To use it, set the ``ANNOTATIONS`` option to True. This is specially useful
if you want feedback on specific parts of your writing.

You can enable or disable annotations for specific posts or pages using the
``annotations`` and ``noannotations`` metadata.

Annotations require jQuery and are therefore not supported in the base theme.
You can check bootstrap theme's ``base.html`` for details on how to handle them in
custom themes.

Images and Galleries
--------------------

@@ -39,7 +39,6 @@ Name Type Descript
================================== ================================== ================================================================================
``_link`` function ``Nikola.link`` function
``abs_link`` function ``Nikola.abs_link`` function
``annotations`` bool ``ANNOTATIONS`` setting
``author_pages_generated`` bool False
``blog_author`` TranslatableSetting<str> ``BLOG_AUTHOR`` setting
``blog_description`` TranslatableSetting<str> ``BLOG_DESCRIPTION`` setting
@@ -78,7 +77,7 @@ Name Type Descript
``meta_generator_tag`` bool ``META_GENERATOR_TAG`` setting
``momentjs_locales`` defaultdict<str, str> dictionary of available Moment.js locales
``navigation_links`` TranslatableSetting ``NAVIGATION_LINKS`` setting
``needs_ipython_css`` bool whether or not IPython CSS is needed by this site
``needs_ipython_css`` bool whether or not Jupyter CSS is needed by this site
``posts_sections`` bool ``POSTS_SECTIONS`` setting
``posts_section_are_indexes`` bool ``POSTS_SECTIONS_ARE_INDEXES`` setting
``posts_sections_are_indexes`` bool ``POSTS_SECTIONS_ARE_INDEXES`` setting
@@ -19,7 +19,7 @@ Theming Nikola
.. class:: lead

This document is a reference about themes. If you want a tutorial, please read
`Creating a Theme <creating-a-theme.html>`_. If you’re looking for a ready-made
:doc:`Creating a Theme <creating-a-theme>`. If you’re looking for a ready-made
theme for your site, check out the `Themes Index <https://themes.getnikola.com/>`_.

The Structure
@@ -78,7 +78,7 @@ bundles

.. code:: text

assets/css/all.css=bootstrap.css,rst.css,code.css,colorbox.css,custom.css
assets/css/all.css=bootstrap.css,html4css1.css,nikola_rst.css,code.css,colorbox.css,custom.css

This creates a file called "assets/css/all.css" in your output that is the
combination of all the other file paths, relative to the output file.
@@ -195,9 +195,6 @@ These are the templates that come with the included themes:
Template used to render the multipost indexes. The posts are in a ``posts`` variable.
Some functionality is in the ``index_helper.tmpl`` helper template.

``annotation_helper.tmpl`` (internal)
Code for the optional annotations feature.

``archive_navigation_helper.tmpl``
Code that implements archive navigation (previous/up/next). Included by
archive templates.
@@ -26,11 +26,14 @@

"""Nikola -- a modular, fast, simple, static website generator."""

from __future__ import absolute_import
import os
import sys

__version__ = '7.8.8'
__version__ = '8.0.0.dev0'
DEBUG = bool(os.getenv('NIKOLA_DEBUG'))

if sys.version_info[0] == 2:
raise Exception("Nikola does not support Python 2.")

from .nikola import Nikola # NOQA
from . import plugins # NOQA
@@ -26,8 +26,6 @@

"""The main function of Nikola."""

from __future__ import print_function, unicode_literals

import os
import shutil
import sys
@@ -51,18 +49,15 @@
from .plugin_categories import Command
from .utils import (LOGGER, STDERR_HANDLER, STRICT_HANDLER,
ColorfulStderrHandler, get_root_dir, req_missing,
sys_decode, sys_encode)
sys_decode)

try:
import readline # NOQA
except ImportError:
pass # This is only so raw_input/input does nicer things if it's available


if sys.version_info[0] == 3:
import importlib.machinery
else:
import imp
import importlib.machinery

config = {}

@@ -85,14 +80,12 @@ def main(args=None):
args = [sys_decode(arg) for arg in args]

conf_filename = 'conf.py'
conf_filename_bytes = b'conf.py'
conf_filename_changed = False
for index, arg in enumerate(args):
if arg[:7] == '--conf=':
del args[index]
del oargs[index]
conf_filename = arg[7:]
conf_filename_bytes = sys_encode(arg[7:])
conf_filename_changed = True
break

@@ -129,11 +122,8 @@ def main(args=None):

sys.path.append('')
try:
if sys.version_info[0] == 3:
loader = importlib.machinery.SourceFileLoader("conf", conf_filename)
conf = loader.load_module()
else:
conf = imp.load_source("conf", conf_filename_bytes)
loader = importlib.machinery.SourceFileLoader("conf", conf_filename)
conf = loader.load_module()
config = conf.__dict__
except Exception:
if os.path.exists(conf_filename):

0 comments on commit 4f2574c

Please sign in to comment.