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 # for spellchecko
# Preferred: aspell -c filename # Preferred: aspell -c filename
# #
dospellcheck = os.getenv("SPELLCHECK")
spellcheck = "aspell" spellcheck = "aspell"
spellcheckparam = "-c" spellcheckparam = "-c"
@ -62,8 +63,7 @@ def edit(headline):
if not editor: if not editor:
editor = "vim" editor = "vim"
subprocess.call([editor, headline]) subprocess.call([editor, headline])
spellcheck = os.getenv("SPELLCHECK") if dospellcheck:
if spellcheck:
print(yellow) print(yellow)
if input("You like to spellcheck it [y/N]?") == "y": if input("You like to spellcheck it [y/N]?") == "y":
subprocess.call([spellcheck, spellcheckparam, headline]) subprocess.call([spellcheck, spellcheckparam, headline])
@ -170,13 +170,13 @@ def mkdirindex(filesdir, indexfilename, filesdirheadline):
return linecounter 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. # 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 # 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 # the name of the program is stored in myname
# dont set a name to outfile, it just is initialised here and will be overwritten # dont set a name to outfile, it just is initialised here and will be overwritten
optwords = ["--html", "--stdout"] optwords = ["--html", "--stdout", "--spellcheck"]
outfile = "" outfile = ""
args = sys.argv args = sys.argv
myname = args.pop(0) myname = args.pop(0)
@ -185,6 +185,9 @@ for wish in optwords:
if wish == "--html": if wish == "--html":
fileending = ".html" fileending = ".html"
args.pop(args.index(wish)) args.pop(args.index(wish))
if wish == "--spellcheck":
dospellcheck = "y"
args.pop(args.index(wish))
if wish == "--stdout": if wish == "--stdout":
outfile = sys.stdout outfile = sys.stdout
args.pop(args.index(wish)) args.pop(args.index(wish))