From 17265fcf69f2f6c54bc5a0143a267ef0e633c93b Mon Sep 17 00:00:00 2001 From: Wolfgang Nowak Date: Tue, 5 Jul 2022 17:24:45 +0200 Subject: [PATCH] webgen v4.0.3 + Spellcheck + Env. variable 'SPELLCHECK' --- webgen.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/webgen.py b/webgen.py index cd7d427..14da1ba 100755 --- a/webgen.py +++ b/webgen.py @@ -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