Sha256: 5312d02fc4e963566940f6f4ca084053a79935cd70144ad2ca72bef0d85e2951

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

module Octopress
  module Ink
    module Assets
      class Template < Asset
        attr_reader :pages

        def initialize(*args)
          super(*args)
          @pages = []
        end

        def add; end

        def info
          message = filename.ljust(35)

          if disabled?
            message += "-disabled-"
          elsif path.to_s != plugin_path
            shortpath = File.join(Plugins.custom_dir.sub(Dir.pwd,''), dir).sub('/','')
            message += "from: #{shortpath}/#{filename}"
          end

          message = "   #{message}\n"

          self.pages.each do |page|
            message << "    - /#{page.path.sub('index.html', '')}\n"
          end
          message
        end

        def new_page(permalink, data={})
          return if disabled?

          dir = File.dirname(permalink)
          name = File.basename(permalink)

          page = Ink::TemplatePage.new(Octopress.site, File.dirname(self.path), '.', File.basename(self.path))

          page.data.merge!(data)

          page.dir = dir
          page.name = name
          page.process(name)

          self.pages << page

          page
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
octopress-ink-1.0.0.rc.47 lib/octopress-ink/assets/template.rb