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

Cannot turn off --html-safe command line option (true by default) #299

Open
adno opened this issue Dec 25, 2022 · 0 comments
Open

Cannot turn off --html-safe command line option (true by default) #299

adno opened this issue Dec 25, 2022 · 0 comments

Comments

@adno
Copy link

adno commented Dec 25, 2022

Due to a bug, the only way to turn off the --html-safe command line option is passing an empty argument (that evaluates as false in Python) like this:

wikiextractor --html-safe ""

The following does not work :

wikiextractor --no-html-safe
wikiextractor --html-safe false

The argument is currently defined like this:

groupP.add_argument("--html-safe", default=True,
help="use to produce HTML safe output within <doc>...</doc>")

This means that any parameter is converted to string, and then evaluates as true unless empty. One simple way of correctly defining a boolean argument with default true value would be:

parser.add_argument("--html-safe", default=True, action=argparse.BooleanOptionalAction,
                        help="use to produce HTML safe output within <doc>...</doc>")

This way the parser would accept both --html-safe and --no-html-safe and also generate appropriate help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant