Class: Clayoven::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/clayoven.rb

Direct Known Subclasses

ContentPage, IndexPage

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



23
24
25
# File 'lib/clayoven.rb', line 23

def body
  @body
end

#filenameObject

Returns the value of attribute filename.



23
24
25
# File 'lib/clayoven.rb', line 23

def filename
  @filename
end

#indexfillObject

Returns the value of attribute indexfill.



23
24
25
# File 'lib/clayoven.rb', line 23

def indexfill
  @indexfill
end

#paragraphsObject

Returns the value of attribute paragraphs.



23
24
25
# File 'lib/clayoven.rb', line 23

def paragraphs
  @paragraphs
end

Returns the value of attribute permalink.



23
24
25
# File 'lib/clayoven.rb', line 23

def permalink
  @permalink
end

#targetObject

Returns the value of attribute target.



23
24
25
# File 'lib/clayoven.rb', line 23

def target
  @target
end

#timestampObject

Returns the value of attribute timestamp.



23
24
25
# File 'lib/clayoven.rb', line 23

def timestamp
  @timestamp
end

#titleObject

Returns the value of attribute title.



23
24
25
# File 'lib/clayoven.rb', line 23

def title
  @title
end

#topicObject

Returns the value of attribute topic.



23
24
25
# File 'lib/clayoven.rb', line 23

def topic
  @topic
end

#topicsObject

Returns the value of attribute topics.



23
24
25
# File 'lib/clayoven.rb', line 23

def topics
  @topics
end

Instance Method Details

#render(topics) ⇒ Object

Writes out HTML pages. Takes a list of topics to render

Prints a “[GEN]” line for every file it writes out.



29
30
31
32
33
34
35
36
37
38
# File 'lib/clayoven.rb', line 29

def render(topics)
  @topics = topics
  @paragraphs = ClayText.process! @body
  Slim::Engine.set_default_options pretty: true, sort_attrs: false
  rendered = Slim::Template.new { IO.read("design/template.slim") }.render(self)
  File.open(@target, mode="w") do |targetio|
    nbytes = targetio.write(rendered)
    puts "[GEN] #{@target} (#{nbytes} bytes out)"
  end
end