hyperref.modes: Hyper-references for (x)html

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

1 Synopsis

It may not be immediately obvious why any addition module is required when the HTML a tag is already available. If the a tag suits your needs, then do use it. However, there are a number of different kinds of hyper-reference and at times (for example when converting the file to a different format such as LaTeX) it is important to distinguish between these in a standard way. Hence this module.

This module also provides a small number of extra features which you might find useful, including copying snippets of text (e.g., a theorem number).

Typically these tags are all used in text mode, inside p [...] for example.

1.1 xref

...[xref[URI][content]]...

defines a cross reference to this document or to a location in this group of documents.

1.2 href

...[href[URI][content]]...

defines a hyperreference to an external document.

1.3 cite

...[cite[URI][content]]...

defines a cross reference to a document or item in a document in this group of documents where a bibliographic reference or a book or text or other academic reference is given.

1.4 uri

...[uri[URI]]...

defines a hyperreference to an external document where the URI and the content are the same. (This saves quite a lot of typing!)

1.5 copy

...[copy[URI]]...

requests that a portion of text or html be copied from a position in this document or one of these documents to the present location. The text URI may be an id of some node in this document, or the URI of an external document, possibly with an "#ID" part. The contents of the referenced node, and not the node itself is copied. It is only intended that small snippets of text be copied in this way. The XSL that implements this function copies everthing in a rather naive way and validation or other problems may occur.

; p [This feature is still under development.]

2 The code

!declare-prefix @prefix[xref] @uri[http://gloss.bham.ac.uk/mv/html/hyperref] {
!declare-prefix @prefix[xml] @uri[http://gloss.bham.ac.uk/mv/xml/xml] {
!declare-prefix @prefix[html] @uri[http://gloss.bham.ac.uk/mv/html/plain] {
!mode @name[xref:body-content] @type[process]
  @accept[elt|attr|pi|cref|eref|uri|!CDATA|!LITERAL|!|\{|\}|\[|\]]
  !hook @mode[html:body-content] @action[process]
  !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
  glossurl !text[http$://gloss.bham.ac.uk]
  !elt @fullname[$href||xref]
    !process-tokens @mode[xml:process-attr]
      !set-parameter @name[xml:attr-param] @value[xref:uri]
    !element @name[a] 
      !attribute @name[class] [$q]
      !attribute @name[href] [$\{xref:uri\}]
      !process-tokens @mode[html:body-content]
  cite
    !text  
    !process-tokens @mode[xml:process-attr]
      !set-parameter @name[xml:attr-param] @value[xref:uri]
    !element @name[a] 
      !attribute @name[class] [cite]
      !attribute @name[href] [$\{xref:uri\}]
      !text [\[$\{xref:uri\}\]]
  uri
    !process-tokens @mode[xml:process-attr]
      !set-parameter @name[xml:attr-param] @value[xref:uri]
    !element @name[a] 
      !attribute @name[class] [uri]
      !attribute @name[href] [$\{xref:uri\}]
      !text [$\{xref:uri\}]
  !uri
    !element @name[a] 
      !attribute @name[class] [uri]
      !attribute @name[href] [$v]
      !text [$v]

copy inserts an element that XSL can transform to a copy of another element (typically a HTML span element) with an id. Used for saying "See Theorem 5.4" where the number is not known and may vary. Don't know if this can work on external pages or just the current one.

  copy
    !element @name[span]
      !attribute @name[class] [copy]
      !process-tokens @mode[xml:process-text] ; contents is an href or #id to something that should be copied
  !include @mode[html:body-content] @hook[process]

That's all the modes.

}; declare-prefix xml
}; declare-prefix html
}; declare-prefix xref

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.