diff --git a/format.css b/format.css index 3209374..4d31781 100644 --- a/format.css +++ b/format.css @@ -22,6 +22,8 @@ pre { .figure { float: right; - padding: 0.5em; + padding: 0.25em; + margin: 0.5em; font-size: small; + border: solid black 1px; } \ No newline at end of file diff --git a/tartans/Jamfile b/tartans/Jamfile index 201b5e7..12f6731 100644 --- a/tartans/Jamfile +++ b/tartans/Jamfile @@ -2,11 +2,15 @@ SubDir TOP tartans ; TARTAN_TMPL = $(SUBDIR)/tartan.m4 ; TARTANTOMDWN = $(SUBDIR)/tartantomdwn ; +LSTARTANS = $(SUBDIR)/lstartans ; LOOM = $(SUBDIR)/loom.py ; rule Tartan { local tartans = [ FGristFiles $(1:S=.tartan) ] ; + DIRLIST on [ FGristFiles index.mdwn ] = $(LSTARTANS) ; + AutoIndex index.mdwn : index.head.mdwn : $(1:S=.tartan) ; + for t in $(tartans) { local png = $(t:S=.png:D=img:G=) ; local mdwn = $(t:S=.mdwn) ; @@ -32,8 +36,10 @@ rule TartanToPng { SEARCH on $(2) = $(SEARCH_SOURCE) ; } + + actions TartanToMdwn { - $(TARTANTOMDWN) $(1:S=) < $(2) > $(1) + $(TARTANTOMDWN) $(1:S=.png:D=img) $(TARTAN_TMPL) < $(2) > $(1) } actions TartanToPng { diff --git a/tartans/albuquerque.tartan b/tartans/albuquerque.tartan index a722bb7..210ef52 100644 --- a/tartans/albuquerque.tartan +++ b/tartans/albuquerque.tartan @@ -3,7 +3,7 @@ Sett: R4 G24 B4 G10 B36 W6 R4 W4 Created by Ralph Stevenson Jr and Charles Hargis in 2005 for the city's tricentennial anniversary (1706-2006). It is similar in design to the -[New Mexico tartan](nm), with a little less green, and white instead of +[New Mexico tartan](nm.html), with a little less green, and white instead of yellow, with a thicker center band. -[Bally Dun Celtic Treasures](http://www.ballydun.com/) sells this tartan. \ No newline at end of file +[Bally Dun Celtic Treasures](http://www.ballydun.com/) sells this tartan. diff --git a/tartans/blackwatch.tartan b/tartans/blackwatch.tartan index c49da65..75f8ed0 100644 --- a/tartans/blackwatch.tartan +++ b/tartans/blackwatch.tartan @@ -1,4 +1,4 @@ Name: Black Watch -Sett: B22 BK2 B2 BK2 B2 BK16 G16 BK2 G16 BK16 B16 BK2 B2BK2 G10 BK8 DB9 BK1 DB1 +Sett: B22 BK2 B2 BK2 B2 BK16 G16 BK2 G16 BK16 B16 BK2 B2 BK2 G10 BK8 DB9 BK1 DB1 A standard. diff --git a/tartans/design.cgi b/tartans/design.cgi index cca9b40..da1182d 100755 --- a/tartans/design.cgi +++ b/tartans/design.cgi @@ -1,88 +1,38 @@ #! /usr/bin/python import cgitb; cgitb.enable() -import htmltmpl import loom -import re -import sys import cgi -import os -import rfc822 import urllib -import cStringIO as StringIO - -var_re = re.compile('\$(\w+|{\w+})') -def fill_template(tmpl, **keywds): - def repl(match): - var = match.group(0)[1:] - var = var.strip('{}') - return keywds[var] - return var_re.sub(repl, tmpl) - - -def serve(s, c_t): - o = ('Content-type: %s\r\nContent-length: %d\r\n\r\n%s' % - (c_t, len(s), s)) - sys.stdout.write(o) +import os +import sys f = cgi.FieldStorage() s = f.getfirst('sett') if s: + print('Content-type: image/png') + print('') sett = loom.str_to_sett(s) l = loom.tartan(sett) - p = StringIO.StringIO() - l.png(p) - - serve(p.getvalue(), 'image/png') + l.png(sys.stdout) else: - manager = htmltmpl.TemplateManager(precompile=0) - tmpl = manager.prepare('/home/neale/lib/wiki/templates/page.tmpl') - processor = htmltmpl.TemplateProcessor(html_escape=False) - - t = os.environ.get('PATH_INFO', '').strip('/') - if not t: - t = f.getfirst('t', 'Unknown') + t = f.getfirst('t', 'Unknown') s = f.getfirst('s') - if t and not s: - try: - m = rfc822.Message(file('%s.tartan' % t)) - t = m.get('Title', t) - s = m.get('Sett') - except IOError: - pass if not t or not s: # Default to Black Watch t = 'Black Watch' - s = ('B22 BK2 B2 BK2 B2 BK16 G16 BK2 G16 BK16 B16 BK2 B2' + s = ('B22 BK2 B2 BK2 B2 BK16 G16 BK2 G16 BK16 B16 BK2 B2 ' 'BK2 G10 BK8 DB9 BK1 DB1') - s_st = s.replace(' ', '') - s_st = s_st.replace('\n' ,'') + s_ = s.replace(' ', '').replace('\n', '') - content = ''' -