Skip to content
Permalink
Browse files

merged master

  • Loading branch information
ralsina committed Jun 14, 2015
2 parents b6cbfcb + ce04019 commit 5bbb34f34035499c8d6de6db61cb3f6339669eeb
Showing with 56 additions and 11 deletions.
  1. +7 −3 CHANGES.txt
  2. +23 −2 docs/manual.txt
  3. +8 −4 nikola/filters.py
  4. +18 −2 nikola/plugins/task/posts.py
@@ -1,16 +1,20 @@
New in Master
New in master
=============

Features
--------

* Add redirection for tags in Wordpress importer (Issue #1168)
* Add support for ``html_tidy_withconfig`` to use a ``tidy5.conf`` file
(Issue #1795)
* Change default tidy5 filters not to drop empty elements (Issue #1795)
* Apply per-post filters via metadata (Issue #914)

Bugfixes
--------

* Fix crash in wordpress code importer (Issue #1819)
* Wrong command was called in nikola auto.
* Call correct command in ``nikola auto``

New in v7.5.1
=============
@@ -19,7 +23,7 @@ Features
--------

* Suggest misspelled commands (Issue #1807)
* New implementation of the ``nikola auto`` command.
* New implementation of the ``nikola auto`` command
* ``requests`` is now required for all Nikola sites
* New ``nikola version --check`` option (Issue #1767)

@@ -503,6 +503,9 @@ to your configuration::
Like tags, except each post can have only one, and they usually have
more descriptive names.

filters
See the `Post Processing Filters`_ section.

hidetitle
Set "True" if you do not want to see the **page** title as a
heading of the output html file (does not work for posts).
@@ -1364,6 +1367,21 @@ html_tidy_wrap_attr
html_tidy_mini
Minify HTML 5 into smaller documents with `tidy5 <http://www.html-tidy.org/>`_

html_tidy_withconfig
Run `tidy5 <http://www.html-tidy.org/>`_ with ``tidy5.conf`` as the config file (supplied by user)

html5lib_minify
Minify HTML5 using html5lib_minify

html5lib_xmllike
Format using html5lib

typogrify
Improve typography using `typogrify <http://static.mintchaos.com/projects/typogrify/>`__

typogrify_sans_widont
Same as typogrify without the widont filter

minify_lines
**THIS FILTER HAS BEEN TURNED INTO A NOOP** and currently does nothing.

@@ -1379,8 +1397,11 @@ optipng
jpegoptim
Compress JPEG files using `jpegoptim <http://www.kokkonen.net/tjko/projects.html>`_

typogrify
Improve typography using `typogrify <https://github.com/mintchaos/typogrify>`_

You can apply filters to specific posts or pages by using the ``filters`` metadata field::

.. filters:: filters.html_tidy_nowrap, "sed s/foo/bar"



Optimizing Your Website
@@ -147,20 +147,24 @@ def jpegoptim(infile):
return runinplace(r"jpegoptim -p --strip-all -q %1", infile)


def html_tidy_withconfig(infile):
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent -config tidy5.conf -modify %1")


def html_tidy_nowrap(infile):
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --tidy-mark no -modify %1")
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1")


def html_tidy_wrap(infile):
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 80 --wrap-sections no --tidy-mark no -modify %1")
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 80 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1")


def html_tidy_wrap_attr(infile):
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes yes --sort-attributes alpha --wrap 80 --wrap-sections no --tidy-mark no -modify %1")
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes yes --sort-attributes alpha --wrap 80 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1")


def html_tidy_mini(infile):
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --tidy-mark no -modify %1")
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --tidy-mark no --drop-empty-elements no -modify %1")


def _html_tidy_runner(infile, options):
@@ -25,9 +25,10 @@
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

from copy import copy
import os

from nikola.plugin_categories import Task
from nikola import utils
from nikola import filters, utils


def update_deps(post, lang, task):
@@ -91,7 +92,22 @@ def tl_ch():
] + post.fragment_deps_uptodate(lang),
'task_dep': ['render_posts:timeline_changes']
}
yield task

# Apply filters specified in the metadata
ff = [x.strip() for x in post.meta('filters', lang).split(',')]
flist = []
for i, f in enumerate(ff):
if not f:
continue
if f.startswith('filters.'): # A function from the filters module
f = f[8:]
try:
flist.append(getattr(filters, f))
except AttributeError:
pass
else:
flist.append(f)
yield utils.apply_filters(task, {os.path.splitext(dest): flist})

def dependence_on_timeline(self, post, lang):
if "####MAGIC####TIMELINE" not in post.fragment_deps(lang):

0 comments on commit 5bbb34f

Please sign in to comment.