Skip to content

Instantly share code, notes, and snippets.

@apb2006
Last active November 12, 2016 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apb2006/ccfe1f8214f9f8fbd5a1c1c90a358a85 to your computer and use it in GitHub Desktop.
Save apb2006/ccfe1f8214f9f8fbd5a1c1c90a358a85 to your computer and use it in GitHub Desktop.
(: https://libertyseeds.ca/2015/07/21/Investigating-Final-Draft-s-XML-document-format-with-Ruby/ :)
declare function local:update($result as map(*),$next as element()) as map(*)
{
let $name:=name($next)
let $current:=$result($name)
let $atribs:=$next/@*[if(empty($current)) then true() else not( .=$current(name(.)))]
let $atribs:=map:merge(($current, $atribs!map:entry(name(.),string(.))), map{'duplicates': 'combine'})
return map:put($result,$name,$atribs)
};
doc("http://fountain.io/_downloads/Big%20Fish.fdx")//*
=> fold-left(map{},local:update#2)
map {
"SceneIntro": map {
},
"SceneBreaks": map {
"ContinuedNumber": "No",
"SceneTop": "CONTINUED:",
"SceneTopOfNext": "No",
"SceneBottom": "(CONTINUED)",
"SceneBottomOfPage": "No"
},
"WindowState": map {
"Mode": "Normal",
"Width": "1126",
"Left": "222",
"Height": "800",
"Top": "44"
},
"SmartType": map {
},
"ScriptNoteDefinitions": map {
"Active": "0"
},
"SpellCheckIgnoreLists": map {
},
"TextState": map {
"ShowInvisibles": "No",
"Scaling": "100",
"Selection": ("87624,87783", "106,106")
},
"HeaderAndFooter": map {
"FooterFirstPage": "Yes",
"HeaderVisible": ("Yes", "No"),
"StartingPage": "1",
"HeaderFirstPage": "No",
"FooterVisible": "No"
},
"TitlePage": map {
},
"Macros": map {
},
"IgnoredRanges": map {
},
"SceneNumberOptions": map {
"ShowNumbersOnRight": "Yes",
"RightLocation": "7.25",
"ShowNumbersOnLeft": "Yes",
"LeftLocation": "0.75"
},
"ParagraphSpec": map {
"Spacing": ("2", "1"),
"Alignment": ("Left", "Right"),
"SpaceBefore": ("0", "12"),
"Leading": "Regular",
"RightIndent": ("7.75", "7.50", "6.25", "5.75"),
"LeftIndent": ("1.50", "3.38", "2.88", "2.38", "4.38"),
"FirstIndent": ("0.00", "-0.10"),
"StartsNewPage": "No"
},
"Character": map {
},
"Narrator": map {
"Actor": "Man 1"
},
"FontSpec": map {
"Size": ("12", "10", "9"),
"Color": "#000000000000",
"AdornmentStyle": "0",
"Background": "#FFFFFFFFFFFF",
"Font": ("Courier", "Courier Final Draft", "Arial", "Verdana"),
"Style": ("", "AllCaps", "Italic"),
"RevisionID": "0"
},
"Characters": map {
},
"Word": map {
},
"FinalDraft": map {
"DocumentType": "Script",
"Version": "1",
"Template": "No"
},
"DialogueBreaks": map {
"DialogueBottom": "(MORE)",
"BottomOfPage": "Yes",
"AutomaticCharacterContinueds": "No",
"DialogueTop": "(cont'd)",
"TopOfNext": "Yes"
},
"AutoCastList": map {
"AutomaticallyGenerate": "Yes",
"AddParentheses": "Yes",
"CastListElement": "Cast List"
},
"Macro": map {
"Shortcut": ("Ctrl+Alt+1", "Ctrl+Alt+2", "Ctrl+Alt+3", "Ctrl+Alt+4", "Ctrl+Alt+5", "Ctrl+Alt+6", "Ctrl+Alt+7", "Ctrl+Alt+8", "Ctrl+Alt+9", "Ctrl+Alt+0", "Ctrl+Shift+Alt+1", "Ctrl+Shift+Alt+2", "Ctrl+Shift+Alt+3", "Ctrl+Shift+Alt+4", "Ctrl+Shift+Alt+5", "Ctrl+Shift+Alt+6", "Ctrl+Shift+Alt+7", "Ctrl+Shift+Alt+8", "Ctrl+Shift+Alt+9", "Ctrl+Shift+Alt+0"),
"Name": ("INT", "EXT", "I/E", "DAY", "NIGHT", "SUNRISE", "MAGIC", "CONT", "INTER", "", "CUTTO", "FADEIN", "FADEOUT", "FADETO", "DISSLV", "BACKTO", "MATCHCUT", "JUMPCUT", "FBLACK"),
"Text": ("INT. ", "EXT. ", "I/E. ", " - DAY", " - NIGHT", " - SUNRISE", " - MAGIC", " (cont'd)", "interrupting", "", "CUT TO:", "FADE IN:", "FADE OUT.", "FADE TO:", "DISSOLVE TO:", "BACK TO:", "MATCH CUT TO:", "JUMP CUT TO:", "FADE TO BLACK."),
"Transition": ("None", "Action", "Dialogue", "Scene Heading"),
"Element": ("Scene Heading", "Character", "Parenthetical", "None", "Transition")
},
"Text": map {
"Size": ("12", "36"),
"Color": "#000000000000",
"AdornmentStyle": ("0", "-1"),
"Background": "#FFFFFFFFFFFF",
"Font": ("Courier", "Capitals", "Courier Final Draft"),
"Style": ("Bold", "", "Underline", "AllCaps", "Italic", "Bold+Underline"),
"RevisionID": "0"
},
"Header": map {
},
"Paragraph": map {
"Spacing": ("1", "2"),
"Alignment": ("Center", "Right", "Left"),
"SpaceBefore": ("12", "0"),
"Leading": "Regular",
"RightIndent": ("7.50", "7.75", "-1.10", "-1.25"),
"Number": ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126", "127", "128", "129", "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148", "149", "150", "151", "152", "153", "154", "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167", "168", "169", "170", "171", "172", "173", "174", "175", "176", "177", "178", "179", "180", "181", "182", "183", "184", "185", "186", "187", "188", "189", "190", "191", "192", "193", "194", "195", "196", "197", "198", "199", "200", "201", "202"),
"LeftIndent": ("1.50", "1.25", "1.00"),
"Type": ("General", "Scene Heading", "Action", "Character", "Dialogue", "Parenthetical", "Transition"),
"FirstIndent": "0.00",
"StartsNewPage": "No"
},
"MoresAndContinueds": map {
},
"ScriptNoteDefinition": map {
"Color": "#000000000000",
"Name": ("Important", "Info Only", "Suggestion"),
"Marker": ("1", "2", "3"),
"ID": ("0", "65538", "2")
},
"Alias": map {
"Confirm": "No",
"SmartReplace": "No",
"Text": "",
"MatchCase": "No",
"WordOnly": "No"
},
"Behavior": map {
"Shortcut": ("0", "F1", "F2", "F3", "F4", "F5", "F6", "7", "8", "1"),
"PaginateAs": ("General", "Scene Heading", "Action", "Character", "Parenthetical", "Dialogue", "Transition", "Singing"),
"ReturnKey": ("General", "Action", "Dialogue", "Scene Heading")
},
"SceneIntros": map {
"Separator": ". "
},
"Extensions": map {
},
"Transition": map {
},
"Actor": map {
"Pitch": ("High", "Normal", "Low"),
"MacVoice": ("mtk3", "gala"),
"Speed": ("Medium", "Slow"),
"Name": ("Man 1", "Man 2", "Woman 1", "Woman 2", "Boy 1", "Boy 2", "Girl 1", "Girl 2", "Old Man", "Old Woman"),
"WinVoice": ("`Q|«g(–Ñ{DEST", "`]√≈D⁄—±Ò", "pQ|«g(–Ñ{DEST", "‘ëPO|u—è˙")
},
"DynamicLabel": map {
"Type": "Page #"
},
"Location": map {
},
"IgnoredWords": map {
},
"SplitState": map {
"SplitterPosition": "0",
"SplitMode": "None",
"ActivePanel": "1"
},
"ActivateIn": map {
"Element": ("General", "Scene Heading", "Action", "Character", "Parenthetical", "Dialogue", "Transition", "Singing")
},
"TimeOfDay": map {
},
"Revisions": map {
"ShowAllMarks": "No",
"ShowAllSets": "No",
"Location": "8.00",
"RevisionsShown": "Active",
"ActiveSet": "1",
"RevisionMode": "No"
},
"Content": map {
},
"PageLayout": map {
"ForegroundColor": "#000000000000",
"TopMargin": "72",
"BreakDialogueAndActionAtSentences": "Yes",
"FooterMargin": "36",
"DocumentLeading": "Normal",
"UsesSmartQuotes": "Yes",
"BackgroundColor": "#FFFFFFFFFFFF",
"BottomMargin": "72",
"HeaderMargin": "36",
"InvisiblesColor": "#888888888888"
},
"ScriptPanel": map {
"DisplayMode": "Page"
},
"LockedPages": map {
},
"Member": map {
"Character": ("a man’s voice", "amos", "beamen", "don price", "DR. BENNETT", "EDWARD", "FADE IN", "FLASHCUT TO:", "hippo", "JENNY", "jiing", "jing", "JING]", "JOSEPHINE", "JUMP LEADER", "KARL", "kid", "man", "man’s voice", "minister", "norther", "nurse", "ping", "pint", "PROFESSOR", "SANDRA", "Son", "The crowd", "will", "wilbur freely", "zacky", "sandy", "boy", "zacky price", "jerry", "CUT TO:", "mayor", "norther winslow", "Mr. Soggybottom", "sandra and josephine", "sam", "candystriper", "WARNING! JUMPING SPIDERS.", "OFFICER", "WARNING! JUMPING SPIDERS!", "the man", "woman’s voice", "another woman’s voice", "AMos CALLOWAY", "don", "cashier girl", "greeley", "gl", "older edward", "YOUNG WILL", "principal", "Angry girl’s father", "helpful woman", "BLONDE", "Sn", "VARIOUS TOWNFOLK", "Jeny", "Mildred", "mother", "husband", "young dr. bennett"),
"Actor": "Man 1"
},
"Footer": map {
},
"Revision": map {
"Color": ("#25FF00009FFF", "#06D80A6D9144", "#0376646C0490", "#8D6786FF0345"),
"FullRevision": "No",
"Name": ("Red", "Blue", "Green", "Yellow"),
"Mark": "*",
"Style": "",
"ID": ("1", "2", "3", "4")
},
"Element": map {
"Type": ("Character", "Dialogue")
},
"Actors": map {
},
"Transitions": map {
},
"Locations": map {
},
"Extension": map {
},
"TimesOfDay": map {
"Separator": " - "
},
"SceneProperties": map {
"Length": ("5/8", "3/8", "1", "1 4/8", "1 2/8", "1/8", "2/8", "7/8", "4/8", "1 3/8", "1 6/8", "3 5/8", "6/8", "3 4/8", "3 6/8", "1 5/8", "2 4/8", "1 1/8", "2", "1 7/8", "3"),
"Page": ("1", "2", "3", "4", "6", "7", "8", "10", "11", "12", "14", "15", "16", "18", "19", "20", "23", "24", "25", "26", "27", "28", "31", "32", "33", "34", "35", "37", "38", "39", "40", "41", "43", "44", "46", "47", "48", "52", "54", "55", "58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70", "71", "72", "74", "75", "76", "77", "78", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", "91", "92", "94", "95", "96", "97", "99", "100", "101", "102", "103", "104", "105", "106", "107", "108", "110", "112", "113", "114", "115", "117", "118", "119", "120"),
"Title": ""
},
"ElementSettings": map {
"Type": ("General", "Scene Heading", "Action", "Character", "Parenthetical", "Dialogue", "Transition", "Shot", "Cast List", "Singing")
},
"Cast": map {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment