home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / htmlpre.zip / htmlpre.ih
Text File  |  1999-11-18  |  8KB  |  177 lines

  1. ;----------------------------------------------------------------------------
  2. ;     MODULE NAME:   HTMLPRE.IH
  3. ;
  4. ;         $Author:   Dennis_Bareis  $
  5. ;       $Revision:   1.1  $
  6. ;           $Date:   25 Sep 1999 14:18:48  $
  7. ;        $Logfile:   E:/DB/PVCS.IT/OS2/PPWIZARD/HTMLPRE.IHV  $
  8. ;
  9. ;     DESCRIPTION:   This is a header file for handling inclusion of
  10. ;                    "examples" into HTML.
  11. ;
  12. ;                    See PPWIZARD documentation for examples of this file
  13. ;                    in use.  The sample "TryMe.IT" file also uses this
  14. ;                    header file.
  15. ;
  16. ;
  17. ;                    Macro "ExampleFile"
  18. ;                    ~~~~~~~~~~~~~~~~~~~
  19. ;
  20. ;                    This macro takes the following parameters:
  21. ;
  22. ;                         FILE
  23. ;                         ~~~~
  24. ;                         Manditory. Identifies the file to be included.
  25. ;
  26. ;                         FRAGMENT
  27. ;                         ~~~~~~~~
  28. ;                         Optional. You may wish to have a single example
  29. ;                         file hold more than one example.  The text that
  30. ;                         you supply for this parameter marks the line before
  31. ;                         as well as the line after the example.
  32. ;
  33. ;
  34. ;                         INDENT
  35. ;                         ~~~~~~
  36. ;                         Optional.  By default a 4 space indent is used,
  37. ;                         you specify the number of spaces with 0 being
  38. ;                         valid.
  39. ;
  40. ;                         STATE
  41. ;                         ~~~~~
  42. ;                         Optional.  By default no autotagging will be
  43. ;                         performed.  If you specify "REMEMBER" then the
  44. ;                         currently available autotags will be used, you
  45. ;                         may also specify which states tags should come
  46. ;                         from (see the "#AutoTagState +" command).
  47. ;
  48. ;
  49. ;                         ASIS
  50. ;                         ~~~~
  51. ;                         Optional.  By default only basic "AsIs" tagging
  52. ;                         is performed.  If for example you wished to
  53. ;                         handle international characters then you would
  54. ;                         need to specify the names of the AsIs tags to use.
  55. ;
  56. ;
  57. ;
  58. ;                    Macro "Example / eExample"
  59. ;                    ~~~~~~~~~~~~~~~~~~~~~~~~~~
  60. ;
  61. ;                    Note that your "inline" example code must not contain
  62. ;                    a reference to the macro "eExample" as this is used
  63. ;                    internally.
  64. ;
  65. ;                    This macro takes the following parameters:
  66. ;
  67. ;
  68. ;                         INDENT
  69. ;                         ~~~~~~
  70. ;                         As above.
  71. ;
  72. ;                         STATE
  73. ;                         ~~~~~
  74. ;                         As above.
  75. ;
  76. ;
  77. ;                         ASIS
  78. ;                         ~~~~
  79. ;                         As above.
  80. ;
  81. ;
  82. ;
  83. ;----------------------------------------------------------------------------
  84.  
  85.  
  86. ;--- Define the version number of this header file --------------------------
  87. #define   VERSION_HTMLPRE_IH    99.322
  88. #require  99.265
  89.  
  90.  
  91. ;----------------------------------------------------------------------------
  92. ;--- Set up defaults that user can override ---------------------------------
  93. ;----------------------------------------------------------------------------
  94. #ifndef HTMLPRE_COLOR
  95.         #define HTMLPRE_COLOR          purple
  96. #endif
  97. #ifndef HTMLPRE_STYLE_OTHER
  98.         #define HTMLPRE_STYLE_OTHER    ;font-size:80%
  99. #endif
  100.  
  101.  
  102.  
  103. ;--- Define some aliases for characters we need to be careful with ----------
  104. #RexxVar  "LT"   =x= "<"               ;;'<' Char
  105. #RexxVar  "GT"   =x= ">"               ;;'>' Char
  106. #RexxVar  "AMP"  =x= "&"              ;;'&' Char
  107. #RexxVar  "HASH" =x= "#"                  ;;'#' Char
  108.  
  109. ;--- Define look and feel of examples ---------------------------------------
  110. #define ExampleFormatted                                                                            \
  111.         <FONT COLOR=<$HTMLPRE_COLOR>>                              ;;Set up font (older browsers)  -\
  112.         <PRE STYLE="color:<$HTMLPRE_COLOR><$HTMLPRE_STYLE_OTHER>">
  113. #define eExampleFormatted                                                                           \
  114.         </PRE>                                                                                     -\
  115.         </FONT>                                                    ;;Restore Font (older browsers)
  116.  
  117. ;--- Set up AsIs Mode (minimum changes required - user can add to these) ----
  118. #AutoTagState +
  119.    ;--- Define characters that should be automatically modified -------------
  120.    #AutoTag  "<"   "<?xLT>"
  121.    #AutoTag  ">"   "<?xGT>"
  122.    #AutoTag  "&"   "<?xAMP>"
  123.    #AutoTag  "#"   "<?xHASH>"
  124.  
  125.    ;--- "PROGRAM" ASIS mode -------------------------------------------------
  126.    #AsIs  SETUP    HTMLPRE_IH
  127. #AutoTagState -
  128.  
  129. ;----------------------------------------------------------------------------
  130. ;--- ALLOW SPELL CHECKING IN EXAMPLES? --------------------------------------
  131. ;----------------------------------------------------------------------------
  132. #ifndef HTMLPRE_SPELL_CHECKING
  133.         #define HTMLPRE_SPELL_CHECKING OFF
  134. #endif
  135.  
  136.  
  137. ;----------------------------------------------------------------------------
  138. ;--- EXAMPLE FILE INCLUSION -------------------------------------------------
  139. ;----------------------------------------------------------------------------
  140. #define ExampleFile                                                        \
  141.         <$ExampleFormatted>                                               -\
  142.         #AutoTagState  +     {$STATE=''}      ;;User can set up own tags  -\
  143.         #option        PUSH AllowSpell={$SPELL="<$HTMLPRE_SPELL_CHECKING>"} ExtraIndent=^copies(' ', {$Indent='4'})^ -\
  144.         #AutoTag       ON                                                 -\
  145.         #AsIs          ON HTMLPRE_IH {$AsIs=''}                           -\
  146.         #include       "{$File}" "{$Fragment=''}"                         -\
  147.         #AsIs          OFF                                                -\
  148.         #option        POP                                                -\
  149.         #AutoTagState  -                                                  -\
  150.         <$eExampleFormatted>
  151.  
  152.  
  153.  
  154. ;----------------------------------------------------------------------------
  155. ;--- EXAMPLE (INLINE) -------------------------------------------------------
  156. ;----------------------------------------------------------------------------
  157. #define Example                             ;;Starts Example               \
  158.         <$ExampleFormatted>                                               -\
  159.         #AutoTagState  +     {$STATE=''}    ;;User can set up own tags    -\
  160.         #option        PUSH AllowSpell={$SPELL="<$HTMLPRE_SPELL_CHECKING>"} ExtraIndent=^copies(' ', {$Indent='4'})^ -\
  161.         #option        PUSH replace=OFF                                   -\
  162.         #AutoTag       '<?xLT>$eExample<?xGT>'  '<$eExample>'   #1        -\
  163.         #option        POP                  ;;Restore REPLACE mode        -\
  164.         #AutoTag       ON                                                 -\
  165.         #AsIs          ON HTMLPRE_IH {$AsIs=''}                           -\
  166.         #define        HTMLPRE_INLINE_EXAMPLE
  167. #define eExample                            ;;Ends Example                 \
  168.         #ifndef        HTMLPRE_INLINE_EXAMPLE                             -\
  169.            #error ^Incorrectly formatted inline example (can't include end of example tag)^ -\
  170.         #endif                                                            -\
  171.         #AsIs          OFF                                                -\
  172.         #option        POP                                                -\
  173.         #AutoTagState  -                                                  -\
  174.         #undef         HTMLPRE_INLINE_EXAMPLE                             -\
  175.         <$eExampleFormatted>
  176.  
  177.