home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ppwi2284.zip / htmlpre.ih < prev    next >
Text File  |  2001-01-01  |  9KB  |  186 lines

  1. ;----------------------------------------------------------------------------
  2. ;     MODULE NAME:   HTMLPRE.IH
  3. ;
  4. ;         $Author:   Dennis  $
  5. ;       $Revision:   1.1  $
  6. ;           $Date:   21 Nov 2000 18:21:38  $
  7. ;        $Logfile:   C:/DBAREIS/Projects.PVCS/PpwAddOn/HtmlPRE/htmlpre.ih.pvcs  $
  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 is terminated by
  62. ;                    a "eExample" macro where the "Example" part is in the
  63. ;                    EXACT case that you used. This allows the example code
  64. ;                    itself to contain the string "eExample" as long as it
  65. ;                    is in a different case.
  66. ;
  67. ;                    This macro takes the following parameters:
  68. ;
  69. ;
  70. ;                         INDENT
  71. ;                         ~~~~~~
  72. ;                         As above.
  73. ;
  74. ;                         STATE
  75. ;                         ~~~~~
  76. ;                         As above.
  77. ;
  78. ;
  79. ;                         ASIS
  80. ;                         ~~~~
  81. ;                         As above.
  82. ;
  83. ;
  84. ;
  85. ;----------------------------------------------------------------------------
  86.  
  87.  
  88. ;--- Define the version number of this header file --------------------------
  89. #define   VERSION_HTMLPRE_IH    01.002
  90. #require  01.002
  91.  
  92.  
  93. ;--- Define some aliases for characters we need to be careful with ----------
  94. #RexxVar  "LT"   =x= "<"               ;;'<' Char
  95. #RexxVar  "GT"   =x= ">"               ;;'>' Char
  96. #RexxVar  "AMP"  =x= "&"              ;;'&' Char
  97. #RexxVar  "HASH" =x= "#"                  ;;'#' Char
  98.  
  99.  
  100. ;--- Did user already define the way examples are tagged (start & end)? -----
  101. #ifndef ExampleFormatted
  102.    ;--- Define look and feel of examples ------------------------------------
  103.    #ifndef HTMLPRE_JUST_PRE_TAGS
  104.            ;--- Set up defaults that user can override ----------------------
  105.            #define? HTMLPRE_COLOR          purple
  106.            #define? HTMLPRE_STYLE_OTHER    ;font-size:80%
  107.  
  108.            ;--- Set up the tags ---------------------------------------------
  109.            #define ExampleFormatted                                               \
  110.                    <FONT COLOR=<$HTMLPRE_COLOR>> ;;Set up font (older browsers)  -\
  111.                    <PRE STYLE="color:<$HTMLPRE_COLOR><$HTMLPRE_STYLE_OTHER>">
  112.            #define eExampleFormatted                                              \
  113.                    </PRE>                                                        -\
  114.                    </FONT>                       ;;Restore Font (older browsers)
  115.    #elseif
  116.        ;--- Either want default "PRE" look or will define via stylesheet ----
  117.        #define ExampleFormatted                                           \
  118.                <pre>                             ;;Start Example
  119.        #define eExampleFormatted                                          \
  120.                </pre>                            ;;End of Example
  121.    #endif
  122. #endif
  123.  
  124.  
  125. ;--- Set up AsIs Mode (minimum changes required - user can add to these) ----
  126. #AutoTagState +
  127.    ;--- Define characters that should be automatically modified -------------
  128.    #AutoTag  "<"   "<?xLT>"
  129.    #AutoTag  ">"   "<?xGT>"
  130.    #AutoTag  "&"   "<?xAMP>"
  131.    #AutoTag  "#"   "<?xHASH>"
  132.  
  133.    ;--- "PROGRAM" ASIS mode -------------------------------------------------
  134.    #AsIs  SETUP    HTMLPRE_IH
  135. #AutoTagState -
  136.  
  137.  
  138. ;----------------------------------------------------------------------------
  139. ;--- ALLOW SPELL CHECKING IN EXAMPLES? --------------------------------------
  140. ;----------------------------------------------------------------------------
  141. #ifndef HTMLPRE_SPELL_CHECKING
  142.         #define HTMLPRE_SPELL_CHECKING OFF
  143. #endif
  144.  
  145.  
  146. ;----------------------------------------------------------------------------
  147. ;--- EXAMPLE FILE INCLUSION -------------------------------------------------
  148. ;----------------------------------------------------------------------------
  149. #define ExampleFile                                                        \
  150.         <$ExampleFormatted>                                               -\
  151.         #AutoTagState  +     {$STATE=''}      ;;User can set up own tags  -\
  152.         #option        PUSH AllowSpell={$SPELL="<$HTMLPRE_SPELL_CHECKING>"} ExtraIndent=^copies(' ', {$Indent='4'})^ -\
  153.         #AutoTag       ON                                                 -\
  154.         #AsIs          ON HTMLPRE_IH {$AsIs=''}                           -\
  155.         #include       "{$File}" "{$Fragment=''}"                         -\
  156.         #AsIs          OFF                                                -\
  157.         #option        POP                                                -\
  158.         #AutoTagState  -                                                  -\
  159.         <$eExampleFormatted>
  160.  
  161.  
  162.  
  163. ;----------------------------------------------------------------------------
  164. ;--- EXAMPLE (INLINE) -------------------------------------------------------
  165. ;----------------------------------------------------------------------------
  166. #define Example                             ;;Starts Example               \
  167.         <$ExampleFormatted>                                               -\
  168.         #AutoTagState  +     {$STATE=''}    ;;User can set up own tags    -\
  169.         #option        PUSH AllowSpell={$SPELL="<$HTMLPRE_SPELL_CHECKING>"} ExtraIndent=^copies(' ', {$Indent='4'})^ -\
  170.         #option        PUSH replace=OFF                                   -\
  171.         #AutoTag       '<?xLT>$e{$?MacName}<?xGT>'  '<$e{$?MacName}>'  #1 -\
  172.         #option        POP                  ;;Restore REPLACE mode        -\
  173.         #AutoTag       ON                                                 -\
  174.         #AsIs          ON HTMLPRE_IH {$AsIs=''}                           -\
  175.         #define        HTMLPRE_INLINE_EXAMPLE
  176. #define eExample                            ;;Ends Example                 \
  177.         #ifndef        HTMLPRE_INLINE_EXAMPLE                             -\
  178.            #error ^Incorrectly formatted inline example (can't include end of example tag)^ -\
  179.         #endif                                                            -\
  180.         #AsIs          OFF                                                -\
  181.         #option        POP                                                -\
  182.         #AutoTagState  -                                                  -\
  183.         #undef         HTMLPRE_INLINE_EXAMPLE                             -\
  184.         <$eExampleFormatted>
  185.  
  186.