This commit is contained in:
2019-02-06 00:49:12 +03:00
commit 8dbb1bb605
4796 changed files with 506072 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
LookRoot $testlookroot
DefaultScheme scheme
DefaultLanguage en
AllowOldSyntax 0
AllowCode 1
AllowTemplateCode 1

View File

@@ -0,0 +1,6 @@
<?_code $content = "This should show up twice"; _code?>
<?_code $content _code?>
<?_code my $other = "This should only show up once."; _code?>
<?_code $other _code?>

View File

@@ -0,0 +1,6 @@
This should show up twice
This should show up twice
This should only show up once.

View File

@@ -0,0 +1,15 @@
<?_code
sub some_function { return "This is from the first codeblock"; }
$package = __PACKAGE__;
return "Returning from the first codeblock.";
_code?>
<?_code
$package->some_function();
_code?>

View File

@@ -0,0 +1,4 @@
Returning from the first codeblock.
This is from the first codeblock

View File

@@ -0,0 +1,28 @@
<?_code
package Foo;
sub new {
my $class = shift;
my ( $this, $that ) = @_;
bless {
this => $this || "default this",
that => $that || "default that",
}, $class;
}
sub this { my $self = shift; $self->{this} = shift if @_; $self->{this} }
sub that { my $self = shift; $self->{that} = shift if @_; $self->{that} }
sub msg {
my $self = shift;
return "[This: ". $self->this . ", That: ". $self->that . "]";
}
_code?>
<?_code
my $f = new Foo "pony", "not yours";
$f->msg;
_code?>

View File

@@ -0,0 +1,6 @@
[This: pony, That: not yours]

View File

@@ -0,0 +1,9 @@
Return a BML construct:
<?_code return "<?tag Foo tag?>" _code?>
Inside-out from above:
<?exec return "[This is it.]" exec?>
Recurse:
<?exec return '<?_code return "[Foo.]" _code?>' exec?>

View File

@@ -0,0 +1,9 @@
Return a BML construct:
[Tag: Foo]
Inside-out from above:
[This is it.]
Recurse:
[Error: <b>_CODE block failed to execute by permission settings</b>]

View File

@@ -0,0 +1,4 @@
tag=>{D}[Tag: %%DATA%%]
exec=>{D}<?_code %%DATA%% _code?>

12
bml/test/codeblocks/simple.bml Executable file
View File

@@ -0,0 +1,12 @@
Immediate value/Simple string:
<?_code "Foo" _code?>
Immediate value/List:
<?_code qw{this is some data in a list} _code?>
Returned string:
<?_code return "Bar" _code?>
Returned List:
<?_code return ("some", "stuff", "in", "a", "list") _code?>

View File

@@ -0,0 +1,12 @@
Immediate value/Simple string:
Foo
Immediate value/List:
list
Returned string:
Bar
Returned List:
list