bugfixes, still not usable
authorSabine Engelhardt (Becker) <frosch@atari-frosch.de>
Sun, 9 Apr 2017 02:36:44 +0000 (04:36 +0200)
committerSabine Engelhardt (Becker) <frosch@atari-frosch.de>
Sun, 9 Apr 2017 02:36:44 +0000 (04:36 +0200)
ToDo
__pycache__/defaults.cpython-34.pyc [new file with mode: 0644]
filters/__pycache__/atarifrosch.cpython-34.pyc
filters/atarifrosch.py
preparesite.py
sites/atarifrosch/backup.zip [deleted file]
sites/atarifrosch/impressum.htm [deleted file]
sites/atarifrosch/impressum.py [deleted file]
sites/atarifrosch/index.htm [deleted file]
sites/atarifrosch/index.py [deleted file]
sites/atarifrosch/menu.py [deleted file]

diff --git a/ToDo b/ToDo
index 6f1481f..8ee1a21 100644 (file)
--- a/ToDo
+++ b/ToDo
@@ -1,5 +1,31 @@
 preparesite.py:
 
-* BUG: creation of non existing directories
+* BUG: menu.py gets written to the source dir instead of target dir
 * BUG: addcssfiles adds the wrong line part
 * BUG: favicon also adds wrong line part to $file.py
+
+* FEAT: logging
+
+* FEAT: if sourcefile is iso-encoded, recode to utf8 before processing
+        -> check for .startswith("<?xml")
+        -> read encoding from that line
+        -> close file, recode using subprocess (need status)
+        -> rename recoded file to original file
+        -> open file again
+
+* FEAT: timestamp of last change as comment in first line of $page.py
+* FEAT: timestamp of last change as comment in first line of $page.py
+
+
+fullsettings.py:
+
+* FEAT: create function makehead
+
+
+htmlglue.py:
+
+* FEAT: create content navigation from menu.py in content file where [CONTENTNAVI]
+  is set
+* FEAT: logging
+
+
diff --git a/__pycache__/defaults.cpython-34.pyc b/__pycache__/defaults.cpython-34.pyc
new file mode 100644 (file)
index 0000000..efa49cf
Binary files /dev/null and b/__pycache__/defaults.cpython-34.pyc differ
index 53184c2..00e594a 100644 (file)
Binary files a/filters/__pycache__/atarifrosch.cpython-34.pyc and b/filters/__pycache__/atarifrosch.cpython-34.pyc differ
index ac53bc9..251b000 100755 (executable)
@@ -5,8 +5,8 @@ origpath = "/srv/atarifrosch/"
 fileext = ".html"
 targetpath = "/home/frosch/projekte/htmlglue/sites/atarifrosch/"
 
-ignoredirs = ["bilder", "computer/hw", "computer/x100e", "depression/tagebuch"]
-ignorefiles = []
+ignoredirs = ["bilder", "hw", "x100e", "tagebuch"]
+ignorefiles = ["STANDARD.html"]
 
 ignorehtml = []
 # This defines a keyword from the first line and a keyword from the
index 76ac5a8..f041da5 100755 (executable)
@@ -5,6 +5,7 @@ import sys, os
 from time import strftime, gmtime
 from datetime import datetime
 from subprocess import call
+from defaults import myversion
 
 sitename = sys.argv[1]
 filterpath = "filters/"
@@ -53,24 +54,36 @@ if len(flt.ignorehtml) > 0:
         ignorehtmlparts = flt.ignorehtml[i].split(" == ")
         ignorehtml[ignorehtmlparts[0]] = ignorehtmlparts[1]
 
+indexfile = "index" + fileext
+
 for dirpath, dirs, files in os.walk(origpath):
+
+    for folder in dirs:
+        curpath = dirpath.replace(origpath, "")
+        targetdir = curpath + "/" + folder
+        mytargetdir = targetpath + curpath + "/" + folder
+        if targetdir not in flt.ignoredirs:
+            if not os.path.exists(mytargetdir):
+                os.mkdir(mytargetdir)
+
     for filename in files:
         curfile = os.path.join(dirpath, filename)
