Class: Jekyll::PDF::Partial

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Helper
Defined in:
lib/jekyll/pdf/partial.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

#fix_relative_paths

Constructor Details

#initialize(doc, partial) ⇒ Partial

Initialize this Partial instance.

doc - The Document.

Returns the new Partial.



25
26
27
28
29
# File 'lib/jekyll/pdf/partial.rb', line 25

def initialize(doc, partial)
  self.doc = doc
  self.partial = partial
  self.content = build_partial(partial)
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



14
15
16
# File 'lib/jekyll/pdf/partial.rb', line 14

def content
  @content
end

#docObject

Returns the value of attribute doc.



11
12
13
# File 'lib/jekyll/pdf/partial.rb', line 11

def doc
  @doc
end

#extObject

Returns the value of attribute ext.



14
15
16
# File 'lib/jekyll/pdf/partial.rb', line 14

def ext
  @ext
end

#outputObject



72
73
74
# File 'lib/jekyll/pdf/partial.rb', line 72

def output
  @output ||= Renderer.new(doc.site, self, site.site_payload).run
end

#partialObject

Returns the value of attribute partial.



12
13
14
# File 'lib/jekyll/pdf/partial.rb', line 12

def partial
  @partial
end

#writeObject

generate temp file & set output to it’s path



77
78
79
# File 'lib/jekyll/pdf/partial.rb', line 77

def write
  @write
end

Instance Method Details

#dataObject

Fetch YAML front-matter data from related doc, without layout key

Returns Hash of doc data



34
35
36
37
38
# File 'lib/jekyll/pdf/partial.rb', line 34

def data
  @data ||= doc.data.dup
  @data.delete("layout")
  @data
end

#dirObject

Returns the cache directory



52
53
54
# File 'lib/jekyll/pdf/partial.rb', line 52

def dir
  @dir ||= cache_dir
end

#idObject



47
48
49
# File 'lib/jekyll/pdf/partial.rb', line 47

def id
  File.basename(path, File.extname(path)) + "-" + Digest::MD5.hexdigest(to_s) + File.extname(path)
end

#inspectObject

Returns the shorthand String identifier of this doc.



68
69
70
# File 'lib/jekyll/pdf/partial.rb', line 68

def inspect
  "<Partial: #{self.id}>"
end

#pathObject



43
44
45
# File 'lib/jekyll/pdf/partial.rb', line 43

def path
  File.join(doc.path, partial)
end

#place_in_layout?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/jekyll/pdf/partial.rb', line 91

def place_in_layout?
  false
end

#to_liquidObject



60
61
62
63
64
65
# File 'lib/jekyll/pdf/partial.rb', line 60

def to_liquid
  doc.data[partial] = nil
  @to_liquid ||= doc.to_liquid
  doc.data[partial] = self
  @to_liquid
end

#to_sObject



56
57
58
# File 'lib/jekyll/pdf/partial.rb', line 56

def to_s
  output || content
end

#trigger_hooksObject



40
41
# File 'lib/jekyll/pdf/partial.rb', line 40

def trigger_hooks(*)
end