Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixup! Add new Tidy5 filters
  • Loading branch information
da2x committed May 3, 2015
1 parent 078077f commit 6eeff35
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nikola/filters.py
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 6eeff35

Please sign in to comment.