##
##  wml::std::page - Standard HTML Page Header and Footer
##  Copyright (c) 1997-2001 Ralf S. Engelschall, All Rights Reserved. 
##

#  The <preserve>/<restore> tags with multiple arguments require WML 2.0.3
#use wml::mod::version
<require 2.0.3 />

#use wml::std::info

#
#   the page counter for multiple pages
#
<set-var __std_page_cnt=0 />

#
#   the new PAGE tag
#
<define-tag page>
<preserve title indent info background color bgcolor text link alink vlink
          onload slices />
<set-var info=* />
<set-var slices=* />
<set-var %attributes />
<increment __std_page_cnt />
<ifeq "<get-var slices />" "" "[WML_STDPAGE_HEAD:" /><html*>
<head*>
<ifeq "<get-var info />" "" <info style=meta /> />\
<if "<get-var title />" "<title*><get-var title /></title*>
" />\
{#WML_PAGE_HEAD_<get-var __std_page_cnt />#}\
</head*>
<body*<if <get-var background /> " background=\"<get-var background />\"" "" />\
      <when <not <get-var color /> />>\
      <if <get-var bgcolor /> <group <ifeq "<get-var bgcolor />" "none" "" " bgcolor=\"<get-var bgcolor />\"" /> /> " bgcolor=\"#ffffff\"" />\
      <if <get-var text /> " text=\"<get-var text />\"" " text=\"#000000\"" />\
      <if <get-var link /> " link=\"<get-var link />\"" " link=\"#333399\"" />\
      <if <get-var alink /> " alink=\"<get-var alink />\"" " alink=\"#9999ff\"" />\
      <if <get-var vlink /> " vlink=\"<get-var vlink />\"" " vlink=\"#000066\"" />\
      </when>\
      <if <get-var onload /> " onload=\"<get-var onload />\"" "" />\
>
<set-var __i=0 />
<while <lt <get-var __i /> <get-var indent /> />>
<blockquote*>
<increment __i />
</while><ifeq "<get-var slices />" "" ":WML_STDPAGE_HEAD]" />\
<ifeq "<get-var slices />" "" "[WML_STDPAGE_BODY:" />{#WML_PAGE_BODY_<get-var __std_page_cnt />#}<ifeq "<get-var slices />" "" ":WML_STDPAGE_BODY]" />\
<ifeq "<get-var slices />" "" "[WML_STDPAGE_FOOT:" />\
<set-var __i=0 />
<while <lt <get-var __i /> <get-var indent /> />>
</blockquote*>
<increment __i />
</while>
</body*>
</html*><ifeq "<get-var slices />" "" ":WML_STDPAGE_FOOT]" />
{#WML_PAGE_BODY_<get-var __std_page_cnt />#:\
<restore  title indent info background color bgcolor text link alink vlink
          onload slices />
</define-tag>

#   end page
<define-tag page_end>
:#WML_PAGE_BODY_<get-var __std_page_cnt />#}
</define-tag>

#   divert HEAD tag body to header
<define-tag head endtag=required>
{#WML_PAGE_HEAD_<get-var __std_page_cnt />#:
%body
:##}
</define-tag>

#   divert TITLE tag to header
<define-tag title endtag=required>
{#WML_PAGE_HEAD_<get-var __std_page_cnt />#:
<title*>%body</title*>
:#WML_PAGE_HEAD_<get-var __std_page_cnt />#}
</define-tag>

##EOF##
