Replace --bare command line flag with --input-format choices.
Chris Pressey
1 year, 2 months ago
97 | 97 |
the semantics of the language.
|
98 | 98 |
|
99 | 99 |
-> Functionality "Parse Eqthy Document" is implemented by shell command
|
100 | |
-> "python3 bin/eqthy --bare --dump-ast %(test-body-file) 2>&1 > /dev/null && echo 'ok'"
|
|
100 |
-> "python3 bin/eqthy --input-format=bare --dump-ast %(test-body-file) 2>&1 > /dev/null && echo 'ok'"
|
101 | 101 |
|
102 | 102 |
### Parse Eqthy Document
|
103 | 103 |
|
|
139 | 139 |
### Check Eqthy Document
|
140 | 140 |
|
141 | 141 |
-> Functionality "Check Eqthy Document" is implemented by shell command
|
142 | |
-> "python3 bin/eqthy --bare %(test-body-file) && echo 'ok'"
|
|
142 |
-> "python3 bin/eqthy --input-format=bare %(test-body-file) && echo 'ok'"
|
143 | 143 |
|
144 | 144 |
-> Tests for functionality "Check Eqthy Document"
|
145 | 145 |
|
24 | 24 |
|
25 | 25 |
argparser.add_argument(
|
26 | 26 |
'input_files', nargs='+', metavar='FILENAME', type=str,
|
27 | |
help='Source files containing the scenario descriptions'
|
|
27 |
help='Path to source file containing an Eqthy document'
|
28 | 28 |
)
|
29 | 29 |
|
30 | 30 |
argparser.add_argument(
|
31 | |
"--bare",
|
32 | |
action="store_true",
|
33 | |
help="Treat the input as bare Eqthy that is not embedded in Markdown"
|
|
31 |
"--input-format",
|
|
32 |
type=str,
|
|
33 |
choices=("markdown", "bare"),
|
|
34 |
default="markdown",
|
|
35 |
help="Select the format of the input files. Default is Eqthy embedded in Markdown."
|
34 | 36 |
)
|
35 | 37 |
argparser.add_argument(
|
36 | 38 |
"--dump-ast",
|
|
59 | 61 |
with codecs.open(filename, 'r', encoding='UTF-8') as f:
|
60 | 62 |
text = f.read()
|
61 | 63 |
|
62 | |
if not options.bare:
|
|
64 |
if options.input_format == 'markdown':
|
63 | 65 |
text = extract_from_markdown(text)
|
64 | 66 |
|
65 | 67 |
p = Parser(text, filename)
|