diff --git a/.gitignore b/.gitignore index a83bc67..d29dd6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *~ *#*# *.#* +*.py[co] .cache/ /.old/ /.local/ @@ -12,4 +13,5 @@ log.mege .finallog.mege apache-config .debug -/mege/ +/mege +.test.org diff --git a/macros/macros.py b/macros/macros.py index 4f73975..61c0911 100755 --- a/macros/macros.py +++ b/macros/macros.py @@ -1,4 +1,37 @@ # macros +import sys +import os.path + +# Ugly hack for local installations +htmlgen = sys.modules['mege.htmlgen'] +htmlfunc = sys.modules['mege.htmlfunc'] +import mege.git as git +import mege.misc as misc + + def download_prog(root, fname): return '' + +def list_pages(pathdir): + dl = htmlfunc.DefList() + fs = [(os.path.join(pathdir, f), f) for f in filter( + lambda f: f.endswith('.org') and f != 'index.org', + os.listdir(pathdir))] + fs.sort(key=lambda pf: git.rr.get_last_modified_date(pf[0])[0] or + misc.utcwhenmodified(pf[0])) + for p, f in fs[::-1]: + a = htmlgen.org_to_abstract(p, isfile=True, only_metadata=True) + dl.add_item(htmlfunc.link(f[:-4], a.title), a.summary if a.summary + else 'No summary.') + return dl.generate_html() + +def titlelink(path, pathdir=None): + pathdir = misc.macrog('pathdir', pathdir) + orgpath = misc.get_org_path(os.path.join(pathdir, path)) + if orgpath: + a = htmlgen.org_to_abstract(orgpath, isfile=True, only_metadata=True) + title = a.title + else: + title = path + return htmlfunc.link(path, title).generate_html() diff --git a/macros/macros.pyc b/macros/macros.pyc index 385125c..2ac19da 100644 Binary files a/macros/macros.pyc and b/macros/macros.pyc differ diff --git a/msgsite/reverror.org b/msgsite/reverror.org new file mode 100644 index 0000000..4a5b06d --- /dev/null +++ b/msgsite/reverror.org @@ -0,0 +1,7 @@ +#+title: Revision error + +* Revision error + +Error: <@deval page.error@> + +[[<@deval page.allrevs@>][View all revisions]] diff --git a/msgsite/servererror.org b/msgsite/servererror.org index c5d05d2..ffdb352 100644 --- a/msgsite/servererror.org +++ b/msgsite/servererror.org @@ -1,5 +1,19 @@ #+title: Server error -* <@deval page.error@> +* Server error -There was an error, most likely due to sloppy programming. +There was an error, most likely due to sloppy programming: + +#&block +<@deval page.error@> +#& + +<@deval page.errortraceback@> + +** Fixing it + +This error has been logged. However, it might get fixed more quickly if you +send an e-mail to Niels at [[mailto:ns@metanohi.org][ns@metanohi.org]] explaining what you did to trigger +this tragedy. + +Thanks. diff --git a/msgsite/sitemap.org b/msgsite/sitemap.org new file mode 100644 index 0000000..ee5d286 --- /dev/null +++ b/msgsite/sitemap.org @@ -0,0 +1,5 @@ +#+title: Sitemap + +* Sitemap + +<@eval page.sitemap@> diff --git a/nohi.wsgi b/nohi.wsgi index 4c08774..a46beb3 100644 --- a/nohi.wsgi +++ b/nohi.wsgi @@ -10,7 +10,7 @@ sys.path.insert(0, _filedir) try: import mege.wsgi except ImportError: - sys.path.insert(0, os.path.join(_filedir, 'mege')) - import mege.wsgi + pass#sys.path.insert(0, os.path.join(_filedir, 'mege')) + #import mege.wsgi os.chdir(_filedir) application = mege.wsgi.create_application() diff --git a/prestatic/aesthetics.js b/prestatic/aesthetics.js index 410fcb5..f01a745 100644 --- a/prestatic/aesthetics.js +++ b/prestatic/aesthetics.js @@ -30,26 +30,39 @@ is_screen_media = function() { }; set_min_height = function() { + var ws, wh, ww, h; + ws = get_window_size(); + wh = ws[0]; + ww = ws[1]; + + h = metadiv.offsetHeight + 15; + metadiv.style.position = 'absolute'; + metadiv.style.bottom = '5px'; + metadiv.style.width = (contentdiv.offsetWidth - 22) + 'px'; + contentdiv.style.paddingBottom = h + 'px'; + + h = wh - h - menudiv.offsetHeight - 145; + contentdiv.style.minHeight = h + 'px'; +}; + +set_logo_width = function() { + var ws; + ws = get_window_size(); + ww = ws[1]; + logodiv.style.width = ww + 'px'; +}; + +adjust_sizes = function() { if (!is_screen_media()) return; - var ws, wh, ww, h - ws = get_window_size() - wh = ws[0] - ww = ws[1] - - h = metadiv.offsetHeight + 15 - metadiv.style.position = 'absolute' - metadiv.style.bottom = '5px' - metadiv.style.width = (bodydiv.offsetWidth - 22) + 'px' - bodydiv.style.paddingBottom = h + 'px' - - h = wh - h - menudiv.offsetHeight - 145 - bodydiv.style.minHeight = h + 'px' + set_min_height(); + set_logo_width(); }; window.addEventListener('load', function(event){ menudiv = document.getElementById('menu'); - bodydiv = document.getElementById('body'); + contentdiv = document.getElementById('content'); metadiv = document.getElementById('metadata'); - set_min_height(); + logodiv = document.getElementById('logo'); + adjust_sizes(); }, false); diff --git a/prestatic/screen.css b/prestatic/screen.css index 5896cee..793161d 100644 --- a/prestatic/screen.css +++ b/prestatic/screen.css @@ -64,7 +64,7 @@ ul#menulinks { color: #2433ff; } -#body { +#content { width: 720px; margin: 0 auto; padding: 5px; @@ -76,10 +76,20 @@ ul#menulinks { } #body.full { + position: absolute; + right: 20px; + left: 0px; +} + +#body.full #content { margin: 0 7px; width: auto; } +#bodyend { + clear: both; +} + #metadata { margin-top: 10px; border-style: dashed; @@ -166,7 +176,7 @@ h1, h2, h3, h4, h5, h6 { } h1 { - margin-top: 10px; + margin: 16px 0 5px 0; font-size: 26px; } @@ -175,29 +185,29 @@ h1:first-child { } h2 { - margin-top: 9px; + margin: 14px 0 5px 0 ; font-size: 22px; } h3 { - margin-top: 6px; + margin: 9px 0 3px 0; font-size: 19px; } h4 { - margin-top: 5px; + margin: 7px 0 2px 0; font-size: 16px; font-weight: bold; } h5 { - margin-top: 3px; + margin-top: 5px 0 1px 0; font-size: 14px; font-weight: bold; } h6 { - margin-top: 2px; + margin: 3px 0 1px 0; font-size: 12px; font-weight: bold; } @@ -228,6 +238,7 @@ tt, code, samp, pre, var { img { border: none; + clear: both; } cite, quote { @@ -235,7 +246,7 @@ cite, quote { } blockquote { - margin-left: 20px; + margin: 0 0 5px 20px; font-size: 14px; } @@ -272,34 +283,49 @@ hr { /* Lists */ ul, ol { - margin: 0 3px 4px 0; + margin-bottom: 4px; list-style-position: inside; } +ul > ul, ul > ol, ol > ul, ol > ol { + margin-left: 17px; + margin-bottom: 0; + padding-left: 5px; +} + ul { - list-style-type: disc; + list-style-type: disc; } ul > ul, ol > ul { - list-style-type: square; + list-style-type: square; } ul > * > ul, ol > * > ul { - list-style-type: circle; + list-style-type: circle; +} + +ul > * * > ul, ol > * * > ul { + list-style-type: disc; ! important } ol { - list-style-type: decimal; + list-style-type: decimal; } ol > ol, ul > ol { - list-style-type: upper-alpha; + list-style-type: upper-alpha; } ol > * > ol, ul > * > ol { - list-style-type: lower-alpha; + list-style-type: lower-alpha; } +ol > * * > ol, ul > * * > ol { + list-style-type: decimal; ! important +} + + /* Definition lists */ dd { @@ -307,28 +333,30 @@ dd { } dl > dl { - margin-left: 25px; + margin-left: 21px; + padding-left: 5px; + border-left: 4px solid #000; } /* Tables */ table { - margin: 0 auto; + margin: 0 auto; border-collapse: collapse; } table, td, th { - border: 1px solid black; + border: 2px inset black; } td, th { - margin: 0 5px; - padding: 1px 3px; + margin: 0 5px; + padding: 1px 3px; } -/* Misc. classes */ +/* Formatting-related classes */ .strong { font-weight: bold; @@ -394,3 +422,12 @@ td, th { font-size: 8px; ! important } + +/* Misc. classes */ + +.warning { + background-color: #ffa400; + font-weight: bold; + padding: 5px 5px 0 5px; + border: 1px outset black; +} diff --git a/prestatic/template.html b/prestatic/template.html index 6649c2f..f439f9c 100644 --- a/prestatic/template.html +++ b/prestatic/template.html @@ -40,7 +40,6 @@ if page.created_rfc3339: if page.modified_rfc3339: print(" ".format(page.modified_rfc3339)) @--> - @@ -54,7 +53,6 @@ if page.licenses: \ """.format(x=x))@--> -