Top Level Namespace
- Includes:
- Nanoc3::Helpers::Blogging, Nanoc3::Helpers::LinkTo, Nanoc3::Helpers::Rendering, Nanoc3::Helpers::Tagging
Defined Under Namespace
Modules: NanocStarterSet
Instance Method Summary collapse
- #asset_items(folder) ⇒ Object
-
#body_class ⇒ Object
Other helpers.
- #partial(name, vars = {}) ⇒ Object
- #pretty_date(date) ⇒ Object
-
#run_filters(item) ⇒ Object
Process an asset file, sprockets-style.
Instance Method Details
#asset_items(folder) ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/nanoc_starter_set/helpers.rb', line 31 def asset_items( folder ) items.select do |item| item.identifier =~ %r{^/#{folder}/} end.reject do |item| item.attributes[:all] end.map do |item| item end.sort_by( &:identifier ) end |
#body_class ⇒ Object
Other helpers
43 44 45 |
# File 'lib/nanoc_starter_set/helpers.rb', line 43 def body_class @item[:layout] || @item[:kind] end |
#partial(name, vars = {}) ⇒ Object
51 52 53 |
# File 'lib/nanoc_starter_set/helpers.rb', line 51 def partial( name, vars = {} ) render "partials/#{name}", vars end |
#pretty_date(date) ⇒ Object
47 48 49 |
# File 'lib/nanoc_starter_set/helpers.rb', line 47 def pretty_date( date ) attribute_to_time( date ).strftime( "%b %-d, %Y" ) end |
#run_filters(item) ⇒ Object
Process an asset file, sprockets-style
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/nanoc_starter_set/helpers.rb', line 17 def run_filters( item ) item[:filename].scan( /\.\w+/ ).reverse.each do |suffix| case suffix when ".erb" ; filter :erb when ".scss" ; filter :sass, Compass. when ".md" ; filter :kramdown, { enable_coderay: false, remove_block_html_tags: false, } when ".html" ; filter :typogruby end end end |