webgen v4.0.2 + Leere Zeile eingefügt
This commit is contained in:
parent
eebdd7bbc8
commit
3060842731
1 changed files with 10 additions and 6 deletions
16
webgen.py
16
webgen.py
|
@ -52,6 +52,9 @@ def edit(headline):
|
|||
if not editor:
|
||||
editor = "vim"
|
||||
subprocess.call([editor, headline])
|
||||
# spellcheck = os.getenv("SPELLCHECK")
|
||||
# if spellcheck:
|
||||
# subprocess.call([spellcheck, " -c ", headline])
|
||||
return headline
|
||||
|
||||
|
||||
|
@ -92,7 +95,7 @@ def selectfile():
|
|||
|
||||
headline = re.sub("\.md$", "", tabelle[int(ausgewaehlt[1])][1])
|
||||
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 len(glob.glob(sourcedir + headline + ".md")) == 0:
|
||||
|
@ -110,6 +113,7 @@ def selectfile():
|
|||
|
||||
return sourcefile, targetfile, headline
|
||||
|
||||
|
||||
def mkdirindex(filesdir, indexfilename, filesdirheadline):
|
||||
"""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 += '<table border="0" class="Neutral">'
|
||||
foot = "</table><br/><strong>You can't avoid chaos.</strong><br/><hr></body> </html>\n"
|
||||
linecounter=0
|
||||
linecounter = 0
|
||||
|
||||
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> " + sizestr + "</td></tr>")
|
||||
dirindexfile.write(line)
|
||||
linecounter+=1
|
||||
linecounter += 1
|
||||
|
||||
dirindexfile.write(foot)
|
||||
return linecounter
|
||||
|
||||
|
||||
|
||||
# Parse arguments "--html", "--stdout" and "Some Headline"
|
||||
# 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
|
||||
|
@ -228,6 +231,7 @@ head1 = (
|
|||
|
||||
# Some fancy css for minimalistic terminal style
|
||||
|
||||
|
||||
style_fn = '<link rel="stylesheet" type="text/css" href="/vimstyles.css">'
|
||||
head2 = "</head><body>\n"
|
||||
body1 = '<a href="./">Back</a><blockquote><strong>Moin</strong></p>'
|
||||
|
@ -249,7 +253,7 @@ if outfile != sys.stdout:
|
|||
print(outputfile)
|
||||
|
||||
# Dig the files-directory and generate an index.
|
||||
linecounter=mkdirindex(filesdir, indexfilename, filesdirheadline)
|
||||
print("Dirindex in ",filesdir," has ", linecounter, "lines")
|
||||
linecounter = mkdirindex(filesdir, indexfilename, filesdirheadline)
|
||||
print("Dirindex in ", filesdir, " has ", linecounter, "lines")
|
||||
|
||||
# Have a nice time.
|
||||
|
|
Loading…
Reference in a new issue