webgen v4.0.2 + Leere Zeile eingefügt

This commit is contained in:
Wolfgang Nowak 2022-06-11 15:55:23 +02:00
parent eebdd7bbc8
commit 3060842731

View file

@ -52,6 +52,9 @@ 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 spellcheck:
# subprocess.call([spellcheck, " -c ", headline])
return headline return headline
@ -92,7 +95,7 @@ def selectfile():
headline = re.sub("\.md$", "", tabelle[int(ausgewaehlt[1])][1]) headline = re.sub("\.md$", "", tabelle[int(ausgewaehlt[1])][1])
print(headline) print(headline)
# a = input(yellow + "What do we dooo here?") # a = input(yellow + "What do we dooo here?")
# if the searched filename doesnt match an existing file we construct a new one # if the searched filename doesnt match an existing file we construct a new one
if len(glob.glob(sourcedir + headline + ".md")) == 0: if len(glob.glob(sourcedir + headline + ".md")) == 0:
@ -110,6 +113,7 @@ def selectfile():
return sourcefile, targetfile, headline return sourcefile, targetfile, headline
def mkdirindex(filesdir, indexfilename, filesdirheadline): def mkdirindex(filesdir, indexfilename, filesdirheadline):
"""Dig the files-directory and generate an index.""" """Dig the files-directory and generate an index."""
@ -127,7 +131,7 @@ def mkdirindex(filesdir, indexfilename, filesdirheadline):
body1 += '<div class="Statement"> Some files. Maybe useful or not.</div> ' body1 += '<div class="Statement"> Some files. Maybe useful or not.</div> '
body1 += '<table border="0" class="Neutral">' body1 += '<table border="0" class="Neutral">'
foot = "</table><br/><strong>You can't avoid chaos.</strong><br/><hr></body> </html>\n" foot = "</table><br/><strong>You can't avoid chaos.</strong><br/><hr></body> </html>\n"
linecounter=0 linecounter = 0
dirindexfile = open(filesdir + indexfilename, "w") dirindexfile = open(filesdir + indexfilename, "w")
@ -147,13 +151,12 @@ def mkdirindex(filesdir, indexfilename, filesdirheadline):
line = str('<tr><td><a href="' + str(file) + '">' + str(file) + "</a></td><td>&nbsp;" + sizestr + "</td></tr>") line = str('<tr><td><a href="' + str(file) + '">' + str(file) + "</a></td><td>&nbsp;" + sizestr + "</td></tr>")
dirindexfile.write(line) dirindexfile.write(line)
linecounter+=1 linecounter += 1
dirindexfile.write(foot) dirindexfile.write(foot)
return linecounter return linecounter
# Parse arguments "--html", "--stdout" and "Some Headline" # Parse arguments "--html", "--stdout" 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
@ -228,6 +231,7 @@ head1 = (
# Some fancy css for minimalistic terminal style # Some fancy css for minimalistic terminal style
style_fn = '<link rel="stylesheet" type="text/css" href="/vimstyles.css">' style_fn = '<link rel="stylesheet" type="text/css" href="/vimstyles.css">'
head2 = "</head><body>\n" head2 = "</head><body>\n"
body1 = '<a href="./">Back</a><blockquote><strong>Moin</strong></p>' body1 = '<a href="./">Back</a><blockquote><strong>Moin</strong></p>'
@ -249,7 +253,7 @@ if outfile != sys.stdout:
print(outputfile) print(outputfile)
# Dig the files-directory and generate an index. # Dig the files-directory and generate an index.
linecounter=mkdirindex(filesdir, indexfilename, filesdirheadline) linecounter = mkdirindex(filesdir, indexfilename, filesdirheadline)
print("Dirindex in ",filesdir," has ", linecounter, "lines") print("Dirindex in ", filesdir, " has ", linecounter, "lines")
# Have a nice time. # Have a nice time.