class BridgetownNotable::Builder
Constants
- LINK_PATTERN
Public Instance Methods
attachments()
click to toggle source
# File lib/bridgetown-notable/builder.rb, line 13 def attachments notable_pages.each do |page| page.content.gsub!("(@attachment/", "(/attachments/") end end
backlinks()
click to toggle source
# File lib/bridgetown-notable/builder.rb, line 19 def backlinks notable_pages.each do |page| pagename = page.data[:title] backlinks = site.pages.select { |pg| pg.content =~ %r!\[\[#{pagename}\]\]!i } page.data[:backlinks] = backlinks if backlinks.any? end end
build()
click to toggle source
# File lib/bridgetown-notable/builder.rb, line 7 def build generator :attachments generator :backlinks generator :wikilinks end
wikilinks()
click to toggle source
# File lib/bridgetown-notable/builder.rb, line 27 def wikilinks notable_pages.each do |page| page.content.gsub!(LINK_PATTERN) do |match_string| title = match_string.match(LINK_PATTERN)[1] link = site.pages.detect { |pg| pg.data[:title] == title } if link %(<a href="#{link.url}" class="wikilink">#{link.data[:title]}</a>) else title end end end end
Private Instance Methods
notable?(page)
click to toggle source
# File lib/bridgetown-notable/builder.rb, line 47 def notable?(page) page.data[:notable] end
notable_pages()
click to toggle source
# File lib/bridgetown-notable/builder.rb, line 43 def notable_pages site.pages.select { |page| notable?(page) } end