webgen v4.0.3 + Spellcheck + Env. variable 'SPELLCHECK'
This commit is contained in:
parent
3060842731
commit
17265fcf69
1 changed files with 17 additions and 4 deletions
21
webgen.py
21
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
|
# 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/")
|
webbasedir = os.path.expanduser("~/www/i21k.de/")
|
||||||
targetdir = webbasedir + "posts/"
|
targetdir = webbasedir + "posts/"
|
||||||
sourcedir = os.path.expanduser("~/python/webgen/")
|
sourcedir = os.path.expanduser("~/python/webgen/")
|
||||||
|
|
||||||
### for module mkdirindex:
|
### for module mkdirindex:
|
||||||
filesdir = webbasedir + "files/"
|
filesdir = webbasedir + "files/"
|
||||||
indexfilename = "index.html"
|
indexfilename = "index.html"
|
||||||
filesdirheadline = "Files"
|
filesdirheadline = "Files"
|
||||||
####
|
####
|
||||||
|
|
||||||
|
# for spellchecko
|
||||||
|
# Preferred: aspell -c filename
|
||||||
|
#
|
||||||
|
spellcheck = "aspell"
|
||||||
|
spellcheckparam = "-c"
|
||||||
|
|
||||||
fileending = ""
|
fileending = ""
|
||||||
locale.setlocale(locale.LC_ALL, "")
|
locale.setlocale(locale.LC_ALL, "")
|
||||||
clear = "\x1b[2J\x1b[H"
|
clear = "\x1b[2J\x1b[H"
|
||||||
|
@ -47,14 +54,20 @@ signal.signal(signal.SIGINT, sigint_handler)
|
||||||
|
|
||||||
|
|
||||||
# call favorite editor with filename to write the text
|
# call favorite editor with filename to write the text
|
||||||
|
# i am not shure bout that spellchecko, is it nessesary?
|
||||||
|
|
||||||
|
|
||||||
def edit(headline):
|
def edit(headline):
|
||||||
editor = os.getenv("EDITOR")
|
editor = os.getenv("EDITOR")
|
||||||
if not editor:
|
if not editor:
|
||||||
editor = "vim"
|
editor = "vim"
|
||||||
subprocess.call([editor, headline])
|
subprocess.call([editor, headline])
|
||||||
# spellcheck = os.getenv("SPELLCHECK")
|
spellcheck = os.getenv("SPELLCHECK")
|
||||||
# if spellcheck:
|
if spellcheck:
|
||||||
# subprocess.call([spellcheck, " -c ", headline])
|
print(yellow)
|
||||||
|
if input("You like to spellcheck it [y/N]?") == "y":
|
||||||
|
subprocess.call([spellcheck, spellcheckparam, headline])
|
||||||
|
print(green)
|
||||||
return headline
|
return headline
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue