Skip to content

Commit

Permalink
Fix #1795 -- tidy5 config and defaults
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jun 13, 2015
1 parent 11cb0bf commit 59f51e4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 5 additions & 2 deletions CHANGES.txt
Expand Up @@ -4,13 +4,16 @@ New in master
Features
--------

* 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
=============
Expand All @@ -19,7 +22,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)

Expand Down
3 changes: 3 additions & 0 deletions docs/manual.txt
Expand Up @@ -1367,6 +1367,9 @@ 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

Expand Down
12 changes: 8 additions & 4 deletions nikola/filters.py
Expand Up @@ -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):
Expand Down

0 comments on commit 59f51e4

Please sign in to comment.