class Inkcite::Renderer::TopicList

Constants

TOC_INTERMEDIARY

Public Instance Methods

post_process(html, ctx) click to toggle source
# File lib/inkcite/renderer/topic.rb, line 47
def post_process html, ctx

  topics = ctx.data[:topics]
  if topics.blank?
    ctx.error '{topic-list} included but no topics defined'

  else

    # Sort the topics highest priority first.
    sorted_topics = topics.sort { |lhs, rhs| rhs.priority <=> lhs.priority }.collect(&:name).join(', ')
    html.gsub!(TOC_INTERMEDIARY, sorted_topics)

  end

  html
end
render(tag, opt, ctx) click to toggle source
# File lib/inkcite/renderer/topic.rb, line 64
def render tag, opt, ctx
  ctx.post_processors << self
  TOC_INTERMEDIARY
end