comparison docs/api.rst @ 31:9ae14e9615e6

docs: Add Sphynx documentation and code docstrings.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 15 Jan 2017 22:41:49 -0800
parents
children
comparison
equal deleted inserted replaced
30:ff71a3e7fab0 31:9ae14e9615e6
1
2 API
3 ===
4
5 .. module:: jouvence
6 :synopsis: Jouvence API
7
8 The Jouvence API is fairly simple, and includes:
9
10 * A Fountain parser that returns a screenplay object.
11 * Several renderers, for formatting a screenplay object into something
12 you can display on screen or elsewhere.
13 * A screenplay object that you can manipulate for custom rendering,
14 analysis, and more.
15
16
17 Parser
18 ------
19
20 .. automodule:: jouvence.parser
21 :synopsis: The Jouvence parser
22 :members:
23
24
25 Document
26 --------
27
28 .. module:: jouvence.document
29 :synopsis: The Jouvence document object model
30
31
32 .. autoclass:: JouvenceDocument
33 :members:
34
35 .. attribute:: title_values
36
37 The title page key/values dictionary.
38
39 .. attribute:: scenes
40
41 The list of scenes in the screenplay.
42
43 Most screenplays start with some "free text" before the first scene.
44 In this case, the first scene would have no header, and would contain
45 this text.
46
47
48 .. autoclass:: JouvenceScene
49 :members:
50
51 .. attribute:: header
52
53 The header text of the scene, _e.g._ "EXT. JAMES' HOUSE - DAY".
54
55 .. attribute:: paragraphs
56
57 The list of paragraphs in the scene. Each paragraph is an instance
58 of :class:`~jouvence.document.JouvenceSceneElement`.
59
60 .. method:: addAction(text)
61
62 Adds an action (paragraph with ``TYPE_ACTION`` type).
63
64 .. method:: addCenteredAction(text)
65
66 Adds a centered action (paragraph with ``TYPE_CENTEREDACTION`` type).
67
68 .. method:: addCharacter(text)
69
70 Adds a character line (paragraph with ``TYPE_CHARACTER`` type).
71
72 .. method:: addDialog(text)
73
74 Adds a dialog line (paragraph with ``TYPE_DIALOG`` type).
75
76 .. method:: addParenthetical(text)
77
78 Adds a parenthetical (paragraph with ``TYPE_PARENTHETICAL`` type).
79
80 .. method:: addTransition(text)
81
82 Adds a transition (paragraph with ``TYPE_TRANSITION`` type).
83
84 .. method:: addLyrics(text)
85
86 Adds some lyrics (paragraph with ``TYPE_LYRICS`` type).
87
88 .. method:: addSynopsis(text)
89
90 Adds a synopsis (paragraph with ``TYPE_SYNOPSIS`` type).
91
92
93 .. autoclass:: JouvenceSceneElement
94 :members:
95
96 .. attribute:: type
97
98 The type of this element. Could be any of:
99
100 * ``TYPE_ACTION``
101 * ``TYPE_CENTEREDACTION``
102 * ``TYPE_CHARACTER``
103 * ``TYPE_DIALOG``
104 * ``TYPE_PARENTHETICAL``
105 * ``TYPE_TRANSITION``
106 * ``TYPE_LYRICS``
107 * ``TYPE_PAGEBREAK``
108 * ``TYPE_SECTION``
109 * ``TYPE_SYNOPSIS``
110
111 .. attribute:: text
112
113 The text for this paragraph.
114
115
116 .. autoclass:: JouvenceSceneSection
117 :members:
118
119 Screenplay sections have their own class because they have a ``depth``
120 attribute in addition to a type and text.
121
122 .. attribute:: depth
123
124 The depth, or level, of the section.
125
126
127 Renderers
128 ---------
129
130 .. module:: jouvence.renderer
131
132 .. autoclass:: BaseDocumentRenderer
133 :members:
134
135 .. attribute:: force_title_page
136
137 By default, if there are no title page values in a screenplay, no
138 title page will be produced. Set ``force_title_page`` to ``True``
139 to force rendering a title page with default/placeholder values.
140
141 .. attribute:: text_renderer
142
143 The :class:`~BaseTextRenderer` instance that this document renderer
144 is using to handle text.
145
146 .. autoclass:: BaseTextRenderer
147 :members:
148
149
150 .. automodule:: jouvence.html
151 :members: get_css
152
153 .. autoclass:: HtmlDocumentRenderer
154 :members:
155
156 .. autoclass:: HtmlTextRenderer
157 :members:
158
159
160 .. automodule:: jouvence.console
161
162 .. autoclass:: ConsoleDocumentRenderer
163 :members:
164
165 .. autoclass:: ConsoleTextRenderer
166 :members: