webgen v4.0.3 + Spellcheck + Env. variable 'SPELLCHECK'

This commit is contained in:
Wolfgang Nowak 2022-07-05 17:24:45 +02:00
parent 3060842731
commit 17265fcf69

View file

@ -5,16 +5,23 @@ from dialog import Dialog
# If not choosen stdout as output, where should the generated file go to and what
# fileending (f.e. .html) shall it have
# fileending (f.e. .html) shall it have. Preset values.
webbasedir = os.path.expanduser("~/www/i21k.de/")
targetdir = webbasedir + "posts/"
sourcedir = os.path.expanduser("~/python/webgen/")
### for module mkdirindex:
filesdir = webbasedir + "files/"
indexfilename = "index.html"
filesdirheadline = "Files"
####
# for spellchecko
# Preferred: aspell -c filename
#
spellcheck = "aspell"
spellcheckparam = "-c"
fileending = ""
locale.setlocale(locale.LC_ALL, "")
clear = "\x1b[2J\x1b[H"
@ -47,14 +54,20 @@ signal.signal(signal.SIGINT, sigint_handler)
# call favorite editor with filename to write the text
# i am not shure bout that spellchecko, is it nessesary?
def edit(headline):
editor = os.getenv("EDITOR")
if not editor:
editor = "vim"
subprocess.call([editor, headline])
# spellcheck = os.getenv("SPELLCHECK")
# if spellcheck:
# subprocess.call([spellcheck, " -c ", headline])
spellcheck = os.getenv("SPELLCHECK")
if spellcheck:
print(yellow)
if input("You like to spellcheck it [y/N]?") == "y":
subprocess.call([spellcheck, spellcheckparam, headline])
print(green)
return headline