Class: Zenweb::TagIndex

Inherits:
GeneratedIndex show all
Defined in:
lib/zenweb/page.rb

Direct Known Subclasses

TagDetail

Constant Summary

Constants inherited from Page

Page::KRAMDOWN_CONFIG

Instance Attribute Summary

Attributes inherited from GeneratedIndex

#pages

Attributes inherited from FakePage

#content, #date

Attributes inherited from Page

#binary, #parent, #path, #site, #subpages

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GeneratedIndex

collate_by, #content, #initialize, page_url, #wire

Methods inherited from Page

#[], #all_subpages, #all_subpages_by_level, #analytics, #body, #breadcrumbs, #change_frequency, #clean_url, #config, #content, #date, #date_from_path, #date_str, #dated?, #dated_path?, #depends_on, #disqus, #disqus_counts, #erb, #extend_md, #filetype, #filetypes, #format_date, #gauges_analytics, #generate, #google_ad, #google_analytics, #html?, #include, #index?, #initialize, #inspect, #layout, #link_head, #link_html, #markdown, #meta, #method_missing, #no_index?, #parent_url, #render, #render_erb, #render_less, #render_md, renderers_re, #run_js_script, #series_page, #stale?, #stylesheet, #subrender, #tag_pages, #url, #url_dir, #url_path, #wire

Constructor Details

This class inherits a constructor from Zenweb::GeneratedIndex

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Zenweb::Page

Class Method Details

.generate_all(site, dir, pages) ⇒ Object



550
551
552
# File 'lib/zenweb/page.rb', line 550

def self.generate_all site, dir, pages
  self.new site, "#{dir}/index.html.md.erb", pages
end

.tag_list(tag, pages) ⇒ Object



554
555
556
557
558
559
560
561
562
# File 'lib/zenweb/page.rb', line 554

def self.tag_list tag, pages
  r = []
  r << "### #{tag}"
  r << "#{pages.size} pages"
  r << ""
  r << pages.map { |page| "*  #{page.date.date} #{page_url page}" }
  r << ""
  r.join "\n"
end

.tags_for(pages) ⇒ Object



546
547
548
# File 'lib/zenweb/page.rb', line 546

def self.tags_for pages
  collate_by pages, :tags, "None"
end

Instance Method Details

#indexObject



564
565
566
567
568
# File 'lib/zenweb/page.rb', line 564

def index
  self.class.tags_for(pages).sort_by { |t,_| t.to_s.downcase }.map { |t, p|
    self.class.tag_list t, p
  }.join "\n"
end