Skip to content
Permalink
Browse files
fixup! Add new Tidy5 filters
  • Loading branch information
da2x committed May 3, 2015
1 parent 078077f commit 6eeff35e84ea0d45372efcda3787b40cc269c1e6
Showing with 6 additions and 0 deletions.
  1. +6 −0 nikola/filters.py
@@ -146,18 +146,23 @@ def optipng(infile):
def jpegoptim(infile):
return runinplace(r"jpegoptim -p --strip-all -q %1", infile)


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")


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")


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")


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")


def _html_tidy_runner(infile, options):
""" Warnings (returncode 1) are not critical, and *everything* is a warning """
try:
@@ -166,6 +171,7 @@ def _html_tidy_runner(infile, options):
status = 0 if err.returncode is 1 else err.returncode
return status


@apply_to_text_file
def minify_lines(data):
return data

0 comments on commit 6eeff35

Please sign in to comment.