SourceForge Logo

ruby-tmpl: Example output from test.rbx

Code Examples - Download - FAQ - Home - Lists - Reference - Summary - ViewCVS

Below is the sample page that you should expect from your own test.rbx.


Example/test Template

  1. <?tmpl.file?> tests
  2. <?tmpl.if?> tests
  3. <?tmpl.unless?> tests
  4. <?tmpl.var?> tests

<?tmpl.file ?> Tests

^^ Top ^^
 
Test NameTestExpected Output
<?tmpl.file name="include_tmpl.tmpl" ?>A non-recursive included fileA non-recursive included file
<?tmpl.file name="include_docs.tmpl" relative="yes" ?>A non-recursive included file (file in docs directory)A non-recursive included file (file in docs directory)
<?tmpl.file name="non_existent_file.tmpl" ?>File "non_existent_file.tmpl" does not exist in the path ".:./tmpl"File "non_existent_file.tmpl" does not exist in the path ".:./tmpl"
<?tmpl.file name="non_existent_file.tmpl" error_msg="file not found" ?>file not foundfile not found
<?tmpl.file name="include_recursive.tmpl" ?>##1st FILE ## ##BEGIN 2ND INCLUDE##--2nd FILE--##END 2ND INCLUDE####1st FILE ## ##BEGIN 2ND INCLUDE##--2nd FILE--##END 2ND INCLUDE##
<?tmpl.file name="include_widget.tmpl" ns='' ?>Basic widget that is color blueBasic widget that is color blue
<?tmpl.file name="include_widget.tmpl" ns='top' ?>Basic widget that is color greenBasic widget that is color green
<?tmpl.file name="include_widget.tmpl" ns='bottom' ?>Basic widget that is color redBasic widget that is color red

<?tmpl.if ?> Tests

^^ Top ^^
 
Test NameTestExpected Output
<?tmpl.if name="test" type="block" ?>Testing workedTesting worked

<?tmpl.unless ?> Tests

^^ Top ^^
 
Test NameTestExpected Output
<?tmpl.unless name="foobar" type="block" ?>Testing workedTesting worked

<tmpl.var ?> Tests

^^ Top ^^
 
Test NameTestExpected Output
<?tmpl.var ?>ruby-tmpl workedruby-tmpl worked
<?tmpl.var name="test" default="default value" ?>ruby-tmpl workedruby-tmpl worked
<?tmpl.var name="bad_variable" ?>variable "bad_variable" has no valuevariable "bad_variable" has no value
<?tmpl.var name="bad_variable" default="default value" ?>default valuedefault value

Tests completed. Feel free to direct questions to ruby-tmpl-users@lists.sourceforge.net.