eleanor 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ === 1.0.0 (July 5, 2008)
2
+
3
+ First version
data/INSTALL ADDED
@@ -0,0 +1,43 @@
1
+ If you just want to run Eleanor from the command line and aren't interested
2
+ in using it from other Ruby programs, you don't have to install it. Just
3
+ download the tarball or zip package from http://rubyforge.org/projects/eleanor,
4
+ extract it to some directory, and off you go.
5
+
6
+ = Running without Installing
7
+
8
+ Extract your package and
9
+
10
+ cd eleanor-1.0.0
11
+ ruby bin/eleanor screenplay.txt
12
+
13
+ === Building the Example
14
+
15
+ An example plain text screenplay is located in the examples directory in the
16
+ package. To generate the PDF, run
17
+
18
+ rake examples
19
+
20
+ This example can also be found at http://eleanor.rubyforge.org/example.txt.
21
+
22
+
23
+ = Installing through RubyGems
24
+
25
+ gem install eleanor
26
+
27
+ Or, manually download the gem from http://rubyforge.org/projects/eleanor and
28
+
29
+ gem install eleanor-1.0.0.gem
30
+
31
+
32
+ = Installing to site_ruby
33
+
34
+ From your extracted package directory,
35
+
36
+ rake install
37
+
38
+ Or, equivalently,
39
+
40
+ ruby setup.rb
41
+
42
+ This installation method uses the setup.rb script by
43
+ {Minero Aoki}[http://i.loveruby.net/en/projects/setup].
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2008 chiisaitsu <chiisaitsu@gmail.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,439 @@
1
+ = Eleanor: Screenplay Formatting
2
+
3
+ Eleanor is a Ruby script and accompanying library for formatting speculative
4
+ screenplays. It parses plain text written in a simple format and outputs pretty
5
+ PDF that conforms to standard rules of screenplay layout. Eleanor's primary
6
+ goal is to create PDF that is indistinguishable from PDF produced by professional
7
+ screenwriting software such as {Final Draft}[http://www.finaldraft.com].
8
+
9
+ See an {example PDF}[http://eleanor.rubyforge.org/example.pdf] and the
10
+ {plain text file}[http://eleanor.rubyforge.org/example.txt] that generated it.
11
+
12
+
13
+ == What It Does
14
+
15
+ * Spec scripts.
16
+ * Follows standard rules of screenplay formatting. But if you disagree, you
17
+ can modify those rules.
18
+ * Correctly breaks paragraphs across pages. Paragraphs are broken between
19
+ sentences, not in mid-sentence. Orphan and widow sentence constraints are
20
+ respected, and orphan and widow line constraints can even be set.
21
+ Keep-with-next constraints are respected. Dialog is correctly broken and
22
+ continued.
23
+ * Precise configuration. Constraints such as margins, keep-with-nexts, and
24
+ orphan and widow limits can be set on a dynamic and class-by-class basis for
25
+ each class of paragraph. Screenplay-wide options like font, line height,
26
+ character spacing, and page size and margins can also be customized.
27
+ * Easy configuration. Options are stored in YAML format in their own file.
28
+ * Extension. By default Eleanor outputs to PDF using
29
+ libHaru[http://libharu.org], but you can write a backend to target anything
30
+ else, like {PDF::Writer}[http://ruby-pdf.rubyforge.org/pdf-writer], XML,
31
+ XSL-FO, Postscript, RTF, the screen, a socket, whatever. Or if you don't
32
+ like Eleanor's plain text screenplay format, you can write your own parser.
33
+ * Can be used as a command-line app or as part of a larger Ruby program.
34
+ * Multiple title pages.
35
+ * Text underlining. Emphasis in screenplays is shown by underlining, which
36
+ you can do by surrounding text in underscores:
37
+
38
+ You can underline a single _word_, or _many words at once._
39
+
40
+
41
+ == What It Doesn't
42
+
43
+ * WYSIWYG editing.
44
+ * Side-by-side simultaneous dialog.
45
+ * Production stuff, like shooting scripts, scene numbering, rewrites, revisions.
46
+ * Sitcom scripts, stageplays, etc. Although if it's just a matter of line
47
+ spacing, margins, or font, you might be able to do it by modifying Eleanor's
48
+ configuration.
49
+ * Spell check. You'll have to use your text editor.
50
+
51
+
52
+ == Example Usage
53
+
54
+ === From the Command Line
55
+
56
+ eleanor oscarwinner.txt
57
+ eleanor -o turnsoutitsucks.pdf oscarwinner.txt
58
+ eleanor -c config.yaml -o turnsoutitsucks.pdf oscarwinner.txt
59
+
60
+ === From Ruby
61
+
62
+ Eleanor.load_config('config.yaml')
63
+ screenplay= Eleanor.parse('oscarwinner.txt')
64
+ if screenplay
65
+ screenplay.paginate!
66
+ screenplay.write_to_paper!
67
+ screenplay.save_paper('turnsoutitsucks.pdf')
68
+ else
69
+ abort 'parsing failed'
70
+ end
71
+
72
+
73
+ == Requirements
74
+
75
+ * libHaru[http://libharu.org] 2.1.0 for PDF output
76
+
77
+ For your convenience the parser (which is just Ruby code) is included already
78
+ built in the package, but if you want to rebuild it or create your own, you will
79
+ also need
80
+
81
+ * Ragel[http://research.cs.queensu.ca/~thurston/ragel/] 6.0
82
+
83
+ Older versions of each may work; I haven't tried. Both play well with Ruby out
84
+ of the box.
85
+
86
+
87
+ == How It Works
88
+
89
+ You might say Eleanor follows the model-view-controller design pattern.
90
+ Here's Eleanor's pipeline, which is encapsulated by the Eleanor::Screenplay
91
+ class:
92
+
93
+ 1. Parsing: Eleanor parses a plain text screenplay (the model) and
94
+ creates a list of Eleanor::Paragraph objects. See file src/ragel/parser.rl.
95
+ 2. Pagination: Eleanor creates a list of Eleanor::Page objects based
96
+ on the list of paragraphs and their constraints.
97
+ 3. Output: Eleanor's backend squirts out a nice representation of the
98
+ pages, a PDF by default (the view). See file lib/eleanor/hpdfpaper.rb.
99
+
100
+ Eleanor's modular design makes it easy to drop in your own parser or backend.
101
+ If you want.
102
+
103
+
104
+ == Plain Text Screenplay Format
105
+
106
+ Think "Markdown[http://daringfireball.net/projects/markdown/] for screenplays."
107
+ Eleanor's plain text format mimics the conventional screenplay format minus
108
+ page breaks and all the constraints that make screenplay formatting a pain.
109
+ The philosophy here is to make your plain text screenplay perfectly nice and
110
+ readable on its own, even were it not to be parsed and massaged into a
111
+ pretty PDF.
112
+
113
+ See an {example file}[http://eleanor.rubyforge.org/example.txt]. This file is
114
+ also available at examples/example.txt in the package. (Note: The file uses Unix
115
+ line endings. You can use Windows line endings in your screenplays, no problem,
116
+ but when viewing this particular example on Windows, use a decent text editor.
117
+ WordPad can translate the line endings, but Notepad won't.)
118
+
119
+ === Types of Paragraphs
120
+
121
+ By "paragraph," I mean an element of the screenplay such as a scene heading, slug
122
+ line, character cue, etc. Eleanor supports the following types of paragraphs:
123
+
124
+ * Scene headings
125
+ * Slug lines
126
+ * Action/description
127
+ * Character cues
128
+ * Parentheticals
129
+ * Dialog
130
+ * Montages/series of shots
131
+ * Inserts (e.g., text to be shown onscreen)
132
+ * Transitions
133
+
134
+ Of course you can do title pages, too, as many as you want in one screenplay,
135
+ with as much or as little info as you want in each one.
136
+
137
+ === To Make a Long Story Short
138
+
139
+ The basic rules of the plain text format are as follows. See the Grammar section
140
+ for a full grammar.
141
+
142
+ * Sentences must be separated by (at least) two spaces, not one.
143
+ * One line per paragraph. In other words, turn on your text editor's word
144
+ wrap or soft breaks. Newlines are not allowed inside a paragraph.
145
+ * Two blank lines (at least) before scene headings and montages (except the very
146
+ first scene heading if it's preceded by a transition, in which case one blank
147
+ line may be used).
148
+ * One blank line before everything else except dialog and parentheticals, which
149
+ must have no blank lines before them.
150
+ * Character cues, parentheticals, dialog, transitions, and inserts must be
151
+ preceded by horizontal space. By how much is your choice.
152
+ * Other paragraphs must not be preceded by any horizontal space.
153
+ * Scene headings must be succeeded by action.
154
+ * Slug lines must be in all caps.
155
+ * Transitions must be in all caps and end in either a colon (":") or a period
156
+ (".").
157
+ * Items in montages/series of shots must be preceded by a capital letter, a
158
+ right parenthesis, and at least one space, e.g., "A) ".
159
+ * Title pages are specified before anything else, but they don't have to be
160
+ specified at all. A title page consists of a series of consecutive lines,
161
+ where each line is preceded by horizontal space. (By how much is your
162
+ choice.) The first line is the title and is mandatory if the title page is
163
+ specified. The next line is the author and is optional. The remaining lines,
164
+ of which there may be a varying number, are the author's contact information.
165
+ Multiple title pages may be specified. At least one blank line must follow
166
+ each title page specification.
167
+
168
+ === Grammar
169
+
170
+ screenplay := trailer* title_page* (transition trailer*)? (scene | montage)*
171
+
172
+ scene := scene_heading action (action | character | slug_line | insert)* transition? trailer+
173
+
174
+ character := character_cue (dialog | (dialog? (parenthetical dialog)+)) trailer
175
+
176
+ montage := montage_heading montage_item+ transition? trailer+
177
+
178
+ action := char schar* nline trailer
179
+
180
+ character_cue := hspace+ schar+ nline
181
+
182
+ dialog := hspace+ (char - '(') schar* nline
183
+
184
+ insert := hspace+ schar+ nline trailer
185
+
186
+ montage_item := [A-Z] ') ' schar* nline trailer
187
+
188
+ montage_heading := ('MONTAGE' | 'SERIES OF SHOTS') schar* nline trailer
189
+
190
+ parenthetical := hspace+ '(' schar+ ')' trailer
191
+
192
+ scene_heading := char schar* nline trailer
193
+
194
+ slug_line := [A-Z] [A-Z0-9!-/:-@[-`{-~ ]* trailer trailer
195
+
196
+ transition := hspace+ [A-Z] ([A-Z ]* [A-Z])? [:.] trailer trailer
197
+
198
+ title_page := tp_line (tp_line tp_line*)? trailer+
199
+
200
+ tp_line := hspace+ char schar* nline
201
+
202
+ trailer := hspace* nline
203
+
204
+ schar := char | hspace
205
+
206
+ hspace := [ \t]
207
+
208
+ nline := '\r\n' | '\n'
209
+
210
+ char := any - space
211
+
212
+ space := [\t\v\f\n\r ]
213
+
214
+ any = any character
215
+
216
+
217
+ == Configuration
218
+
219
+ Eleanor uses YAML[http://www.yaml.org] to store user configurations. (Ruby
220
+ and YAML are like peas and carrots.) Here's a YAML fragment that sets scene
221
+ heading options:
222
+
223
+ SceneHeading:
224
+ can_break_across_pages: false
225
+ keep_with_nexts: [Action, CharacterCue]
226
+ limit_to_one_line: true
227
+ margin_bottom: 1.lines
228
+ margin_left: 1.5.inches
229
+ margin_top: |
230
+ (@is_first_on_page ? 0 : 2).lines
231
+ width: 6.inches
232
+
233
+ Options make extensive use of the Length subclasses, which let you to specify
234
+ lengths in inches, points, or lines. See Length for more info.
235
+
236
+ === Configurations Create Class Methods
237
+
238
+ You can set options for any class in the Eleanor namespace this way. In fact,
239
+ each option dynamically adds a class method that returns the value of the
240
+ option. So, with the above YAML, you could evaluate the following for
241
+ example:
242
+
243
+ Eleanor::SceneHeading.keep_with_nexts # => ['Action', 'CharacterCue']
244
+ Eleanor::SceneHeading.margin_left # => #<Inches:0x7ff16768 @val=1.5>
245
+
246
+ === Configurations Create Instance Methods
247
+
248
+ You might notice that the values of margin_bottom, margin_left, margin_top,
249
+ and width are actually strings. There's one other level of metaprogramming
250
+ going on here: in addition to defining a class method, each option also defines
251
+ an instance method. If the value of the option is a string, this method
252
+ <b>nakedly evals</b> the string in the context of the Eleanor object; otherwise
253
+ the method just returns the value. Note the <b>naked eval</b> part. Don't
254
+ go sticking system('rm -rf /') in your options unless you hate yourself.
255
+
256
+ Anyway, this is why values like "1.5.inches" work; when the string "1.5.inches"
257
+ is eval'ed by Eleanor, it yields an Inches object. But the more interesting
258
+ example above is the value of margin_top. All paragraphs have a member
259
+ @is_first_on_page, and margin_top uses it to dynamically determine the top
260
+ margin for scene headings.
261
+
262
+ === Configuration Files on the Command Line
263
+
264
+ When you run Eleanor from the command line, it checks for a config file in the
265
+ following locations, in this order:
266
+
267
+ 1. The value of the --config switch.
268
+
269
+ 2. $HOME/.eleanorrc, where $HOME is the output of
270
+
271
+ ruby -e "p ENV['HOME']"
272
+
273
+ 3. $DATADIR/eleanor/eleanor.yaml. This file is created if you install Eleanor
274
+ to site_ruby. $DATADIR is the output of
275
+
276
+ ruby -e "p Config::CONFIG['datadir']"
277
+
278
+ 4. $PACKAGEDIR/data/eleanor/eleanor.yaml, where $PACKAGEDIR is the directory in
279
+ which you've extracted the Eleanor package either manually or by installing
280
+ via RubyGems.
281
+
282
+ You can see which file will be used by default by running eleanor with --help
283
+ or no options and checking the --config switch.
284
+
285
+ === List of Configuration Options
286
+
287
+ An Eleanor configuration is a YAML hash whose keys are the names of Eleanor
288
+ classes. The hash's values are themselves hashes of options which apply to the
289
+ classes they're under. See the SceneHeading fragment above.
290
+
291
+ All options are required. Options set for superclasses (e.g., Paragraph)
292
+ apply to subclasses (e.g., Action, CharacterCue, Dialog, etc.) unless
293
+ specifically overridden by subclass options.
294
+
295
+ ==== Screenplay
296
+
297
+ [char_spacing]
298
+ A Length.
299
+ [font]
300
+ Either a font name recognized by libHaru (e.g., Courier, Helvetica) or a path
301
+ to a TTF on disk.
302
+ [font_size]
303
+ A Length.
304
+ [line_height_points]
305
+ A Numeric in points, e.g., 12. Not a Length.
306
+
307
+ ==== Page
308
+
309
+ [header]
310
+ Heading text to appear centered at the top of the page. Should be either nil
311
+ or a string.
312
+ [header_margin_top]
313
+ Distance from the top of the page that the header will be written. This is
314
+ independent of margin_top. A Length.
315
+ [height]
316
+ Page height. A Length.
317
+ [margin_bottom]
318
+ The page's bottom margin. A Length.
319
+ [margin_top]
320
+ The page's top margin. This is independent of header_margin_top. A Length.
321
+ [page_number_display]
322
+ A string that will be written as the page number. Practically this should be
323
+ a string to be eval'ed, and the code probably should make use of the page's
324
+ @page_no member (also available as an attribute reader), e.g., "#@page_no.".
325
+ May also be nil.
326
+ [page_number_margin_right]
327
+ Page numbers are flushed right at this margin. A Length.
328
+ [page_number_margin_top]
329
+ The top margin of the page number. This is independent of header_margin_top
330
+ and margin_top. A Length.
331
+ [width]
332
+ Page width. A Length.
333
+
334
+ ==== TitlePage
335
+
336
+ The options set for Page apply to TitlePage as well, unless overridden. In
337
+ addition, title pages have the option:
338
+
339
+ [margin_left]
340
+ The author's contact information is set off from the very left side of the
341
+ paper by this Length.
342
+
343
+ ==== Paragraph
344
+
345
+ The values set for Paragraph apply to all types of paragraphs (which is to say,
346
+ Eleanor::Paragraph subclasses) unless overridden by the specific types.
347
+
348
+ [align]
349
+ "left" if the paragraph flushes left, "center" if each line in the paragraph
350
+ is centered, and "right" if the paragraph flushes right. (Really only
351
+ transitions should be flushed right, and no paragraph should be centered.)
352
+ [can_break_across_pages]
353
+ True if the paragraph can be split at a page break and false if not.
354
+ [keep_with_nexts]
355
+ If specified directly in the YAML, this should be an array of paragraph types.
356
+ No page breaks will be allowed between the type of paragraph in which this
357
+ option occurs and any of the types in the array. Example: CharacterCue would
358
+ have this set to [Dialog, Parenthetical]. If specified as a string to be
359
+ eval'ed, this option should yield true or false. The code will have variable
360
+ +next_para+ available to it.
361
+ [limit_to_one_line]
362
+ True if the paragraph must be no more than one line, false otherwise.
363
+ [margin_bottom]
364
+ The amount of blank space that should appear below the paragraph. A Length.
365
+ [margin_left]
366
+ The paragraph is offset from the very left side of the paper by this Length.
367
+ [margin_top]
368
+ The amount of blank space that should appear above the paragraph. A Length.
369
+ If this is a string to be eval'ed, the code may have variable +prev_para+
370
+ available to it, depending on the context in which it's called. Use
371
+ defined?(prev_para) to test whether it does.
372
+ [min_orphan_lines_allowed]
373
+ Used when deciding how to split the paragraph across a page break. At least
374
+ this number of lines must be left on the first page for the split to be
375
+ allowed. An Integer >= 1.
376
+ [min_orphan_sentences_allowed]
377
+ Used when deciding how to split the paragraph across a page break. At least
378
+ this number of sentences must be left on the first page for the split to be
379
+ allowed. An Integer >= 1.
380
+ [min_widow_lines_allowed]
381
+ Used when deciding how to split the paragraph across a page break. At least
382
+ this number of lines must be pushed to the second page for the split to be
383
+ allowed. An Integer >= 1.
384
+ [min_widow_sentences_allowed]
385
+ Used when deciding how to split the paragraph across a page break. At least
386
+ this number of sentences must be pushed to the second page for the split to be
387
+ allowed. An Integer >= 1.
388
+ [text]
389
+ When this is set the parsed text of the paragraph is ignored, and this text is
390
+ used instead. Really only useful for Eleanor::More, e.g., "(MORE)".
391
+ [width]
392
+ The paragraph will be no wider than this Length.
393
+
394
+ ==== CharacterCue
395
+
396
+ A couple of special options:
397
+
398
+ [continuation_modifier]
399
+ When consecutive character cues in a scene refer to the same character, this
400
+ string appears in parentheses next to those cues except the first, e.g.,
401
+ "CONT'D". May be nil.
402
+ [widow_modifier]
403
+ When dialog is split across a page break, a character cue is inserted at the
404
+ top of the second page. This string appears in parentheses next to that cue,
405
+ e.g., "CONT'D". May be nil.
406
+
407
+
408
+ == Prior Art
409
+
410
+ There are many existing software solutions for generating screenplays. They
411
+ fall broadly into three categories (I leave out ad-hoc methods, which are too
412
+ awful to contemplate):
413
+
414
+ * Professional screenwriting software. Surely the best option if
415
+ you're a professional or if you've got the scratch to pay for it. Advantages
416
+ include WYSIWYG editing and all the benefits concomitant with using the
417
+ same tools that other professionals use.
418
+ * Free screenwriting software. Not so many options here. Some good,
419
+ some bad, some open source, some trialware, some even Web-based. Many do not
420
+ output PDF or require you to jump through hoops to do so.
421
+ * Templates. There are numerous Microsoft Word templates, OpenOffice
422
+ templates, TeX macro packages, and even an Emacs mode on teh Intarwebs. I
423
+ haven't found one that adheres completely to convention and doesn't produce
424
+ amateurish results, but I haven't looked hard, either.
425
+
426
+ A roundup of software can be found at
427
+ http://en.wikibooks.org/wiki/Movie_Making_Manual-Screenplay_Format.
428
+
429
+
430
+ == Contact
431
+
432
+ Copyright (c) 2008 chiisaitsu <chiisaitsu@gmail.com>
433
+
434
+ http://rubyforge.org/projects/eleanor
435
+
436
+
437
+ == License
438
+
439
+ See file LICENSE accompanying this package.