X-Git-Url: http://git.scottworley.com/paperdoorknob/blobdiff_plain/23f3187945d1cf4f3a9cdc43462be2ca39e7023a..929db57622c6b8756ed341d7ae2862126a7c638f:/args.py?ds=sidebyside diff --git a/args.py b/args.py index 2a03836..1931d42 100644 --- a/args.py +++ b/args.py @@ -14,6 +14,7 @@ from typing import Iterator from xdg_base_dirs import xdg_cache_home from fetch import CachingFetcher +from htmlfilter import ApplyHTMLFilters, HTMLFilters from spec import Spec from texify import PandocTexifier @@ -25,6 +26,10 @@ def _command_line_parser() -> ArgumentParser: metavar='PATH', help='Where to keep the http cache (instead of %(default)s)', default=os.path.join(xdg_cache_home(), "paperdoorknob")) + parser.add_argument( + '--htmlfilters', + help='Which HTML filters to use (default: %(default)s)', + default=','.join(f[0] for f in HTMLFilters)) parser.add_argument( '--out', help='The filename stem at which to write output ' + @@ -44,4 +49,9 @@ def spec_from_commandline_args() -> Iterator[Spec]: args = _command_line_parser().parse_args() with CachingFetcher(args.cache_path, args.timeout) as fetcher: with open(args.out + '.tex', 'wb') as texout: - yield Spec(args.url, fetcher, PandocTexifier(args.pandoc or 'pandoc'), texout) + yield Spec( + args.url, + fetcher, + lambda x: ApplyHTMLFilters(args.htmlfilters, x), + PandocTexifier(args.pandoc or 'pandoc'), + texout)