ktxt2 fountain to hollywoo conversions
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
"homepage": "",
|
||||
"categories": [],
|
||||
"extensionPack": [],
|
||||
"dependencies": {
|
||||
"monaco-editor": "^0.36.1"
|
||||
},
|
||||
"publisher": "NQNStudios",
|
||||
"contributes": {
|
||||
"keybindings": [
|
||||
@@ -45,8 +48,5 @@
|
||||
},
|
||||
"version": "0.0.0",
|
||||
"activationEvents": [],
|
||||
"displayName": "",
|
||||
"dependencies": {
|
||||
"monaco-editor": "^0.36.1"
|
||||
}
|
||||
}
|
||||
"displayName": ""
|
||||
}
|
@@ -10,7 +10,9 @@
|
||||
(printThroughInfoMessage)
|
||||
|
||||
(context.subscriptions.push
|
||||
(KTxt2EditorProvider.register context))
|
||||
(KTxt2EditorProvider.register context))
|
||||
|
||||
(load "conversions/FountainToHollywoo.kiss")
|
||||
|
||||
// Add your extension's commands here with (defCommand <...>):
|
||||
(load "Commands.kiss")
|
||||
|
55
projects/ktxt2/src/ktxt2/conversions/FountainToHollywoo.kiss
Normal file
55
projects/ktxt2/src/ktxt2/conversions/FountainToHollywoo.kiss
Normal file
@@ -0,0 +1,55 @@
|
||||
// KTxt2 Conversions for Fountain files
|
||||
|
||||
(function isUpperCase [s]
|
||||
(= s (s.toUpperCase)))
|
||||
|
||||
(var :Array<String> specialSpeechTags [])
|
||||
|
||||
(function specialSpeech [name parenTag hmethod]
|
||||
(specialSpeechTags.push parenTag)
|
||||
(registerConversion
|
||||
(new ktxt2.StreamConversion name "fountain" "hollywoo"
|
||||
->stream
|
||||
?(whenLet [(Some name) (stream.takeUntilAndDrop " (${parenTag}")]
|
||||
(and (isUpperCase name) {(stream.dropWhitespace) !(stream.isEmpty)}))
|
||||
->stream
|
||||
(let [name (whenLet [(Some name) (stream.takeUntilAndDrop " (${parenTag}")] name)
|
||||
&mut output ""]
|
||||
(stream.takeLine)
|
||||
(loop
|
||||
(let [wryly (ifLet [(Some w) (stream.takeBetween "(" ")\n")] w "")
|
||||
line (ifLet [(Some l) (stream.takeLine)] (l.trim) (break))]
|
||||
(when line
|
||||
(+= output "$hmethod \"${name}\" \"${wryly}\" ##\"${line}\"##\n"))))
|
||||
output))))
|
||||
|
||||
(specialSpeech "On Phone Speech" "O.P." "ONPHONESPEECH")
|
||||
(specialSpeech "VoiceOver Speech" "V.O." "VOICEOVER")
|
||||
(specialSpeech "Off-Screen Speech" "O.S." "OFFSCREENSPEECH")
|
||||
|
||||
(registerConversion
|
||||
(new ktxt2.StreamConversion "Normal Speech" "fountain" "hollywoo"
|
||||
->stream ?(whenLet [(Some name) (stream.takeLine)]
|
||||
(doFor tag specialSpeechTags
|
||||
(whenLet [(Some _) (indexOf name "(${tag}")] (return false)))
|
||||
(and (isUpperCase name) {(stream.dropWhitespace) !(stream.isEmpty)}))
|
||||
->stream
|
||||
(let [name (whenLet [(Some name) (stream.takeLine)] (.trim (name.replace "(CONT'D)" "")))
|
||||
&mut output ""]
|
||||
(loop
|
||||
(let [wryly (ifLet [(Some w) (stream.takeBetween "(" ")\n")] w "")
|
||||
line (ifLet [(Some l) (stream.takeLine)] (l.trim) (break))]
|
||||
(when line
|
||||
(+= output "NORMALSPEECH \"${name}\" \"${wryly}\" ##\"${line}\"##\n"))))
|
||||
output)))
|
||||
|
||||
(registerConversion
|
||||
(new ktxt2.StreamConversion "Label" "fountain" "hollywoo"
|
||||
->stream ?{(stream.dropWhitespace) (stream.startsWith "/*")}
|
||||
->stream
|
||||
"LABEL $(.trim
|
||||
(.replace
|
||||
(.replace
|
||||
(.replace stream.content "/*" "")
|
||||
"*/" "")
|
||||
"*" ""))\n"))
|
Reference in New Issue
Block a user