Skip to content

Commit

Permalink
add new command line flag allowing for chaning of the pre attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
mankyd committed Feb 17, 2013
1 parent 5570729 commit 31986ff
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/quickstart.rst
Expand Up @@ -92,6 +92,11 @@ any time by running `htmlmin -h`::
to prevent minification. This attribute is removed by default. Set this flag to
keep the 'pre' attributes in place.

-a PRE_ATTR, --pre-attr PRE_ATTR
The attribute htmlmin looks for to find blocks of HTML that it should not
minify. This attribute will be removed from the HTML unless '-k' is
specified. Defaults to 'pre'.

-p [TAG [TAG ...]], --pre-tags [TAG [TAG ...]]
By default, the contents of 'pre', and 'textarea' tags are left unminified.
You can specify different tags using the --pre-tags option. 'script' and 'style'
Expand Down
11 changes: 11 additions & 0 deletions htmlmin/command.py
Expand Up @@ -78,6 +78,16 @@
'''),
action='store_true')

parser.add_argument('-a', '--pre-attr',
help=(
'''The attribute htmlmin looks for to find blocks of HTML that it should not
minify. This attribute will be removed from the HTML unless '-k' is
specified. Defaults to 'pre'.
'''),
default='pre')


parser.add_argument('-p', '--pre-tags',
metavar='TAG',
help=(
Expand All @@ -101,6 +111,7 @@ def main():
remove_empty_space=args.remove_empty_space,
pre_tags=args.pre_tags,
keep_pre=args.keep_pre_attr,
pre_attr=args.pre_attr,
)
if args.input_file:
inp = codecs.open(args.input_file, encoding=args.encoding)
Expand Down

0 comments on commit 31986ff

Please sign in to comment.