plain.modes: Base modes for (x)html

The module plain.modes in the directory http://gloss.bham.ac.uk/mv/html/ of the gloss distribution and web pages contains the base code for (x)html pages.

1 The code

!declare-prefix @prefix[html] @uri[http://gloss.bham.ac.uk/mv/html/plain] {
!declare-prefix @prefix[xml] @uri[http://gloss.bham.ac.uk/mv/xml/xml] {
!init-parameter @name[xml:decl] @value[include]
!init-parameter @name[xml:version] @value[1.0]
!init-parameter @name[xml:encoding] @value[UTF-8]
!init-parameter @name[xml:bom] @value[include]
!init-parameter @name[html:public] @value[-//W3C//DTD XHTML 1.1//EN]
!init-parameter @name[html:system] @value[http$://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd]
!init-parameter @name[html:int-dtd] @value[]
!mode @name[html:doctype] @accept[] @type[process] @use-indentation[false]
  !hook @mode[xml:doctype] @action[process]
  !default
    !doctype 
      !if @test[$\{html:public\}] !attribute @name[public] !text [$\{html:public\}]
      !if @test[$\{html:system\}] !attribute @name[system] !text [$\{html:system\}]
      !if @test[$\{html:int-dtd\}] !literal [$\{html:int-dtd\}]
    !return

Put output elements in default namespace in the XHTML namespace.

!init-parameter @name[html:html-namespace] @value[http$://www.w3.org/1999/xhtml]
!init-parameter @name[\{http://gloss.bham.ac.uk/mv/xmlnamespaces\}] @value[$\{html:html-namespace\}]
!mode @name[html:root] @template[xml:root] @type[process]
  !hook @mode[xml:root] @action[process]
  html 
    !element @name[html]
      !process-tokens @mode[xml:attribute-list]
      !text 

      !process-tokens @mode[html:html-content]
    !text 

    !return
  !elt !error[html expected]
  !include @mode[xml:root] @hook[process]
!mode @name[html:html-content] @accept[elt|pi|!LITERAL|!|\{|\}|\[|\]] @children[2] @type[process]
  !punc @data[\{] @children-adjust[1]
    !execute @mode[xml:brace-group]
      !set-parameter @name[xml:inner-structured-content] @value[html:html-content]
  !punc @data[\}] !abort
  head
    !element @name[head]
      !process-tokens @mode[html:head-content]
        !set-parameter @name[xml:inner-structured-content] @value[html:head-content]
    !text 

  body 
    !element @name[body]
      !process-tokens @mode[html:body-content]
        !set-parameter @name[xml:inner-structured-content] @value[html:body-content]
    !text 

  !elt !error['head' or 'body' expected]
  !include @mode[xml:structured-content]
!mode @name[html:head-content] @type[process]
  @accept[elt|attr|pi|cref|eref|!CDATA|!LITERAL|!|\{|\}|\[|\]]
  !punc @data[\{]
    !execute @mode[xml:brace-group]
      !set-parameter @name[xml:inner-structured-content] @value[html:head-content]
  !punc @data[\}] !abort
  !include @mode[xml:structured-content]
!mode @name[html:body-content] @type[process]
  @accept[elt|attr|pi|cref|eref|!CDATA|!LITERAL|!|\{|\}|\[|\]]
  !punc @data[\[]
    !execute @mode[xml:text]
      !set-parameter @name[xml:inner-structured-content] @value[html:body-content]
  !punc @data[\]] !abort
  !punc @data[\{]
    !execute @mode[xml:brace-group]
      !set-parameter @name[xml:inner-structured-content] @value[html:body-content]
  !punc @data[\}] !abort
  !include @mode[xml:structured-content]
}; declare-prefix
}; declare-prefix

This file is part of the GLOSS system, Copyright Richard Kaye http://gloss.bham.ac.uk/. Usage permitted under the GPL. No Warranty.

This page is copyright. Web page design and creation by GLOSS.