File: test_macro_set.cs

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 (22 lines) | stat: -rw-r--r-- 555 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
<?cs def:getWidthStyle(width, output) ?>
  <?cs set:output = "style='width:" + width + "px;'" ?>
<?cs /def ?>

Testing "pass by reference" to macro calls so they can "return" data

Testing non-existant var
<?cs call:getWidthStyle(100, attr) ?>
<?cs var:attr ?>

Testing non-existant var sub var
<?cs call:getWidthStyle(300, attr2.foo) ?>
<?cs var:attr2.foo ?>

Testing non-existant sub var
<?cs call:getWidthStyle(400, attr.foo) ?>
<?cs var:attr.foo ?>

Testing existant var
<?cs set:attr3 = "" ?>
<?cs call:getWidthStyle(200, attr3) ?>
<?cs var:attr3 ?>