Compare commits
2 Commits
dev
...
nested-alt
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ea9d0756c | |||
| 9d2089238f |
4
examples/nested-alt/main.hank
Normal file
4
examples/nested-alt/main.hank
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
- (start)
|
||||||
|
// Taken from WritingWithInk.md
|
||||||
|
The Ratbear {&{wastes no time and |}swipes|scratches} {&at you|into your {&leg|arm|cheek}}.
|
||||||
|
-> start
|
||||||
12
examples/nested-alt/partialtest1.hlog
Normal file
12
examples/nested-alt/partialtest1.hlog
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
The Ratbear wastes no time and swipes at you.
|
||||||
|
The Ratbear scratches into your leg.
|
||||||
|
The Ratbear wastes no time and swipes at you.
|
||||||
|
The Ratbear scratches into your arm.
|
||||||
|
The Ratbear wastes no time and swipes at you.
|
||||||
|
The Ratbear scratches into your cheek.
|
||||||
|
The Ratbear wastes no time and swipes at you.
|
||||||
|
The Ratbear scratches into your leg.
|
||||||
|
The Ratbear wastes no time and swipes at you.
|
||||||
|
The Ratbear scratches into your arm.
|
||||||
|
The Ratbear wastes no time and swipes at you.
|
||||||
|
The Ratbear scratches into your cheek.
|
||||||
11
src/Util.hx
11
src/Util.hx
@@ -65,10 +65,17 @@ class Util {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Strip whichever of the given prefix list comes first at the start of a string
|
||||||
|
**/
|
||||||
public static function stripPrefixes(str: String, prefixes: Array<String>) {
|
public static function stripPrefixes(str: String, prefixes: Array<String>) {
|
||||||
for (prefix in prefixes) {
|
for (prefix in prefixes) {
|
||||||
str = StringTools.replace(str, prefix, '');
|
if (str.indexOf(prefix) == 0) {
|
||||||
|
str = StringTools.replace(str, prefix, '');
|
||||||
|
return StringTools.trim(str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return StringTools.trim(str);
|
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,6 @@ import utest.Test;
|
|||||||
|
|
||||||
class TestMain extends Test {
|
class TestMain extends Test {
|
||||||
public static function main() {
|
public static function main() {
|
||||||
utest.UTest.run([new AltTest(), new StoryTest()]);
|
utest.UTest.run([new AltTest(), new StoryTest(), new UtilTest()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
10
tests/UtilTest.hx
Normal file
10
tests/UtilTest.hx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package tests;
|
||||||
|
|
||||||
|
import utest.Test;
|
||||||
|
|
||||||
|
class UtilTest extends Test {
|
||||||
|
var exampleStr1 = "here is a string {with enclosures {all nested} {up in it}}";
|
||||||
|
public function testNestedEnclosure1() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user