webgen v4.0.4 bugfixes

This commit is contained in:
Wolfgang Nowak 2022-07-06 17:06:35 +02:00
parent 17265fcf69
commit df387d741e

View file

@ -19,6 +19,7 @@ filesdirheadline = "Files"
# for spellchecko
# Preferred: aspell -c filename
#
dospellcheck = os.getenv("SPELLCHECK")
spellcheck = "aspell"
spellcheckparam = "-c"
@ -62,8 +63,7 @@ def edit(headline):
if not editor:
editor = "vim"
subprocess.call([editor, headline])
spellcheck = os.getenv("SPELLCHECK")
if spellcheck:
if dospellcheck:
print(yellow)
if input("You like to spellcheck it [y/N]?") == "y":
subprocess.call([spellcheck, spellcheckparam, headline])
@ -170,13 +170,13 @@ def mkdirindex(filesdir, indexfilename, filesdirheadline):
return linecounter
# Parse arguments "--html", "--stdout" and "Some Headline"
# Parse arguments "--html", "--stdout", --spellcheck and "Some Headline"
# there are 3 parameters. if --html is given, the fileending will be .html.
# Else, if stdout is choosen there can be no fileending, but it will still contain html
# the name of the program is stored in myname
# dont set a name to outfile, it just is initialised here and will be overwritten
optwords = ["--html", "--stdout"]
optwords = ["--html", "--stdout", "--spellcheck"]
outfile = ""
args = sys.argv
myname = args.pop(0)
@ -185,6 +185,9 @@ for wish in optwords:
if wish == "--html":
fileending = ".html"
args.pop(args.index(wish))
if wish == "--spellcheck":
dospellcheck = "y"
args.pop(args.index(wish))
if wish == "--stdout":
outfile = sys.stdout
args.pop(args.index(wish))