-        if dirs not in flt.ignoredirs and curfile not in flt.ignorefiles and curfile.endswith(fileext):
+        if dirpath not in flt.ignoredirs and filename not in flt.ignorefiles and curfile.endswith(fileext):
             htmlfile = open(curfile, "rt")
             html = htmlfile.read()
             htmlfile.close()
             htmllines = html.split("\n")
 
-            curpath = dirpath.replace(origpath, "/")
+            curpath = dirpath.replace(origpath, "")
+            mytargetpath = targetpath + curpath
+            
+            if not mytargetpath.endswith(curpath):
+                mytargetpath += curpath
+                if not os.path.exists(mytargetpath):
+                    os.mkdir(mytargetpath)
 
-            if curpath != "/":
-                targetpath += curpath
-                if not os.path.exists(targetpath):
-                    os.mkdir(targetpath)
-
-            targethtm = targetpath + filename.replace(".html", ".htm")
-            targetpy = targetpath + filename.replace(".html", ".py")
+            targethtm = mytargetpath + "/" + filename.replace(fileext, ".htm")
+            targetpy = mytargetpath + "/" + filename.replace(fileext, ".py")
 
             htm = open(targethtm, "w")
             pyfile = open(targetpy, "w")
@@ -115,7 +128,7 @@ for dirpath, dirs, files in os.walk(origpath):
                     continue
 
                 if flt.menustart in curline:
-                    if curfile.endswith("index.html"):
+                    if curfile.endswith(indexfile):
                         menuread = True
                         origmenu = curline + "\n"
                     else:
@@ -199,9 +212,9 @@ for dirpath, dirs, files in os.walk(origpath):
                             htmtouchtime = contentpart.replace("-", "") + "0000"
                 elif '<link rel=' in curline:
                     lineparts = curline.split('href="')
-                    contentpart = lineparts[0].split('"', 1)[0]
+                    contentpart = lineparts[1].split('"', 1)[0]
                     contentpart = contentpart.replace("/", "")
-                    if "favicon" in curline:
+                    if "favicon" in contentpart:
                         if contentpart != settings.favicon:
                             pyfile.write("favicon = '" + contentpart + ln)
                     elif "stylesheet" in curline:
@@ -218,17 +231,22 @@ for dirpath, dirs, files in os.walk(origpath):
                     headline = headline.strip()
                     pyfile.write("headline = '" + headline + ln)
 
-            addcssitems = '['
-            for i in range(len(addcssfile)):
-                addcssitems += '"' + addcssfile[i]
-                if i < len(addcssfile):
-                    addcssitems += '", '
                 else:
-                    addcssitems += '"]'
-            pyfile.write("addcssfile = " + addcssitems + ln)
+                    pass
+
+            if len(addcssfile) > 0:
+                addcssitems = '['
+                for i in range(len(addcssfile)):
+                    addcssitems += '"' + addcssfile[i]
+                    if i < len(addcssfile):
+                        addcssitems += '", '
+                    else:
+                        addcssitems += '"]'
+                pyfile.write("addcssfile = " + addcssitems + ln)
+
             pyfile.close()
 
-            if curfile.endswith("index.html"):
+            if curfile.endswith(indexfile):
                 # this tells us the order of the menu items
                 origmenuparts = origmenu.split("\n")
                 # curfilelist = os.dirlist(dirpath)
@@ -236,8 +254,7 @@ for dirpath, dirs, files in os.walk(origpath):
                 menu = open(menufile, "w")
                 menu.write("#!/usr/bin/env python3\n")
                 menu.write("# -*- coding: utf8 -*-\n\n\n")
-                menu.write("# Created automatically with htmlglue/preparesite\n\n")
-                menucounter = 0
+                menu.write("# Created automatically with htmlglue/preparesite" + myversion + "\n\n")
                 for item in range(len(origmenuparts)):
                     curitem = origmenuparts[item].strip()
                     if curitem.startswith("<li"):
