Sha256: c734ae90574f94b6e4164cad11d579a9b948ba3b3e8c6a7a4e93628eeabdc9cf

Contents?: true

Size: 1.63 KB

Versions: 15

Compression:

Stored size: 1.63 KB

Contents

# coding: UTF-8

module Daddy
  module Formatter
    module DaddyHtml
      
      def title
        ENV['TITLE'] || 'Daddy'
      end
      
      def before_menu
        if ENV['PUBLISH']
          @builder << "<div>"

          @builder.div(:id => 'menu') do
              @builder << make_menu_for_publish
          end

          @builder << "<div class='contents'>"
        end
      end

      def after_menu
        if ENV['PUBLISH']
          @builder << '</div>'
          @builder << '</div>'
        end
      end

      def make_menu_for_publish
        FileUtils.mkdir_p('tmp')
        menu = File.join('tmp', 'menu.html')
        system("erb -T - #{File.dirname(__FILE__)}/menu.html.erb > #{menu}")
        File.read(menu)
      end

      def feature_id
        @feature.file.gsub(/(\/|\.|\\)/, '_')
      end

      def feature_dir(feature, short = false)
        ret = ''
        
        split = feature.file.split(File::SEPARATOR)
        split.reverse[1..-2].each_with_index do |dir, i|
          break if dir == '仕様書' or dir == '開発日記'

          if i == 0
            if short
              ret = dir.split('.').first + '.'
            else
              ret = dir
            end
          else
            ret = dir.split('.').first + '.' + ret
          end
        end

        ret
      end

      def should_expand
        ['t', 'true'].include?(ENV['EXPAND'].to_s.downcase)
      end

      def magic_comment?(comment_line)
        comment = comment_line.to_s

        ['language', 'format'].each do |magic|
          return true if /#\s*#{magic}\s*:.*/ =~ comment
        end
        
        false
      end

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
daddy-0.2.11 lib/daddy/formatter/daddy_html.rb
daddy-0.2.10 lib/daddy/formatter/daddy_html.rb
daddy-0.2.9 lib/daddy/formatter/daddy_html.rb
daddy-0.2.8 lib/daddy/formatter/daddy_html.rb
daddy-0.2.7 lib/daddy/formatter/daddy_html.rb
daddy-0.2.6 lib/daddy/formatter/daddy_html.rb
daddy-0.2.5 lib/daddy/formatter/daddy_html.rb
daddy-0.2.4 lib/daddy/formatter/daddy_html.rb
daddy-0.2.3 lib/daddy/formatter/daddy_html.rb
daddy-0.2.1 lib/daddy/formatter/daddy_html.rb
daddy-0.1.26 lib/daddy/formatter/daddy_html.rb
daddy-0.1.25 lib/daddy/formatter/daddy_html.rb
daddy-0.1.24 lib/daddy/formatter/daddy_html.rb
daddy-0.1.23 lib/daddy/formatter/daddy_html.rb
daddy-0.1.22 lib/daddy/formatter/daddy_html.rb