Class Wee::Brush::Page
In: lib/wee/html_brushes.rb
Parent: Brush

Methods

title   with  

Constants

HTML_HTML = 'html'.freeze
HTML_HEAD = 'head'.freeze
HTML_TITLE = 'title'.freeze
HTML_BODY = 'body'.freeze

Public Instance methods

[Source]

# File lib/wee/html_brushes.rb, line 657
    def title(t)
      @title = t
      self
    end

[Source]

# File lib/wee/html_brushes.rb, line 631
    def with(text=nil, &block)
      @document.start_tag(HTML_HTML)
      @document.start_tag(HTML_HEAD)

      if @title
        @document.start_tag(HTML_TITLE)
        @document.text(@title)
        @document.end_tag(HTML_TITLE)
      end

      @document.end_tag(HTML_HEAD)
      @document.start_tag(HTML_BODY)

      if text
        raise ArgumentError if block
        @document.text(text)
      else
        @canvas.nest(&block) if block 
      end

      @document.end_tag(HTML_BODY)
      @document.end_tag(HTML_HTML)

      @document = @canvas = nil
    end

[Validate]