Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
merged master
  • Loading branch information
ralsina committed May 22, 2015
2 parents 1990a5b + 6bc0dd4 commit f2477e9
Show file tree
Hide file tree
Showing 19 changed files with 334 additions and 230 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Expand Up @@ -5,13 +5,16 @@ Features
--------

* Support [code] in wordpress importers (Issue #1186)
* New `nikola status` command
* Cleaner formatting of HTML output
* Allowing category hierarchies via new option CATEGORY_ALLOW_HIERARCHIES
(Issue #1520)

Bugfixes
--------

* Scanning of posts refactored out of core (Issue #1700)
* github_deploy records lastdeploy timestamp like regular deploy
* Use a global directory for gallery images, ignoring translations (Issue #1726)
* The post-list directive only triggers rebuilds if timeline changes (Issue #1688)
* Don’t check the same remote URL more than once (Issue #1732)
Expand Down
7 changes: 7 additions & 0 deletions docs/extending.txt
Expand Up @@ -432,6 +432,13 @@ Does nothing specific, can be used to modify the site object (and thus the confi
Put all the magic you want in ``set_site()``, and don’t forget to run the one
from ``super()``.

PostScanner Plugins
-------------------

Get posts and stories from "somewhere" to be added to the timeline.
The only currently existing plugin of this kind reads them from disk.


Plugin Index
============

Expand Down
13 changes: 5 additions & 8 deletions docs/internals.txt
Expand Up @@ -95,17 +95,14 @@ posts are added into RSS feeds and stories are not. All of them are in a list ca
"the timeline" formed by objects of class ``Post``.

When you are creating a task that needs the list of posts and/or stories (for example,
the RSS creation plugin), your plugin should call ``self.site.scan_posts()`` to ensure
the timeline is created and available in ``self.site.timeline``. You should not modify
the timeline, because it will cause consistency issues.
the RSS creation plugin) on task execution time, your plugin should call ``self.site.scan_posts()``
in ``gen_tasks`` to ensure the timeline is created and available in
``self.site.timeline``. You should not modify the timeline, because it will cause consistency issues.

.. sidebar:: scan_posts

The scan_posts function is what reads your site and creates the timeline.

I am considering moving scan_posts off the core and into its own plugin
so it can be replaced (for example, by a version that reads a database
instead of scanning a folder tree).
The ``Nikola.scan_posts`` function can be used in plugins to force the
timeline creation, for example, while creating the tasks.

Your plugin can use the timeline to generate "stuff" (technical term). For example,
Nikola comes with plugins that use the timeline to create a website (surprised?).
Expand Down
Binary file modified docs/man/nikola.1.gz
Binary file not shown.
1 change: 0 additions & 1 deletion docs/sphinx/upgrading-to-v6.txt

This file was deleted.

111 changes: 0 additions & 111 deletions docs/upgrading-to-v6.txt

This file was deleted.

20 changes: 13 additions & 7 deletions nikola/__main__.py
Expand Up @@ -48,7 +48,7 @@
from . import __version__
from .plugin_categories import Command
from .nikola import Nikola
from .utils import sys_decode, get_root_dir, req_missing, LOGGER, STRICT_HANDLER, ColorfulStderrHandler
from .utils import sys_decode, sys_encode, get_root_dir, req_missing, LOGGER, STRICT_HANDLER, ColorfulStderrHandler

if sys.version_info[0] == 3:
import importlib.machinery
Expand All @@ -71,20 +71,26 @@ def main(args=None):
if args is None:
args = sys.argv[1:]

oargs = args
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] == b'--conf=':
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

quiet = False
if len(args) > 0 and args[0] == b'build' and b'--strict' in args:
if len(args) > 0 and args[0] == 'build' and '--strict' in args:
LOGGER.notice('Running in strict mode')
STRICT_HANDLER.push_application()
if len(args) > 0 and args[0] == b'build' and b'-q' in args or b'--quiet' in args:
if len(args) > 0 and args[0] == 'build' and '-q' in args or '--quiet' in args:
nullhandler = NullHandler()
nullhandler.push_application()
quiet = True
Expand Down Expand Up @@ -112,7 +118,7 @@ def main(args=None):
loader = importlib.machinery.SourceFileLoader("conf", conf_filename)
conf = loader.load_module()
else:
conf = imp.load_source("conf", conf_filename)
conf = imp.load_source("conf", conf_filename_bytes)
config = conf.__dict__
except Exception:
if os.path.exists(conf_filename):
Expand All @@ -129,7 +135,7 @@ def main(args=None):

invariant = False

if len(args) > 0 and args[0] == b'build' and b'--invariant' in args:
if len(args) > 0 and args[0] == 'build' and '--invariant' in args:
try:
import freezegun
freeze = freezegun.freeze_time("2038-01-01")
Expand All @@ -153,7 +159,7 @@ def main(args=None):
DN = DoitNikola(site, quiet)
if _RETURN_DOITNIKOLA:
return DN
_ = DN.run(args)
_ = DN.run(oargs)

if site.invariant:
freeze.stop()
Expand Down
1 change: 0 additions & 1 deletion nikola/data/samplesite/stories/upgrading-to-v6.txt

This file was deleted.

0 comments on commit f2477e9

Please sign in to comment.