core/implementation/HtmlPage.tcl


@implementation HtmlPage {
  - init {} {
      $super init
      set html [HtmlTag new: HTML]
      set head [HtmlTag new: HEAD]
      set title [HtmlTag new: TITLE]
      set style [HtmlTag new: STYLE]
      set body [HtmlTag new: BODY]
      set frameset [HtmlTag new: FRAMESET]
      $html add: $head
      $head add: $title
      $head add: $style
      $html add: $body
      $html add: $frameset
    }

  - head {} {
      return [$head value]
    }
  - title {} {
      return [$title value]
    }
  - style {} {
      return [$style value]
    }
  - body {} {
      return [$body value]
    }
  - frameset {} {
      return [$frameset value]
    }
  - html {} {
      return [$html value]
    }

  - head: aValue {
      $head value: $aValue
    }
  - title: aValue {
      $title value: $aValue
    }
  - style: aValue {
      $style value: $aValue
    }
  - body: aValue {
      $body value: $aValue
    }
  - frameset: aValue {
      $frameset value: $aValue
    }
  - html: aValue {
      $html value: $aValue
    }

  - headTag {} {
      return $head
    }

  - titleTag {} {
      return $title
    }

  - styleTag {} {
      return $style
    }

  - bodyTag {} {
      return $body
    }

  - framesetTag {} {
      return $frameset
    }

  - htmlTag {} {
      return $html
    }

  - add: anHtmlTag {
      $body add: $anHtmlTag
    }

  - tags {} {
      return [$body tags]
    }

  - fileName: aFileName {
      set fileName $aFileName
    }

  - fileName {} {
      return $fileName
    }

  - html {} {
      #- check if body of frameset is used
      if {![string length [$frameset attributes]] \
        && ![string length [$frameset value]]} {
        $html remove: $frameset
      } else {
        $html remove: $body
      }
      return [$html html]
    }

  - writeToFile: aFileName {
      set f [open $aFileName w]
      puts $f [$self html]
      close $f
    }

  - writeToFile {} {
      return [$self writeToFile: $fileName]
    }

  + newWithFileName: aFileName {
      return [[$self new] fileName: $aFileName]
    }

  - clear {} {

    }
}