Sha256: 3b216a37dbb121e57c3fb7d9bf5d7d758d07fb2442cae8150e2a2876ad4a017d

Contents?: true

Size: 737 Bytes

Versions: 32

Compression:

Stored size: 737 Bytes

Contents

view(:summary) do |*args|
  params = args.extract_options!
  briefcase = args.first

  briefcase.present(:default, params).tap do |hash|
    if summary = briefcase.pages.find {|p| p.title == "Summary" }
      hash[:summary] = summary.to_model.as_json(params)
    end

    if briefcase.has_table_of_contents?
      hash[:table_of_contents] = table_of_contents.as_json(params)
    end
  end
end

config do
  set(:documentation_path, File.join(File.dirname(__FILE__), 'documentation'))
end

class Brief::Briefcase
  def has_table_of_contents?
    docs_path.join('index.md').exist?
  end

  def table_of_contents
    doc = Brief::Document.new(briefcase.docs_path.join("index.md"), document_type: "outline")
    doc && doc.to_model
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
brief-1.14.2 apps/blueprint/config.rb
brief-1.14.1 apps/blueprint/config.rb
brief-1.14.0 apps/blueprint/config.rb
brief-1.13.2 apps/blueprint/config.rb
brief-1.13.1 apps/blueprint/config.rb
brief-1.12.9 apps/blueprint/config.rb
brief-1.12.8 apps/blueprint/config.rb
brief-1.12.7 apps/blueprint/config.rb
brief-1.12.6 apps/blueprint/config.rb
brief-1.12.5 apps/blueprint/config.rb
brief-1.12.4 apps/blueprint/config.rb
brief-1.12.3 apps/blueprint/config.rb
brief-1.12.2 apps/blueprint/config.rb
brief-1.12.1 apps/blueprint/config.rb
brief-1.12.0 apps/blueprint/config.rb
brief-1.11.10 apps/blueprint/config.rb
brief-1.11.9 apps/blueprint/config.rb
brief-1.11.8 apps/blueprint/config.rb
brief-1.11.7 apps/blueprint/config.rb
brief-1.11.6 apps/blueprint/config.rb