Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve usability of CLI processor #36

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CLI/criticParser_CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,14 @@ def markProcess(group_object):
parser.add_argument('-o','--output', help='Path to store the output file, including file name', metavar='out-file', type=argparse.FileType('wt'), required=False)
parser.add_argument('-css','--css', help='Path to a custom CSS file, including file name', metavar='in-file', type=argparse.FileType('rt'),required=False)
parser.add_argument('-b', '--browser', help='View the output file in the default browser after saving.', action='store_true')
parser.add_argument('-e', '--encoding', help='Encoding of input (default: UTF-8)', action='store', default="UTF-8")


args = parser.parse_args()
try:



if args.source:
inputFile = open(args.source, "r")
inputFile = codecs.open(args.source, "r", encoding=args.encoding)
inputText = inputFile.read()
inputFile.close()
else:
Expand Down Expand Up @@ -349,15 +349,15 @@ def markProcess(group_object):



enc_info = "\n" + '<meta charset="{}">'.format(args.encoding)

if (args.css):
css_file = args.css
cssText = css_file.read()
css_file.close()
h = head + cssText + bodybegin + h + headend
h = head + enc_info + cssText + bodybegin + h + headend
else:
h = jq + a + bodybegin + h + headend
h = jq + enc_info + a + bodybegin + h + headend



Expand All @@ -372,7 +372,7 @@ def markProcess(group_object):
filesource.close()
print "\nOutput file created: ", abs_path
else:
path, filename = os.path.split(args.source)
path, filename = os.path.split(os.path.abspath(args.source))
print "Converting >> " + args.source
output_file = path+'/'+filename.split(os.extsep, 1)[0]+'_CriticParseOut.html'
file = open(output_file, 'w')
Expand Down