template-token ( document obj -- document )


Vocabulary
html5

Inputs
documentan object
objan object


Outputs
documentan object


Definition


:: template-token ( document obj -- document )
obj tag? [
obj name>> {
"base"
"basefont"
"bgsound"
"link"
"meta"
"noframes"
"script"
"style"
"title"
} member?
[ document obj insert-element document ] [
obj name>> {
{ "caption" [ in-table-mode ] }
{ "colgroup" [ in-table-mode ] }
{ "tbody" [ in-table-mode ] }
{ "tfoot" [ in-table-mode ] }
{ "thead" [ in-table-mode ] }
{ "col" [ in-column-group-mode ] }
{ "tr" [ in-table-body-mode ] }
{ "td" [ in-row-mode ] }
{ "th" [ in-row-mode ] }
[ drop in-body-mode ]
} case
:> mode document template-insertion-modes>> pop drop
mode document template-insertion-modes>> push
document mode >>insertion-mode obj body-token
] if
] [
obj end-tag? [
obj name>>
{ "script" "style" "title" "noframes" } member?
[ document obj close-element ] [
"unexpected-end-tag-in-template"
report-parse-error
] if document
] [ document obj ordinary-body-token ] if
] if ;