Sha256: 4d6c63dd50d670cf323809bc60ff6c987cef5f1e4793b85b18cb8fa40959ee1b

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 KB

Contents

require 'date'
require 'pathname'
require 'mustache'

require 'jazzy/config'
require 'jazzy/gem_version'
require 'jazzy/jazzy_markdown'

module Jazzy
  class Doc < Mustache
    include Config::Mixin

    self.template_name = 'doc'

    def copyright
      copyright = config.copyright || (
        # Fake date is used to keep integration tests consistent
        date = ENV['JAZZY_FAKE_DATE'] || DateTime.now.strftime('%Y-%m-%d')
        year = date[0..3]
        "&copy; #{year} [#{config.author_name}](#{config.author_url}). " \
        "All rights reserved. (Last updated: #{date})"
      )
      Markdown.render_copyright(copyright).chomp
    end

    def jazzy_version
      # Fake version is used to keep integration tests consistent
      ENV['JAZZY_FAKE_VERSION'] || Jazzy::VERSION
    end

    def objc_first?
      config.objc_mode && config.hide_declarations != 'objc'
    end

    def language_stub
      objc_first? ? 'objc' : 'swift'
    end

    def module_version
      config.version_configured ? config.version : nil
    end

    def docs_title
      if config.title_configured
        config.title
      elsif config.version_configured
        # Fake version for integration tests
        version = ENV['JAZZY_FAKE_MODULE_VERSION'] || config.version
        "#{config.module_name} #{version} Docs"
      else
        "#{config.module_name} Docs"
      end
    end

    def enable_katex
      Markdown.has_math
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jazzy-0.13.7 lib/jazzy/doc.rb
jazzy-0.13.6 lib/jazzy/doc.rb
jazzy-0.13.5 lib/jazzy/doc.rb
jazzy-0.13.4 lib/jazzy/doc.rb
jazzy-0.13.3 lib/jazzy/doc.rb
jazzy-0.13.2 lib/jazzy/doc.rb