PageRenderTime 32ms CodeModel.GetById 16ms app.highlight 1ms RepoModel.GetById 14ms app.codeStats 0ms

/lib/Canvas.io

http://github.com/pgregory/blackpool
Unknown | 56 lines | 45 code | 11 blank | 0 comment | 0 complexity | 25c93d2d3a0ec7b1ec53676fb6284b36 MD5 | raw file
 1Message isSingular := method(self next == nil)
 2
 3Canvas := Object clone do(
 4  init := method(
 5    result ::= Sequence clone
 6    callbacks ::= nil
 7  )
 8
 9  elements := """h1 h2 h3 h4 h5 h6 a abbr area b blockquote body br canvas caption cite code col dd del div dt dl em embed footer head header i html hr label nav p script sup summery textarea td tbody table tfoot th thead title time tr u ul ol li"""
10  elements split foreach(tag,
11    setSlot(tag, 
12      method(
13        Tag clone setTag(call message name)
14      )
15    )
16  )
17
18  text := method(str,
19    result appendSeq(str)
20    self
21  )
22
23  space := method(str,
24    result appendSeq(" ")
25    self
26  )
27
28  link := method(name, code,
29    id := callbacks register(list(call sender, code))
30    result appendSeq("<a href='?_k=",id,"'>",name,"</a>")
31    self
32  )
33
34  button := method(name, code,
35    id := callbacks register(list(call sender, code))
36    result appendSeq("<button type='submit' name='_k' value='",id,"'>",name,"</button>")
37    self
38  )
39
40  inputText := method(
41    InputTextTag clone
42  )
43
44  inputTextArea := method(
45    InputTextAreaTag clone
46  )
47
48  inputDate := method(
49    InputDateTag clone
50  )
51
52  render := method(component,
53    component renderOn(self)
54  )
55)
56