Class: Codex::Content
- Inherits:
-
Object
- Object
- Codex::Content
- Defined in:
- lib/codex/content.rb
Constant Summary collapse
- START_SLIDE =
%{<div class="slide">\n}- END_SLIDE =
%{</div>\n}- BETWEEN_SLIDES =
END_SLIDE + "\n" + START_SLIDE
Instance Method Summary collapse
-
#initialize(original) ⇒ Content
constructor
A new instance of Content.
- #split_into_slides(textile) ⇒ Object
- #to_html ⇒ Object
Constructor Details
#initialize(original) ⇒ Content
Returns a new instance of Content.
8 9 10 |
# File 'lib/codex/content.rb', line 8 def initialize(original) @original = original.sub(/__END__.*/m, '').gsub(/__SKIP__.*?__ENDSKIP__/m, '') end |
Instance Method Details
#split_into_slides(textile) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/codex/content.rb', line 18 def (textile) result = [] = textile.split(/^h1/).each do || unless .empty? result << START_SLIDE << "\nh1" << << END_SLIDE end end result.join end |
#to_html ⇒ Object
12 13 14 15 16 |
# File 'lib/codex/content.rb', line 12 def to_html textile = Codex::Filters.instance.filter_all(@original) content = (textile) html = RedCloth.new(content).to_html end |