fountainrb 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.
data/lib/fountainrb.rb ADDED
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "fountainrb/version"
4
+ require_relative "fountainrb/errors"
5
+ require_relative "fountainrb/inline"
6
+ require_relative "fountainrb/elements"
7
+ require_relative "fountainrb/title_page"
8
+ require_relative "fountainrb/tokenizer"
9
+ require_relative "fountainrb/parser"
10
+ require_relative "fountainrb/screenplay"
11
+ require_relative "fountainrb/validator"
12
+ require_relative "fountainrb/html_renderer"
13
+ require_relative "fountainrb/plain_text_renderer"
14
+
15
+ # A pure-Ruby parser for the Fountain screenplay markup language.
16
+ #
17
+ # require "fountainrb"
18
+ #
19
+ # screenplay = FountainRB.parse(File.read("script.fountain"))
20
+ # screenplay.scenes.first.text #=> "INT. HOUSE - DAY"
21
+ # screenplay.character_names #=> ["STEEL", "BRICK"]
22
+ # puts screenplay.to_html
23
+ #
24
+ # See https://fountain.io/syntax/ for the language reference.
25
+ module FountainRB
26
+ class << self
27
+ # Parse Fountain source.
28
+ #
29
+ # @param source [String]
30
+ # @return [Screenplay]
31
+ def parse(source)
32
+ Parser.new(source).parse
33
+ end
34
+
35
+ # Read and parse a Fountain file.
36
+ #
37
+ # @param path [String, Pathname]
38
+ # @param encoding [String]
39
+ # @return [Screenplay]
40
+ def parse_file(path, encoding: "UTF-8")
41
+ parse(File.read(path, encoding: encoding))
42
+ end
43
+
44
+ # Check Fountain source for likely mistakes.
45
+ #
46
+ # Fountain parsing is intentionally forgiving, so this reports problems
47
+ # that would otherwise be silently recovered from: unclosed notes or
48
+ # boneyards, stray closing brackets, malformed scene numbers, and orphan
49
+ # dual-dialogue carets.
50
+ #
51
+ # @param source [String, nil]
52
+ # @return [Array<Issue>]
53
+ def validate(source)
54
+ Validator.new(source).validate
55
+ end
56
+
57
+ # True when {validate} finds no issues in +source+.
58
+ #
59
+ # @param source [String, nil]
60
+ # @return [Boolean]
61
+ def valid?(source)
62
+ validate(source).empty?
63
+ end
64
+ end
65
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fountainrb
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Distark
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2026-10-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '13.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.12'
41
+ description: |
42
+ fountainrb is a dependency-free Ruby implementation of the Fountain
43
+ screenplay markup language (https://fountain.io/syntax/). It tokenizes
44
+ title pages, scene headings, action, characters, dialogue, parentheticals,
45
+ dual dialogue, lyrics, transitions, centered text, page breaks, sections,
46
+ synopses, notes and boneyards, parses inline emphasis, and can render a
47
+ parsed screenplay to HTML, plain text or JSON.
48
+ email:
49
+ - dev@distark.com
50
+ executables:
51
+ - fountainrb
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - CHANGELOG.md
56
+ - LICENSE.txt
57
+ - README.md
58
+ - exe/fountainrb
59
+ - lib/fountainrb.rb
60
+ - lib/fountainrb/elements.rb
61
+ - lib/fountainrb/errors.rb
62
+ - lib/fountainrb/html_renderer.rb
63
+ - lib/fountainrb/inline.rb
64
+ - lib/fountainrb/parser.rb
65
+ - lib/fountainrb/plain_text_renderer.rb
66
+ - lib/fountainrb/screenplay.rb
67
+ - lib/fountainrb/title_page.rb
68
+ - lib/fountainrb/tokenizer.rb
69
+ - lib/fountainrb/validator.rb
70
+ - lib/fountainrb/version.rb
71
+ homepage: https://github.com/jtoy/fountainrb
72
+ licenses:
73
+ - MIT
74
+ metadata:
75
+ homepage_uri: https://github.com/jtoy/fountainrb
76
+ source_code_uri: https://github.com/jtoy/fountainrb/tree/main
77
+ changelog_uri: https://github.com/jtoy/fountainrb/blob/main/CHANGELOG.md
78
+ rubygems_mfa_required: 'true'
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: 2.7.0
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ requirements: []
94
+ rubygems_version: 3.5.23
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: A pure-Ruby parser for Fountain screenplays
98
+ test_files: []