Name-detecting entrance/exit conversions
This commit is contained in:
8
projects/ktxt2/src/ktxt2/NamesConversion.hx
Normal file
8
projects/ktxt2/src/ktxt2/NamesConversion.hx
Normal file
@@ -0,0 +1,8 @@
|
||||
package ktxt2;
|
||||
|
||||
import kiss.Prelude;
|
||||
import kiss.List;
|
||||
import bad_nlp.Names;
|
||||
|
||||
@:build(kiss.Kiss.build())
|
||||
class NamesConversion {}
|
9
projects/ktxt2/src/ktxt2/NamesConversion.kiss
Normal file
9
projects/ktxt2/src/ktxt2/NamesConversion.kiss
Normal file
@@ -0,0 +1,9 @@
|
||||
(defNew [&prop &mut :String name
|
||||
&prop &mut :String sourceType
|
||||
&prop &mut :String outputType
|
||||
:(String,Array<String>)->Bool canConvertNames
|
||||
:Array<String>->String convertNames]
|
||||
[
|
||||
&mut :String->Bool canConvert ->block ?(whenLet [names (Names.findNames block)] (canConvertNames block names))
|
||||
&mut :String->String convert ->block (let [names (Names.findNames block)] (convertNames names))
|
||||
])
|
@@ -53,3 +53,17 @@
|
||||
(.replace stream.content "/*" "")
|
||||
"*/" "")
|
||||
"*" ""))\n"))
|
||||
|
||||
(function isScreenLine [:String block]
|
||||
(= 1 .length (filter (block.split "\n"))))
|
||||
|
||||
(function doWithCharacters [:String thing :String args]
|
||||
(registerConversion
|
||||
(new ktxt2.NamesConversion "${thing} characters" "fountain" "hollywoo"
|
||||
->[block names] (isScreenLine block)
|
||||
->names (+
|
||||
(.join (for name names "$(thing.toUpperCase)CHARACTER \"${name}\" $args") "\n")
|
||||
"\n"))))
|
||||
|
||||
(doWithCharacters "Add" "<position key> <facing>")
|
||||
(doWithCharacters "Remove" "")
|
Reference in New Issue
Block a user