home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / footnote.zip / footnote.ih next >
Text File  |  1999-11-17  |  5KB  |  117 lines

  1. ;----------------------------------------------------------------------------
  2. ;     MODULE NAME:   FOOTNOTE.IH
  3. ;
  4. ;         $Author:   Dennis_Bareis  $
  5. ;       $Revision:   1.2  $
  6. ;           $Date:   02 Oct 1999 18:40:42  $
  7. ;        $Logfile:   E:/DB/PVCS.IT/OS2/PPWIZARD/NESTCHK.H_V  $
  8. ;
  9. ;     DESCRIPTION:   This is a simple header to make it easier to use
  10. ;                    footnotes in HTML a footnote is defined where required
  11. ;                    using the "FN" macro and then the macro "ExpandFootNotes"
  12. ;                    is used to list them.
  13. ;----------------------------------------------------------------------------
  14.  
  15. ;--- Make sure only included once! ------------------------------------------
  16. #ifndef     HEADER_FOOTNOTE_IH
  17.             #define  HEADER_FOOTNOTE_IH  99.321
  18.             #require 99.321
  19.  
  20.  
  21.    ;-------------------------------------------------------------------------
  22.    ;--- Footnote options, including code can override (USER OPTIONS) --------
  23.    ;-------------------------------------------------------------------------
  24.    #ifndef     FOOTNOTE_NUMBER_IN_TEXT
  25.                #define FOOTNOTE_NUMBER_IN_TEXT  <SUP><??RxFootNoteCnt></SUP>
  26.    #endif
  27.    #ifndef     FOOTNOTE_NUMBER_IN_LIST
  28.                #defineRexx FOOTNOTE_NUMBER_IN_LIST
  29.                            RxFmtFnNumb = '<SUP>' || RxIndex || '</SUP>';
  30.                #defineRexx
  31.    #endif
  32.    #ifndef     FOOTNOTE_BEFORE_EACH
  33.                #define FOOTNOTE_BEFORE_EACH <P>
  34.    #endif
  35.    #ifndef     FOOTNOTE_BEFORE_TEXT_IN_LIST
  36.                #define FOOTNOTE_BEFORE_TEXT_IN_LIST
  37.    #endif
  38.    #ifndef     FOOTNOTE_AFTER_EACH
  39.                #define FOOTNOTE_AFTER_EACH
  40.    #endif
  41.    #ifndef     FOOTNOTE_FONTSTART
  42.                #define FOOTNOTE_FONTSTART <?NewLine><FONT Size="-1">
  43.    #endif
  44.    #ifndef     FOOTNOTE_FONTEND
  45.                #define FOOTNOTE_FONTEND   <?NewLine></FONT>
  46.    #endif
  47.  
  48.  
  49.    ;--- Initialization ------------------------------------------------------
  50.    #RexxVar    RxFootNoteCnt  = 0
  51.    #RexxVar    RxFooterTxtCnt = 0
  52.  
  53.    ;--- This macro is used to hold text of each footnote --------------------
  54.  
  55.    ;--- This macro is used to hold text of each footnote --------------------
  56.    #define     FN                                                        \
  57.                #RexxVar    RxFootNoteCnt + 1                            -\
  58.                #define+     FN#_TMP  {$Text}                            -\
  59.                #evaluate   ^FN#<??RxFootNoteCnt>^ ^MacroGet('FN#_TMP')^ -\
  60.                <A NAME="FN_REF_<??RxFootNoteCnt>">                      -\
  61.                <A HREF="#FN_TXT_<??RxFootNoteCnt>"><$FOOTNOTE_NUMBER_IN_TEXT></A>
  62.  
  63.    ;--- Expands Footnotes ---------------------------------------------------
  64.    #DefineRexx RexxExpandFootNotes
  65.                if  RxFootNoteCnt = 0 then
  66.                    RxFnText = '';
  67.                else
  68.                do
  69.                    ;--- Die on error (easy restriction to remove) -----------
  70.                    if  RxFooterTxtCnt <> 0 then
  71.                        Error("Can't have more than one set of footnotes!");
  72.  
  73.                    ;--- There is at least 1 footnote ------------------------
  74.                    RxFnText = '<$FOOTNOTE_FONTSTART>';
  75.                    RxAfter  = '';
  76.                    do  RxIndex = 1 to RxFootNoteCnt
  77.                        ;--- Get previously stored Text ----------------------
  78.                        RxFnThis = MacroGet('FN#' || RxIndex);
  79.  
  80.                        ;--- Format Footnote Number --------------------------
  81.                        <$FOOTNOTE_NUMBER_IN_LIST>;
  82.  
  83.                        ;--- Output label (target for orig footnote #) -------
  84.                        RxFnText = RxFnText || '<?NewLine><A NAME="FN_TXT_'  || RxIndex || '">';
  85.  
  86.                        ;--- Output text before each FN (normally '<P>') -----
  87.                        RxFnText = RxFnText || '<$FOOTNOTE_BEFORE_EACH>';
  88.  
  89.                        ;--- Output FN# as link to original footnote number --
  90.                        RxFnText = RxFnText || '<A HREF="#FN_REF_'   || RxIndex || '">' || RxFmtFnNumb || '</A>';
  91.  
  92.                        ;--- Output possible seperator text ------------------
  93.                        RxFnText = RxFnText || '<$FOOTNOTE_BEFORE_TEXT_IN_LIST>';
  94.  
  95.                        ;--- Output the footnote text ------------------------
  96.                        RxFnText = RxFnText || RxFnThis;
  97.  
  98.                        ;--- Output stuff after text of footnote -------------
  99.                        RxFnText = RxFnText || '<$FOOTNOTE_AFTER_EACH>';
  100.                    end;
  101.                    RxFnText = RxFnText || '<$FOOTNOTE_FONTEND><?NewLine>'
  102.  
  103.                    ;--- Reset footnote counter ------------------------------
  104.                    RxFooterTxtCnt = RxFooterTxtCnt + 1;
  105.                    RxFootNoteCnt  = 0;
  106.                end;
  107.                if  RxFnText <> '' then
  108.                    call ProcessNext RxFnText
  109.    #DefineRexx
  110.    #define     ExpandFootNotes                         \
  111.                #evaluate   ^^ ^<$RexxExpandFootNotes>^
  112.  
  113.  
  114. ;--- End of Header file -----------------------------------------------------
  115. #endif
  116.  
  117.