contentsconceptssyntaxlibrariessampleserrorsindex
Full text search
Up translations: a simple example  
Related Concepts  

Introduction

This example of an up-translate program converts RTF (Rich Text Format) into SGML.

The program does the following:

In practice, preamble material (style sheets) will need to be skipped over, and other styles and paragraph commands (such as "\par") will need to be recognized.



Sample

  up-translate

  find "\s23" lookahead ! digit
     output "<p>"

  find "\" letter [letter | digit | "-"]* | ; RTF command
       "\" any |                            ; other RTF code
       ["{}"]                               ; RTF grouping
     ; output nothing for these.

  find "\" ["{}\"] => protected-character
     output protected-character ; some characters are protected by \

  find "\'" any {2} => hex-code ; some characters are in hexadecimal
     local counter character-value
     set character-value to hex-code base 16
     output "&#%d(character-value);"

  find "<"
     output "<<!>" ; "<" often needs protecting in the SGML

  find "&"
     output "&<!>" ; likewise "&"

Related Concepts  
   Up-translation: translating documents into XML/SGML
 
----  

Top [CONTENTS] [CONCEPTS] [SYNTAX] [LIBRARIES] [SAMPLES] [ERRORS] [INDEX]

Generated: April 21, 1999 at 2:01:46 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © OmniMark Technologies Corporation, 1988-1999.