CSS and HTML corrected and validated

master
Stefan Krulj 15 years ago
parent 8fc01d24ee
commit af36d6cbb0
  1. 2
      mdx_math.py
  2. 25
      pylog.py
  3. 12
      pylog_action_impl.py
  4. 1
      source.css
  5. 2
      style.css

@ -11,7 +11,7 @@ class MathPattern(Pattern):
texcode=m.group(2)
el = markdown.util.etree.Element('img')
el.attrib["src"]="tex.cgi?"+self.unescape(texcode)
el.attrib["src"]="tex.cgi?"+self.unescape(texcode.replace(' ','%20'))
el.attrib["alt"]=self.unescape(texcode)
return el

@ -16,11 +16,9 @@ __version = "v0.1-(2012-03-15)"
def header():
script = sys.argv[0][sys.argv[0].rindex('/')+1:]
print '<head>'
print '<meta charset="UTF-8">'
print '<title>'+cfg.title+'</title>'
print '<h1 id="blogtitle"><a href="'+script+'">'+cfg.blogtitle+'</a></h1>'
print '<h2 id="subtitle">'+cfg.subtitle+'</h2>'
print cfg.header
print '</head>'
@ -48,7 +46,7 @@ def file_entry(f,path,depth,hidden):
def process_dirs(path='.',disppath='.',depth=0,hidden=False):
dirlist = os.listdir(path)
if len(dirlist)!=0:
dir_begin(disppath,hidden)
dir_begin(disppath,hidden,depth)
dirs = []
files = []
for f in dirlist:
@ -70,7 +68,7 @@ def process_dirs(path='.',disppath='.',depth=0,hidden=False):
else:
file_entry(f,disppath,depth,hidden)
dir_end(disppath,hidden)
dir_end(disppath,hidden,depth)
def disp_list(path):
if path==cfg.contentdir:
@ -105,7 +103,7 @@ def disp_file_dict(d,keys):
if typ in prev_actions and not os.path.isdir(f):
sys.stdout.write('<h1><a class="entryheader" href="'+script+'?')
sys.stdout.write(urllib.urlencode({'path': os.path.normpath(os.path.dirname(f)), \
'disp':os.path.normpath(f)})+'">')
'disp':os.path.normpath(f)}).replace('&','&amp;')+'">')
print name+'</a> - <span class="entrydate">',
print datetime.fromtimestamp(int(k)).strftime(cfg.datefmt),
print '</span></h1>'
@ -163,14 +161,16 @@ def get_valid_path(path):
return os.path.normpath(path)
if not 'rss' in form:
sys.stdout.write('Content-type: text/html\n\n')
sys.stdout.write('Content-type: text/html; charset=utf-8\n\n')
else:
import xml.etree.ElementTree as ET
sys.stdout.write('Content-type: text/xml\n\n')
script = sys.argv[0][sys.argv[0].rindex('/')+1:]
files,keys=get_newest(cfg.numofposts)
tz = str(time.timezone)
tz = time.timezone
tzHHMM = "%03d%02d" % (tz/3600,abs((tz%3600)/60))
print '''<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
@ -183,7 +183,7 @@ else:
print " <generator>Pylog"+__version+"</generator>"
if len(keys)>0:
date=datetime.fromtimestamp(int(keys[0])).strftime("%a, %d %b %Y %H:%M:%S ")
print " <lastBuildDate>"+date+tz+"</lastBuildDate>"
print " <lastBuildDate>"+date+tzHHMM+"</lastBuildDate>"
for k in keys:
date=datetime.fromtimestamp(int(k)).strftime("%a, %d %b %Y %H:%M:%S ")
@ -207,7 +207,7 @@ else:
print " ",
ET.dump(link)
print " <pubDate>"+date+tz+"</pubDate>"
print " <pubDate>"+date+tzHHMM+"</pubDate>"
print " </item>"
print "</channel>"
@ -217,16 +217,19 @@ else:
script = sys.argv[0][sys.argv[0].rindex('/')+1:]
path = cfg.contentdir
if 'path' in form:
path=form['path'].value
path=get_valid_path(path)
print '<!DOCTYPE html>'
print '<html>'
header()
print '<body>'
print '<h1 id="blogtitle"><a href="'+script+'">'+cfg.blogtitle+'</a></h1>'
print '<h2 id="subtitle">'+cfg.subtitle+'</h2>'
print '<div id="menu">'
process_dirs(cfg.contentdir,path)
print '</div>'

@ -7,20 +7,24 @@ import markdown
from HTMLParser import HTMLParser
def dir_begin(path,hidden):
def dir_begin(path,hidden,depth):
if depth!=0:
print '<li>'
print '<ul',
if hidden:
print 'class="hidden"',
print'>'
def dir_end(path,hidden):
def dir_end(path,hidden,depth):
print '</ul>'
if depth!=0:
print '</li>'
def dir_link(name,f,depth,hidden):
script = sys.argv[0][sys.argv[0].rindex('/')+1:]
print ' <li class="link level'+str(depth),
if hidden:
print ' hidden',
print '">'
print ' <a class="menulink" href="'+script+'?'+ urllib.urlencode({'path': os.path.normpath(f)}) +'">'+name+'</a>'
print ' <a class="menulink" href="'+script+'?'+ urllib.urlencode({'path': os.path.normpath(f)}).replace('&','&amp;') +'">'+name+'</a>'
print ' </li>'
def file_link(name,f,depth,hidden):
script = sys.argv[0][sys.argv[0].rindex('/')+1:]
@ -28,7 +32,7 @@ def file_link(name,f,depth,hidden):
if hidden:
print ' hidden',
print '">'
print ' <a class="menulink" href="'+script+'?'+ urllib.urlencode({'path': os.path.normpath(os.path.dirname(f)), 'disp':os.path.normpath(f)}) +'">'+name+'</a>'
print ' <a class="menulink" href="'+script+'?'+ urllib.urlencode({'path': os.path.normpath(os.path.dirname(f)), 'disp':os.path.normpath(f)}).replace('&','&amp;') +'">'+name+'</a>'
print ' </li>'
def disp_txt(path):

@ -6,7 +6,6 @@
.Comment { color: #8080ff; }
.sourcecode {
white-space:wrap;
font-size:10pt;
font-family:monospace;
color:#cccccc;

@ -6,8 +6,8 @@ a {
color:#aa6735;
text-decoration:underline;
font-weight:bold;
a:hover{
}
a:hover{
text-decoration:none;
}

Loading…
Cancel
Save