diff --git a/.vimrc b/.vimrc deleted file mode 100644 index 4621d11..0000000 --- a/.vimrc +++ /dev/null @@ -1,5 +0,0 @@ -let html_use_css=1 -let html_number_lines=1 -let html_no_pre=1 -syntax on - diff --git a/pylog.py b/pylog.py index 5b0f153..299bbe7 100755 --- a/pylog.py +++ b/pylog.py @@ -3,25 +3,24 @@ import os,os.path, sys import urllib, cgi +import cgitb +cgitb.enable() +form = cgi.FieldStorage() + from datetime import datetime from pylog_action import * import pylog_config as cfg -form = {} -def init(): - global form - import cgitb - cgitb.enable() - form = cgi.FieldStorage() + print 'Content-type: text/html\n\n' def header(): print '' print ''+cfg.title+'' - print '

'+cfg.blogtitle+'

' - print '

'+cfg.subtitle+'

' + print '

'+cfg.blogtitle+'

' + print '

'+cfg.subtitle+'

' print cfg.header print '' @@ -93,12 +92,12 @@ def disp_list(path): typ = '' name = os.path.basename(f) if typ in prev_actions and not os.path.isdir(f): - sys.stdout.write('

') print name+' - ', print datetime.fromtimestamp(int(k)).strftime(cfg.datefmt), - print '

' + print '' prev_actions[typ](f) @@ -111,7 +110,6 @@ def get_valid_path(path): return cfg.contentdir return os.path.normpath(path) -init() path = cfg.contentdir if 'path' in form: path=form['path'].value @@ -141,12 +139,12 @@ try: typ = '' name = disp if typ in disp_actions: - sys.stdout.write('

') + sys.stdout.write('

') print name+' -

' + print '

' disp_actions[typ](validdisp) else: diff --git a/pylog_action_impl.py b/pylog_action_impl.py index 0774edc..6f7f6dd 100644 --- a/pylog_action_impl.py +++ b/pylog_action_impl.py @@ -3,6 +3,10 @@ import urllib from datetime import datetime import pylog_config as cfg import subprocess,tempfile +try: + import markdown +except: + import markdown2 as markdown from HTMLParser import HTMLParser @@ -31,11 +35,11 @@ def file_link(name,f,depth,hidden): print ' ' def disp_txt(path): - print '
' + print '
' f = open(path) - print f.read() + print markdown.markdown(f.read()) f.close() - print '
' + print '
' class BodyParser(HTMLParser): body=False @@ -68,15 +72,18 @@ def get_source_html(path): #we use a fork of vim to generate a nice syntax highlighted html file #TODO this requires further testing p=subprocess.Popen(["/usr/bin/vim",path,\ - "-n",\ - "-cTOhtml",\ - "-cw! "+tmpfile,\ - "-cq!",\ - "-cq!"],\ - bufsize=2**16,stdout=subprocess.PIPE,stderr=subprocess.PIPE,env={"HOME":os.getcwd()}) + "-nEs",\ + "+syn on",\ + "+let html_no_progress=1",\ + "+let html_use_css=1",\ + "+let html_number_lines=1",\ + "+run! syntax/2html.vim",\ + "+w! "+tmpfile,\ + "+q!",\ + "+q!"],\ + stdout=subprocess.PIPE,stderr=subprocess.PIPE) p.stdout.close() p.stderr.close() -# p.stdin.close() p.wait() #wait for child to terminate f=open(tmpfile,"r") @@ -131,10 +138,10 @@ def prev(path): def prev_txt(path): fi = open(path) txt=get_n_words(fi,40) - print '
'+txt[0] + print '
'+markdown.markdown(txt[0]) if txt[1]: print ' ...' - print '
' + print '
' fi.close() def prev_source(path): diff --git a/source.css b/source.css index d87fcf7..9fc9f5b 100644 --- a/source.css +++ b/source.css @@ -7,6 +7,7 @@ .sourcecode { white-space:wrap; + font-size:10pt; font-family:monospace; color:#cccccc; background-color:#222222; diff --git a/style.css b/style.css index 489df7d..7fb22aa 100644 --- a/style.css +++ b/style.css @@ -12,7 +12,7 @@ a:hover{ } /* header */ -h1 { +h1#blogtitle { font-size:18pt; font-weight:bold; padding:20px 0 0 15px; @@ -22,7 +22,7 @@ h1 { height:35px; background-image:url(_img/tbg.png); } -h2 { +h2#subtitle { font-size:10pt; font-weight:bold; padding:0 0 10px 40px; @@ -96,14 +96,27 @@ body { background-image:url(_img/back.png); padding:0; font-family:sans-serif; + font-size:11pt; color:black; } -h3 { +h1 { font-size:14pt; margin:15px 0 0 0; font-weight:bold; color:#5598ca; } +h2 { + font-size:12pt; + margin:20px 0 0 0; + font-weight:bold; + color:#5598ca; +} +h3 { + font-size:10pt; + margin:25px 0 0 0; + font-weight:bold; + color:#5598ca; +} .entryheader { color:#5598ca; } @@ -117,20 +130,21 @@ h3 { padding:5px; background-color:#f6f6f6; background-image:url(_img/back3.png); - margin-left:22%; - width:70%; + margin-left:26%; + width:45%; box-shadow: 0px 3px 12px #444444; -webkit-box-shadow: 0px 3px 12px #444444; -moz-box-shadow: 0px 3px 12px #444444; padding:15px; - padding-left:45px; - padding-right:45px; + padding-left:9%; + padding-right:9%; border-radius: 7px; -webkit-border-radius: 7px; -moz-border-radius: 7px; margin-bottom:40px; color:black; + text-align:justify; } span.pre {