Class: RageRender::WebcomicDrop

Inherits:
Jekyll::Drops::Drop
  • Object
show all
Extended by:
Forwardable, Pipettes
Defined in:
lib/ragerender/jekyll.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Pipettes

clean_payload, def_data_delegator, def_image_metadata, extended

Class Method Details

.def_config_delegator(source, target) ⇒ Object



128
129
130
# File 'lib/ragerender/jekyll.rb', line 128

def self.def_config_delegator source, target
  define_method(target) { @obj.site.config[source.to_s] }
end

Instance Method Details



157
158
159
# File 'lib/ragerender/jekyll.rb', line 157

def banner
  Pathname.new(@obj.site.baseurl || '/').join(@obj.site.config['banner'] || '').to_path
end

#cfscriptcodeObject



184
185
186
187
188
189
190
# File 'lib/ragerender/jekyll.rb', line 184

def cfscriptcode
  <<~HTML
    <script type="text/javascript">
      function jumpTo(place) { window.location = place; }
    </script>
  HTML
end

#copyrightsObject



153
154
155
# File 'lib/ragerender/jekyll.rb', line 153

def copyrights
  escape @obj.site.config['copyrights'].gsub('[year]', Date.today.year.to_s)
end

#cssObject



192
193
194
195
196
# File 'lib/ragerender/jekyll.rb', line 192

def css
  css_files = @obj.site.static_files.select {|f| f.extname == '.css'}.map(&:path).to_a
  css_files << Pathname.new(@obj.site.theme.includes_path).join('layout.css') unless css_files.any?
  css_files.map {|f| File.read f }.join
end

#extrapagesObject



178
179
180
181
182
# File 'lib/ragerender/jekyll.rb', line 178

def extrapages
  @obj.site.pages.reject {|page| page.data['hidden'] }.map do |page|
    {'link' => page.url, 'title' => escape(page.data['title'])}
  end
end

#fallback_dataObject



218
219
220
# File 'lib/ragerender/jekyll.rb', line 218

def fallback_data
  {}
end

#hasblogsObject



170
171
172
# File 'lib/ragerender/jekyll.rb', line 170

def hasblogs
  @obj.site.posts.docs.any?
end

#hidefromhostObject



174
175
176
# File 'lib/ragerender/jekyll.rb', line 174

def hidefromhost
  false
end

#iscomicpageObject



210
211
212
# File 'lib/ragerender/jekyll.rb', line 210

def iscomicpage
  @obj.type == :comics
end

#isextrapageObject



214
215
216
# File 'lib/ragerender/jekyll.rb', line 214

def isextrapage
  @obj.type == :pages && @obj.data['hidden'] != true
end

#lastupdatedmyObject



149
150
151
# File 'lib/ragerender/jekyll.rb', line 149

def lastupdatedmy
  Time.now.strftime('%d/%m/%Y')
end

#layoutcssObject



198
199
200
201
202
203
204
# File 'lib/ragerender/jekyll.rb', line 198

def layoutcss
  <<~HTML
  <style type="text/css">
    #{css}
  </style>
  HTML
end

#pagetitleObject



206
207
208
# File 'lib/ragerender/jekyll.rb', line 206

def pagetitle
  escape @obj.data['title']
end

#webcomicavatarObject



161
162
163
# File 'lib/ragerender/jekyll.rb', line 161

def webcomicavatar
  Pathname.new(@obj.site.baseurl || '/').join(@obj.site.config['webcomicavatar'] || '').to_path
end

#webcomiciconObject



165
166
167
# File 'lib/ragerender/jekyll.rb', line 165

def webcomicicon
  @obj.site.config.fetch('webcomicavatar', '')
end

#webcomicnameObject



137
138
139
# File 'lib/ragerender/jekyll.rb', line 137

def webcomicname
  escape @obj.site.config['title']
end

#webcomicsloganObject



141
142
143
# File 'lib/ragerender/jekyll.rb', line 141

def webcomicslogan
  escape @obj.site.config['description']
end

#webcomicurlObject



145
146
147
# File 'lib/ragerender/jekyll.rb', line 145

def webcomicurl
  @obj.site.baseurl
end