Add htmlescape.py.
This commit is contained in:
parent
cbe1c08a2b
commit
021ba9fafc
1 changed files with 32 additions and 0 deletions
32
htmlescape.py
Normal file
32
htmlescape.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
import html
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from voussoirkit import betterhelp
|
||||
from voussoirkit import vlogging
|
||||
from voussoirkit import pipeable
|
||||
|
||||
log = vlogging.getLogger(__name__, 'htmlescape')
|
||||
|
||||
def htmlescape_argparse(args):
|
||||
text = pipeable.input(args.text, split_lines=False)
|
||||
pipeable.stdout(html.escape(text))
|
||||
return 0
|
||||
|
||||
@vlogging.main_decorator
|
||||
def main(argv):
|
||||
parser = argparse.ArgumentParser(
|
||||
description='''
|
||||
''',
|
||||
)
|
||||
parser.add_argument(
|
||||
'text',
|
||||
help='''
|
||||
''',
|
||||
)
|
||||
parser.set_defaults(func=htmlescape_argparse)
|
||||
|
||||
return betterhelp.go(parser, argv)
|
||||
|
||||
if __name__ == '__main__':
|
||||
raise SystemExit(main(sys.argv[1:]))
|
Loading…
Reference in a new issue