Test example for #55
This commit is contained in:
16
examples/insertion-hooks/main.hank
Normal file
16
examples/insertion-hooks/main.hank
Normal file
@@ -0,0 +1,16 @@
|
||||
```
|
||||
story.insertionHooks["hank.Story"] = function(value) {
|
||||
return "Whoa there! You can't insert a whole story into itself!";
|
||||
};
|
||||
story.insertionHooks["String"] = function(value) {
|
||||
if (value.substr(0, 7) == "prefix:") {
|
||||
return "PREFIXED VALUE: " + value.substr(7);
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
{"prefix:Testing insertion hooks"}
|
||||
{story}
|
||||
{"Did it work?"}
|
||||
3
examples/insertion-hooks/test1.hlog
Normal file
3
examples/insertion-hooks/test1.hlog
Normal file
@@ -0,0 +1,3 @@
|
||||
PREFIXED VALUE: Testing insertion hooks
|
||||
Whoa there! You can't insert a whole story into itself!
|
||||
Did it work?
|
||||
Reference in New Issue
Block a user