@@ -245,6 +262,9 @@ for dirpath, dirs, files in os.walk(origpath):
                             menuclass = curitem.split("class=")[1]
                             menuclass = menuclass.split(">")[0]
                             menuclass = menuclass.replace('"', '')
+                        else:
+                            menuclass = ""
+
                         if "href" in curitem:
                             menuhref = curitem.split("href=")[1]
                             menuhref = menuhref.split(">")
@@ -253,16 +273,14 @@ for dirpath, dirs, files in os.walk(origpath):
                             menuitemname = menuitemname.replace('"', '')
                             if filename.endswith("/"):
                                 filetype = "dir"
-                            elif filename.endswith(".htm") or filename.endswith(".html"):
+                            elif filename.endswith(fileext):
                                 filetype = "htm"
                             else:
                                 filetype = "???"
                             menufilename = filename.replace("/", "")
-                            outline = 'menuitem[' + str(menucounter) + '] = "'
-                            outline += filetype + ', ' + menuclass + ', '
-                            outline += menufilename + ', ' + menuitemname + '"\n'
+                            outline = 'menuitem.append(["' + filetype + '", "' + menuclass + '", "'
+                            outline += menufilename + '", "' + menuitemname + '"])\n'
                             menu.write(outline)
-                            menucounter += 1
 
                 menu.close()
                 call(["/bin/chmod", "755", menufile])
