Module | CodeRay::Encoders::HTML::Output |
In: |
lib/coderay/encoders/html/output.rb
|
SPAN | = | Template.new '<span class="CodeRay"><%CONTENT%></span>' |
DIV | = | Template.new <<-DIV <div class="CodeRay"> <div class="code"><pre><%CONTENT%></pre></div> </div> DIV |
TABLE | = | Template.new <<-TABLE <table class="CodeRay"><tr> <td class="line-numbers" title="double click to toggle" ondblclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre><%LINE_NUMBERS%></pre></td> <td class="code"><pre><%CONTENT%></pre></td> </tr></table> TABLE |
PAGE | = | Template.new <<-PAGE <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <style type="text/css"> .CodeRay .line-numbers a { text-decoration: inherit; color: inherit; } body { background-color: white; padding: 0; margin: 0; } <%CSS%> .CodeRay { border: none; } </style> </head> <body> <%CONTENT%> </body> </html> PAGE |
css | [RW] | |
wrapped_in | [W] |
# File lib/coderay/encoders/html/output.rb, line 58 58: def apply_title! title 59: self.sub!(/(<title>)(<\/title>)/) { $1 + title + $2 } 60: self 61: end
# File lib/coderay/encoders/html/output.rb, line 89 89: def stylesheet in_tag = false 90: Output.make_stylesheet @css, in_tag 91: end
# File lib/coderay/encoders/html/output.rb, line 63 63: def wrap! element, *args 64: return self if not element or element == wrapped_in 65: case element 66: when :div 67: raise "Can't wrap %p in %p" % [wrapped_in, element] unless wrapped_in? nil 68: wrap_in! DIV 69: when :span 70: raise "Can't wrap %p in %p" % [wrapped_in, element] unless wrapped_in? nil 71: wrap_in! SPAN 72: when :page 73: wrap! :div if wrapped_in? nil 74: raise "Can't wrap %p in %p" % [wrapped_in, element] unless wrapped_in? :div 75: wrap_in! Output.page_template_for_css(@css) 76: if args.first.is_a?(Hash) && title = args.first[:title] 77: apply_title! title 78: end 79: self 80: when nil 81: return self 82: else 83: raise "Unknown value %p for :wrap" % element 84: end 85: @wrapped_in = element 86: self 87: end
# File lib/coderay/encoders/html/output.rb, line 53 53: def wrap_in! template 54: Template.wrap! self, template, 'CONTENT' 55: self 56: end
# File lib/coderay/encoders/html/output.rb, line 48 48: def wrapped_in 49: @wrapped_in ||= nil 50: end