## html.api
## COPYRIGHT (c) 1996 AT&T Research.
# Compiled by:
#
src/lib/html/html.lib#
# This file defines the abstract syntax of HTML documents. The
# AST follows the HTML 3.2 Proposed Standard.
# This api is implemented in:
#
#
src/lib/html/html-abstract-syntax.pkg#
api Html_Abstract_Syntax {
#
html_version: String; # = "3.2"
# the HTML data representations (these are all string)
Pcdata = String;
Cdata = String;
Url = String;
Pixels = Cdata;
Name = String;
Id = String;
# the different types of HTTP methods
package http_method: api {
eqtype Method;
get: Method;
put: Method;
to_string: Method -> String;
from_string: String -> Null_Or( Method );
};
# The different types of INPUT elements
package input_type: api {
eqtype Type;
text: Type;
password: Type;
checkbox: Type;
radio: Type;
submit: Type;
reset: Type;
file: Type;
hidden: Type;
image: Type;
to_string: Type -> String;
from_string: String -> Null_Or( Type );
};
# Alignment attributes for IMG, APPLET and INPUT elements
package ialign: api {
eqtype Align;
top: Align;
middle: Align;
bottom: Align;
left: Align;
right: Align;
to_string: Align -> String;
from_string: String -> Null_Or( Align );
};
package halign: api {
eqtype Align;
left: Align;
center: Align;
right: Align;
to_string: Align -> String;
from_string: String -> Null_Or( Align );
};
package cell_valign: api {
eqtype Align;
top: Align;
middle: Align;
bottom: Align;
baseline: Align;
to_string: Align -> String;
from_string: String -> Null_Or( Align );
};
package caption_align: api {
eqtype Align
; top: Align;
bottom: Align;
to_string: Align -> String;
from_string: String -> Null_Or( Align );
};
package ulstyle: api {
eqtype Style;
disc: Style;
square: Style;
circle: Style;
to_string: Style -> String;
from_string: String -> Null_Or( Style );
};
package shape: api {
eqtype Shape;
box: Shape;
circle: Shape;
poly: Shape;
default: Shape;
to_string: Shape -> String;
from_string: String -> Null_Or( Shape );
};
package text_flow_ctl: api {
eqtype Control;
left: Control;
right: Control;
all: Control;
none: Control;
to_string: Control -> String;
from_string: String -> Null_Or( Control );
};
Html = HTML {
version: Null_Or( Cdata ),
head: List( Head_Content ),
body: Body
}
also Head_Content
= HEAD_TITLE Pcdata
| HEAD_ISINDEX { prompt: Null_Or( Cdata ) }
| HEAD_BASE { href: Url }
| HEAD_META {
http_equiv: Null_Or( Name ),
name: Null_Or( Name ),
content: Cdata
}
| HEAD_LINK {
id: Null_Or( Id ),
href: Null_Or( Url ),
rel: Null_Or( Cdata ),
reverse: Null_Or( Cdata ),
title: Null_Or( Cdata )
}
# SCRIPT/STYLE elements are placeholders for the next version of HTML
| HEAD_SCRIPT Pcdata
| HEAD_STYLE Pcdata
also Body = BODY {
background: Null_Or( Url ),
bgcolor: Null_Or( Cdata ),
text: Null_Or( Cdata ),
link: Null_Or( Cdata ),
vlink: Null_Or( Cdata ),
alink: Null_Or( Cdata ),
content: Block
}
also Block
= BLOCK_LIST List( Block )
| TEXTABLOCK Text
| HN {
n: Int,
align: Null_Or( halign::Align ),
content: Text
}
# NOTE: the content of an ADDRESS element is really (text
| P)*
| ADDRESS Block
| PP {
align: Null_Or( halign::Align ),
content: Text
}
| UL {
type: Null_Or( ulstyle::Style ),
compact: Bool,
content: List( List_Item )
}
| OL {
type: Null_Or( Cdata ),
start: Null_Or( Int ),
compact: Bool,
content: List( List_Item )
}
| DIR {
compact: Bool,
content: List( List_Item )
}
| MENU {
compact: Bool,
content: List( List_Item )
}
| DL {
compact: Bool,
content: List { dt: List( Text ), dd: Block }
}
| PRE {
width: Null_Or( Int ),
content: Text
}
| DIV {
align: halign::Align,
content: Block
}
| CENTER Block
| BLOCKQUOTE Block
| FORM {
action: Null_Or( Url ),
method': http_method::Method,
enctype: Null_Or( Cdata ),
content: Block # -(FORM)
}
| ISINDEX { prompt: Null_Or( Cdata ) }
| HR {
align: Null_Or( halign::Align ),
noshade: Bool,
size: Null_Or( Pixels ),
width: Null_Or( Cdata )
}
| TABLE {
align: Null_Or( halign::Align ),
width: Null_Or( Cdata ),
border: Null_Or( Pixels ),
cellspacing: Null_Or( Pixels ),
cellpadding: Null_Or( Pixels ),
caption: Null_Or( Caption ),
content: List( Tr )
}
also List_Item = LI {
type: Null_Or( Cdata ),
value: Null_Or( Int ),
content: Block
}
# * table content *
also Caption = CAPTION {
align: Null_Or( caption_align::Align ),
content: Text
}
also Tr = TR {
align: Null_Or( halign::Align ),
valign: Null_Or( cell_valign::Align ),
content: List( Table_Cell )
}
also Table_Cell
= TH {
nowrap: Bool,
rowspan: Null_Or( Int ),
colspan: Null_Or( Int ),
align: Null_Or( halign::Align ),
valign: Null_Or( cell_valign::Align ),
width: Null_Or( Pixels ),
height: Null_Or( Pixels ),
content: Block
}
| TD {
nowrap: Bool,
rowspan: Null_Or( Int ),
colspan: Null_Or( Int ),
align: Null_Or( halign::Align ),
valign: Null_Or( cell_valign::Align ),
width: Null_Or( Pixels ),
height: Null_Or( Pixels ),
content: Block
}
# * Text *
also Text
= TEXT_LIST List( Text )
| PCDATA Pcdata
| TT Text
| IX Text
| BX Text
| UX Text
| STRIKE Text
| BIG Text
| SMALL Text
| SUB Text
| SUP Text
| EM Text
| STRONG Text
| DFN Text
| CODE Text
| SAMP Text
| KBD Text
| VAR Text
| CITE Text
| AX {
name: Null_Or( Cdata ),
href: Null_Or( Url ),
rel: Null_Or( Cdata ),
reverse: Null_Or( Cdata ),
title: Null_Or( Cdata ),
content: Text # -(A)
}
| IMG {
src: Url,
alt: Null_Or( Cdata ),
align: Null_Or( ialign::Align ),
height: Null_Or( Pixels ),
width: Null_Or( Pixels ),
border: Null_Or( Pixels ),
hspace: Null_Or( Pixels ),
vspace: Null_Or( Pixels ),
usemap: Null_Or( Url ),
ismap: Bool
}
| APPLET {
codebase: Null_Or( Url ),
code: Cdata,
name: Null_Or( Cdata ),
alt: Null_Or( Cdata ),
align: Null_Or( ialign::Align ),
height: Null_Or( Pixels ),
width: Null_Or( Pixels ),
hspace: Null_Or( Pixels ),
vspace: Null_Or( Pixels ),
content: Text
}
| PARAM {
# Applet parameter
name: Name,
value: Null_Or( Cdata )
}
| FONT {
size: Null_Or( Cdata ),
color: Null_Or( Cdata ),
content: Text
}
| BASEFONT {
size: Null_Or( Cdata ),
content: Text
}
| BR {
clear: Null_Or( text_flow_ctl::Control )
}
| MAP {
name: Null_Or( Cdata ),
content: List( Area )
}
| INPUT {
type: Null_Or( input_type::Type ),
name: Null_Or( Cdata ),
value: Null_Or( Cdata ),
checked: Bool,
size: Null_Or( Cdata ),
maxlength: Null_Or( Int ),
src: Null_Or( Url ),
align: Null_Or( ialign::Align )
}
| SELECT {
name: Cdata,
size: Null_Or( Int ),
content: List( Select_Option )
}
| TEXTAREA {
name: Cdata,
rows: Int,
cols: Int,
content: Pcdata
}
# SCRIPT elements are placeholders for the next version of HTML
| SCRIPT Pcdata
# map areas
also
Area = AREA {
shape: Null_Or( shape::Shape ),
coords: Null_Or( Cdata ),
href: Null_Or( Url ),
nohref: Bool,
alt: Cdata
}
# SELECT options
also
Select_Option = OPTION {
selected: Bool,
value: Null_Or( Cdata ),
content: Pcdata
};
}; # Api Html
## COPYRIGHT (c) 1995 AT&T Bell Laboratories.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.