better NORMALSPEECH conversion

This commit is contained in:
2021-12-14 14:08:00 -07:00
parent 48f6fd9028
commit 642e4c8d58

View File

@@ -1,13 +1,5 @@
// KTxt2 Conversions for Fountain files // KTxt2 Conversions for Fountain files
(var wryly
(R.namedGroup "wryly"
(R.optional
(R.group
(R.escape "(")
(R.repeat R.anyChar 1)
(R.escape ")\n")))))
(registerConversion (registerConversion
(new ktxt2.StreamConversion "On Phone Speech" "fountain" "hollywoo" (new ktxt2.StreamConversion "On Phone Speech" "fountain" "hollywoo"
->stream ?(whenLet [(Some name) (stream.takeUntilAndDrop " (O.P.)")] true) ->stream ?(whenLet [(Some name) (stream.takeUntilAndDrop " (O.P.)")] true)
@@ -23,14 +15,16 @@
output))) output)))
(registerConversion (registerConversion
(new ktxt2.RegexConversion "Speech" "fountain" "hollywoo" (new ktxt2.StreamConversion "Normal Speech" "fountain" "hollywoo"
(R.group ->stream ?(whenLet [(Some name) (stream.takeLine)
R.start None (indexOf name "(O.P.)")
(R.namedGroup "name" (R.repeat R.capitalLetter 1)) None (indexOf name "(V.O.)")] true)
(R.escape "\n") ->stream
wryly (let [name (whenLet [(Some name) (stream.takeLine)] name)
(R.namedGroup "line" (R.repeat R.anyChar 1)) &mut output ""]
(R.namedGroup "pBreak" (R.repeat (R.escape "\n") 1)) (loop
R.end) (let [wryly (ifLet [(Some w) (stream.takeBetween "(" ")")] w "")
#####"NORMALSPEECH \"$(group "name")\" \"$(let [w (group "wryly")] (if w (substr w 1 -3) ""))\" ##\"$(.trim (group "line"))\"##$(group "pBreak")"##### line (ifLet [(Some l) (stream.takeLine)] (l.trim) (break))]
"m")) (when line
(+= output "NORMALSPEECH \"${name}\" \"${wryly}\" ##\"${line}\"##\n"))))
output)))