Class: Beamlet::Generator
- Inherits:
-
Object
- Object
- Beamlet::Generator
- Defined in:
- lib/beamlet/generator.rb
Instance Method Summary collapse
- #document ⇒ Object
- #frame ⇒ Object
-
#initialize(opts = {}) ⇒ Generator
constructor
A new instance of Generator.
- #part ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Generator
Returns a new instance of Generator.
5 6 7 |
# File 'lib/beamlet/generator.rb', line 5 def initialize(opts = {}) @opts = default_opts.merge(opts) end |
Instance Method Details
#document ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/beamlet/generator.rb', line 9 def document titleframe = @opts[:titleframe] ? Templates::TITLE_FRAME : "" Templates::DOCUMENT % { theme: @opts[:theme], title: escape(@opts[:title]), author: escape(@opts[:author]), date: escape(@opts[:date]), titleframe: titleframe, body: "% --- vos frames ici ---" } end |
#frame ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/beamlet/generator.rb', line 27 def frame body = build_body body = split_into_columns(body, @opts[:splits]) if @opts[:splits] && @opts[:splits] > 1 = [] << "fragile" if @opts[:fragile] << "allowframebreaks" if @opts[:allowframebreaks] opt_str = .empty? ? "" : "[#{.join(',')}]" Templates::FRAME % { options: opt_str, title: escape(@opts[:frame_title] || ""), body: indent(body, 2) } end |