diff --git a/sites/atarifrosch/backup.zip b/sites/atarifrosch/backup.zip
deleted file mode 100644 (file)
index 9ce0ffd..0000000
Binary files a/sites/atarifrosch/backup.zip and /dev/null differ
diff --git a/sites/atarifrosch/impressum.htm b/sites/atarifrosch/impressum.htm
deleted file mode 100644 (file)
index ede3b46..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-      <div id="content">
-        <dl><dt> Postanschrift </dt>
-          <dd> Sabine Becker <br /> Helmholtzstraße&nbsp;53 <br />
-               40215&nbsp;Düsseldorf </dd>
-          <dt> Telefon </dt>
-          <dd> 0211/3368730 </dd>
-          <dt> E-Mail </dt>
-          <dd> Privat: <a href="mailto:frosch@atari-frosch.de">frosch@atari-frosch.de</a><br />
-            <a href="/public-key.asc">PGP-Key</a> ID: 0xBFC81ADE <br />
-               Fingerprint: 88AA 2116 E284 DF71 4310 8C87 D0CF 3AA9 BFC8 1ADE</dd>
-          <dd> Technisches zur Website: <a href="mailto:webmaster@atari-frosch.de">webmaster@atari-frosch.de</a></dd>
-          <dt> Instant Messaging </dt>
-          <dd> Jabber: atarifrosch@jabber.ccc.de oder froschdus@jabber.hot-chilli.net
-            <br />Yahoo: froschdus </dd>
-          <dt> Social Media </dt>
-          <dd> Twitter: <a href="https://twitter.com/AtariFrosch">@AtariFrosch</a><br />
-               GNUsocial: <a href="https://social.stopwatchingus-heidelberg.de/atarifrosch/">@atarifrosch@social.stopwatchingus-heidelberg.de</a><br />
-               Google+: <a href="https://plus.google.com/100090088462847995035/posts">+Sabine „Atari-Frosch“ Engelhardt</a></dd></dl>
-        <p>Diese Seiten wurden erstellt mit dem Programm htmlglue und dem
-           Texteditor joe auf <a href="http://www.debian.org/">Debian GNU/Linux</a>
-           unter Zuhilfenahme von <a href="http://selfhtml.teamone.de/">SelfHTML</a>
-           und (stichprobenartig) überprüft mit dem
-          <a href="http://validator.w3.org/">W3-Validator</a>.
-            Sie benötigen keinen bestimmten Browser, keine bestimmte
-            Bildschirmauflösung, keine Plugins und keine besondere Hardware.</p>
-        <p>Das Atari-Frosch-Logo erstellte Marius Sommer.</p>
-      </div><!-- div#content -->
diff --git a/sites/atarifrosch/impressum.py b/sites/atarifrosch/impressum.py
deleted file mode 100755 (executable)
index 38792ea..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf8 -*-
-
-targetfile = "/impressum.html"
-title = "atari-frosch.de: Impressum"
-description = "Impressum für atari-frosch.de"
-dctitle = "Impressum für atari-frosch.de"
-dcsubject = dctitle 
-
-addhead  = '    <style type="text/css"> tr {border: none;}\n'
-addhead += '      td {border: none; margin: .2em;} td p {margin-top: 1em;}\n'
-addhead += '    </style>\n'
-
-headline = "Impressum"
-
-contentfile = "impressum.htm"
diff --git a/sites/atarifrosch/index.htm b/sites/atarifrosch/index.htm
deleted file mode 100644 (file)
index bb83bcd..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-      <div id="content">
-        <h4>Die meisten Leute nennen mich Frosch, und das hier ist meine
-             „Houmpäidsch“. Also immer herein in die gute Stube!</h4><hr />
-
-        <p>Hier sind gerade Dinge im Umbau. Deshalb können Seiten auch mal
-           ein wenig seltsam aussehen. Wenn irgendwo wirklich was fehlt,
-           was eigentlich da sein sollte, sagt mir bitte
-         <a href="mailto:webmaster@atari-frosch.de">Bescheid</a>.</p>
-
-      </div><!-- div#content -->
diff --git a/sites/atarifrosch/index.py b/sites/atarifrosch/index.py
deleted file mode 100755 (executable)
index b171a3d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-targetfile = "/index.html"
-title = "Willkommen auf Froschs Homepage!"
-description = "Website von Atari-Frosch"
-
-addhead = "SNIPPETS/akvstyle.htm"
-
-replacement["[AKVSBODY]"] = "akvsbody.htm"
-replacement["[GEOCACHING]"] = "menu.geocaching.htm"
-replacement["[CACERT]"] = "menu.cacert.htm"
-
-headline = "Qua®k!"
-
-contentfile = "index.htm"
diff --git a/sites/atarifrosch/menu.py b/sites/atarifrosch/menu.py
deleted file mode 100755 (executable)
index 98ed4a7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf8 -*-
-
-menustart = "SNIPPET/menustart.htm"
-
-menuitem[0]  = "htm, home, index.html, Startseite"
-menuitem[1]  = "dir, close, vorstellung, Vorstellung"
-menuitem[2]  = "dir, close, https://blog.atari-frosch.de/, Blog"
-menuitem[3]  = "dir, close, computer, Computer"
-menuitem[4]  = "dir, close, internet, Internet"
-menuitem[5]  = "dir, close, politik, Politik"
-menuitem[6]  = "dir, close, depression, Depression"
-menuitem[7]  = "dir, close, hobby, Hobbies"
-menuitem[8]  = "dir, close, musik, Musik"
-menuitem[9]  = "dir, close, fotografie, Fotografie"
-menuitem[10] = "dir, close, pretender, Pretender"
-menuitem[11] = "dir, close, flohmarkt, Flohmarkt"
-menuitem[12] = "dir, close, misc, Vermischtes"
-menuitem[13] = "htm, file, impressum.html, Impressum"
-menuitem[14] = "htm, file, probleme.html, Darstellungsprobleme?"
-menuitem[15] = "dir, close, hist, Website-History"
-
-menuend = "SNIPPETS/menuend.htm"
-
-menuadd["GEOCACHING"] = "SNIPPETS/menu.geocaching.htm"
-menuadd["CACERT"] = "SNIPPETS/menu.cacert.htm"
-
-menuaddtofile["index.html"] = menuadd["GEOCACHING"]
-menuaddtofile["index.html"] = menuadd["CACERT"]