File: hdftest.rb

package info (click to toggle)
clearsilver 0.10.5-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,304 kB
  • sloc: ansic: 24,586; python: 4,233; sh: 2,502; cs: 1,429; ruby: 819; java: 735; makefile: 589; perl: 120; lisp: 34; sql: 21
file content (39 lines) | stat: -rw-r--r-- 616 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env ruby

require 'neo'

h=Neo::Hdf.new
h.set_value "1","farming"
h.set_value "2","sewing"
h.set_value "3","bowling"

h.set_value "party.1","baloons"
h.set_value "party.2","noise makers"
h.set_value "party.3","telling long\nstories"

h.set_attr "party.1", "Drool", "True"
h.set_attr "party.2", "Pink", "1"

print h.dump

q=Neo::Hdf.new

q.copy "arf",h

print q.dump

h.get_attr("party.2").each_pair do |k,v|
  print "party.2 attr (#{k}=#{v})\n"
end


s="This is a funny test. <?cs var:arf.1 ?>.
<?cs each:p = arf.party ?>
<?cs var:p ?>
<?cs /each ?>"
c = Neo::Cs.new q

c.parse_string(s)

print c.render