Module: Daddy::Formatter::DaddyHtml
- Included in:
- Html
- Defined in:
- lib/daddy/formatter/daddy_html.rb
Instance Method Summary collapse
- #after_menu ⇒ Object
- #before_menu ⇒ Object
- #feature_dir(feature, short = false) ⇒ Object
- #feature_id ⇒ Object
- #magic_comment?(comment_line) ⇒ Boolean
- #make_menu_for_publish ⇒ Object
- #ruby_version_dir ⇒ Object
- #should_expand ⇒ Object
- #title ⇒ Object
Instance Method Details
#after_menu ⇒ Object
33 34 35 36 37 38 |
# File 'lib/daddy/formatter/daddy_html.rb', line 33 def if ENV['PUBLISH'] @builder << '</div>' @builder << '</div>' end end |
#before_menu ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/daddy/formatter/daddy_html.rb', line 21 def if ENV['PUBLISH'] @builder << "<div>" @builder.div(:id => 'menu') do @builder << end @builder << "<div class='contents'>" end end |
#feature_dir(feature, short = false) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/daddy/formatter/daddy_html.rb', line 49 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 |
#feature_id ⇒ Object
45 46 47 |
# File 'lib/daddy/formatter/daddy_html.rb', line 45 def feature_id @feature.file.gsub(/(\/|\.|\\)/, '_') end |
#magic_comment?(comment_line) ⇒ Boolean
74 75 76 77 78 79 80 81 82 |
# File 'lib/daddy/formatter/daddy_html.rb', line 74 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 |
#make_menu_for_publish ⇒ Object
40 41 42 43 |
# File 'lib/daddy/formatter/daddy_html.rb', line 40 def template = File.join(File.dirname(__FILE__), 'menu.html.erb') ERB.new(File.read(template), 0, '-').result end |
#ruby_version_dir ⇒ Object
7 8 9 10 11 12 |
# File 'lib/daddy/formatter/daddy_html.rb', line 7 def ruby_version_dir unless @_ruby_version_dir @_ruby_version_dir = RUBY_VERSION.split('.')[0..1].join('.') + '.0' end @_ruby_version_dir end |
#should_expand ⇒ Object
70 71 72 |
# File 'lib/daddy/formatter/daddy_html.rb', line 70 def ['t', 'true'].include?(ENV['EXPAND'].to_s.downcase) end |