Documentation ¶
Overview ¶
Package fountain is a Golang package supporting Fountain screenplay markup.
css.go manages setting up CSS for either inline style elements or links.
Package fountain supports encoding/decoding fountain formatted screenplays.
@author R. S. Doiel, <rsdoiel@gmail.com>
BSD 2-Clause License ¶
Copyright (c) 2019, R. S. Doiel All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Package fountain support encoding/decoding fountain screenplay markup
scrippets.go manages fetching and inlining or generating links to John August's scrippets.css
Index ¶
Constants ¶
const ( // GeneralTextType - not specific formatting, treat as plain text GeneralTextType = iota // EmptyType An empty line(s), block of whitepace, can occur on title page or script page(s) EmptyType // TitlePageType - something that only happens on the title page. // NOTE: Title page elents have a .Name value which is my best guess about the content. TitlePageType // SceneHeadingType - exists in the script pages, it is for scene headings SceneHeadingType // ActionType - designates an action block in the script page(s) ActionType // CharacterType - designates a CHARACTER heading for dialog CharacterType // DialogueType - holds a block of dialogue DialogueType // ParentheticalType - holds any parenthetical statement after CharacterType and before DialogueType ParentheticalType // TransitionType - scene transition instructions, these are minimal in most scripts now, e.g. FADE IN:, FADE TO BLACK:, THE END. TransitionType // ShotType - Goes in the screen heading line ShotType // LyricType - holds lyrics to be sung LyricType // NoteType - holds a script note NoteType // BoneyardType - blocks of cut material that haven't been removed BoneyardType // SectionType - is a markdown like title/heading, not normally display in output but used for navigation in text SectionType // SynopsisType - used as internal documentation, not normally displayed in output SynopsisType // UnderlineStyle - show underlined, in CSS "text-decoration:underline;" UnderlineStyle // ItalicStyle - show as italics (e.g. <i>, <em> in HTML) ItalicStyle // BoldStyle - show as boldface or strong (e.g. <b>, <strong> in HTML) BoldStyle // AllCapsStyle - will transform the text to uppercase, could also trigger CSS "text-transform: uppercase;" AllCapsStyle // Strikethrough - generates strikethrough in CSS Strikethrough // CenterAlignment - center text or block CenterAlignment // LeftAlignment - left align text or block LeftAlignment // RightAlignment - right align text of block RightAlignment // PageFeed - inject a page feed or <hr> in HTML PageFeed )
const ( // Version number of release Version = "1.0.2" // ReleaseDate, the date version.go was generated ReleaseDate = "2024-05-20" // ReleaseHash, the Git hash when version.go was generated ReleaseHash = "494f1e1" LicenseText = `` /* 33747-byte string literal not displayed */ )
Variables ¶
var ( // MaxWidth used to set width for Fountain text output in String() MaxWidth = 64 // AsHTMLPage if true generate the HTML header and footer blocks AsHTMLPage = false // InlineCSS sets behavior of including style elements with CSS in ToHTML() InlineCSS = false // LinkCSS sets behavior of including link element pointing to CSS file in ToHTML() LinkCSS = false // CSS holds the filename to use generating CSS links or reading // in a customized version of the CSS. Defaults to "fountain.css". CSS = "fountain.css" // ShowSection - preserve section markers in output (e.g. when pretty printing a working draft) ShowSection = false // ShowSynopsis - preserve synopsis in output (e.g. when pretty printing a working draft) ShowSynopsis = false // ShowNotes - preserve notes in output (e.g. when pretty printing a working draft) ShowNotes = false // Pretty Print - will pretty print for output (e.g. when turning into // JSON, use MarshalIndent) PrettyPrint = false )
var ( // SourceCSS is a default CSS to use when rendering SourceCSS = `` /* 3262-byte string literal not displayed */ )
Functions ¶
func CharacterName ¶ added in v0.0.6
CharacterName takes an element of type Character and trims spaces, removes parenthetical (e.g. `(O.S.)`) and returns a string of the character name(s). NOTE: characters in the form of "JANE AND JOE" will be returned as "JANE AND JOE".
Types ¶
type Element ¶
type Element struct { Type int `json:"type" yaml:"type"` Name string `json:"name,omitempty" yaml:"name,omitempty"` Content string `json:"content" yaml:"content"` }
Element holds the parsed token in either the title page of the document or scene list parts.
type Fountain ¶
Fountain is the document container. It is the type returned by Parse() and ParseFile()
screenplay, _ := ParseFile("screenplay.fountain") fmt.Println(screenplay.String())
func (*Fountain) ToHTML ¶ added in v0.0.2
ToHTML converts a Fountain document based on the Options prvided. @param opt *Options a populate struct of options this package supports @return string of HTML
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
fountain2html
fountain2html converts a Fountain File into an HTML fragement suitable for including like a scrippet.
|
fountain2html converts a Fountain File into an HTML fragement suitable for including like a scrippet. |
fountain2json
fountain2json parses a fountain file and returns a JSON representation.
|
fountain2json parses a fountain file and returns a JSON representation. |
fountainfmt
fountainfmt pretty prints a fountain file.
|
fountainfmt pretty prints a fountain file. |