rfc3285.txt

来自「RFC 的详细文档!」· 文本 代码 · 共 1,068 行 · 第 1/3 页

TXT
1,068
字号
               TOC1: RFC text +, Automatically update, Clear all tabs,
                  Add tab Rt. Flush, 504pt, ... leader
               TOC2: RFC text + Indent: Left 43.2pt,
                  Automatically update, Clear all tabs,
                  Add tab Rt. Flush, 504pt, ... leader
               TOC3: RFC text + Indent: Left 64.8pt,
                  Automatically update, Clear all tabs,
                  Add tab Rt. Flush, 504pt, ... leader

3.2 Positioning the document identifiers on the first page

   The 'Table' tool can be used to assist with justification of the
   document identifiers on the first page.  Each cell in the table
   maintains its own justification characteristics, so getting left and
   right justification on the same line is simplified.  On the Toolbar
   select the icon that looks like a grid with a dark bar across the
   top.  This will pop-up a table array.  Drag the mouse across to
   select the number of rows and columns (for the opening header 4 rows
   x 2 columns, unless there are several authors).  Select the table
   that was just inserted by click-and-hold in the left margin, and then
   clear the boarders.

      Format
         Borders and Shading
            None

   Select the cells on the right (position the cursor just above the top
   cell, when the cursor becomes an arrow pointing down, click) and set
   justification right.  (The default is to take justification from the
   line it is being positioned on, so the left column shouldn't need
   changing.)






Gahrns & Hain                Informational                      [Page 7]

RFC 3285         Using MS Word to create I-Ds and RFCs          May 2002


      Format
         Paragraph
            Right

   If necessary, move the center divider to the right for the document
   title.  Select the left column of cells, then position the cursor
   over the dividing line.  When it changes to parallel bars with
   right/left arrows, click-and-hold, then drag the line as necessary.

3.3 Automatic date

   For those who frequently update drafts, and find they occasionally
   forget to update the current save and expire dates, there is a way to
   automate those fields.  While it is rather complex to set up the
   expire-month field, it only needs to be done once in a template file,
   and all future drafts benefit.

   To automatically set the current date on save, select the lower right
   cell in the table created above, and insert the save date.

      Insert
         Field
            Date and Time
               SaveDate
               In the box below the sample "field codes",
                  modify as necessary to make it look like:
                  - SAVEDATE \@ "MMMM YYYY" - (between the -'s).
               OK

   The field will have a gray background on the screen, but will not
   affect the printed version.  Double click on the field, copy, and
   then replace the Month, Year in the header (10 in Layout Styles
   above) with a paste.

   Setting up the expire-date is similar, but requires inserting nested
   fields.  Select the location for the month then insert an IF field.

      Insert
         Field
            MailMerge
               IF
               OK

   This will result in an error.  Right click on the error message, and
   select Toggle Field Codes.  This will allow further editing.  Select
   the space after the initial IF, then insert another field: SaveDate
   (as above but this time only the month digit is used "M").  Right
   click on the number it inserts and Toggle Field Codes again.  Follow



Gahrns & Hain                Informational                      [Page 8]

RFC 3285         Using MS Word to create I-Ds and RFCs          May 2002


   the right brace } with =, then the month to test, followed by the
   month name 6 months later.  At this point loop and insert another IF,
   until all 12 are done.  Follow the last one with a "" to complete the
   syntax.  The resulting expanded field code will look like:

   { IF { SAVEDATE  \@ "M" \* MERGEFORMAT } = 1 July { IF { SAVEDATE  \@
   "M" \* MERGEFORMAT } = 2 August { IF { SAVEDATE  \@ "M" \*
   MERGEFORMAT } = 3 September { IF { SAVEDATE  \@ "M" \* MERGEFORMAT} =
   4 October { IF { SAVEDATE  \@ "M" \* MERGEFORMAT } = 5 November { IF
   { SAVEDATE  \@ "M" \* MERGEFORMAT } = 6 December { IF { SAVEDATE  \@
   "M" \* MERGEFORMAT } = 7 January { IF { SAVEDATE  \@ "M" \*
   MERGEFORMAT } = 8 February { IF { SAVEDATE  \@ "M" \* MERGEFORMAT } =
   9 March { IF { SAVEDATE  \@ "M" \* MERGEFORMAT } = 10 April { IF {
   SAVEDATE  \@ "M" \* MERGEFORMAT } = 11 May { IF { SAVEDATE  \@ "M" \*
   MERGEFORMAT } = 12 June "" \* MERGEFORMAT } \* MERGEFORMAT } \*
   MERGEFORMAT } \* MERGEFORMAT } \* MERGEFORMAT } \* MERGEFORMAT } \*
   MERGEFORMAT } \* MERGEFORMAT } \* MERGEFORMAT } \* MERGEFORMAT } \*
   MERGEFORMAT } \* MERGEFORMAT }

   Space over and set the expire-year with a field in a similar manner.
   This time there are only 2 IF fields, comparing halves of the year.
   The printed value on true will be the SaveDate year value and the
   expanded result will look like:

   { IF { SAVEDATE \@ "M" \* MERGEFORMAT } < 7 { SAVEDATE \@ "YYYY" \*
   MERGEFORMAT } { IF { SAVEDATE \@ "M" \* MERGEFORMAT } > 6 { = {
   SAVEDATE \@ "YYYY" \* MERGEFORMAT } + 1 \*MERGEFORMAT } "" \*
   MERGEFORMAT }

   Revert the field codes to normal text by right click, Toggle Field
   Codes or Update Field.  Select both of these fields by clicking on
   one, then shift click on the other.  Copy, then paste in the footer
   (9 & 10 in Layout Styles above), replacing the Month, Year.

3.4 Automatic reference numbering

   To support automatic updates of reference numbers, make the following
   changes.  (Requires the document to be a single section prior to the
   Reference heading.)

   1) Insert a section break on the line after Reference heading.

      Insert
         Break
            Section Break
               Continuous





Gahrns & Hain                Informational                      [Page 9]

RFC 3285         Using MS Word to create I-Ds and RFCs          May 2002


   2) Format the style of the Endnote References and Text.

      Format
         Style
            Endnote reference
            Modify
               Based on 'underlying paragraph'
               Format Font
               clear the check box for 'superscript'
            Endnote text
            Modify
               Based on 'RFC text'
               Format Paragraph
               Indentation
                  Left    21.6
               Special
                  Hanging 21.6

   3) Set up the location of the references, and number style.

      Insert
         Footnote
            Endnote
            Autonumber
            Options
               Place at 'End of section'
               Numeric style '1,2,3'

   4) Select the location for the first reference.  Between the user
   typed [ ] characters, insert an endnote.

      Insert
         Footnote (endnote will already be selected,
             as will auto 1,2,3)
         OK

   When the endnote is inserted, the lower pane will appear.  Type in
   the text describing the reference.  The first time a reference is
   inserted, the Endnote Separator should be cleared (the continuation
   separator may need it as well).  Find the pull down, just above the
   reference text, and change it to each of the options to make sure all
   but the 'All Endnotes' are cleared.

      Endnote Separator
         Select and delete any text






Gahrns & Hain                Informational                     [Page 10]

RFC 3285         Using MS Word to create I-Ds and RFCs          May 2002


   The reference number in the text and the endnote table will
   automatically track as changes are made.  If the endnote window is
   closed and changes need to be made, select:

      View
         Footnotes

   To automatically add updated cross-references for previous footnotes,
   select the location of the cross-reference.  Between the user typed
   [ ] characters insert a cross-reference.

      Insert
         Cross-reference
            Select reference type 'endnote'
            Clear the checkbox for 'Insert as hyperlink'
            Select the reference from the endnote list
            Insert

4. Final fixup: the CRLF program

   Each line needs to be terminated by a CRLF, but when printing your
   document to the Generic Text Printer driver, some blank lines will be
   terminated only with a line feed.  Consider a traditional text line
   printer, printing a line of text, followed by 3 blank lines.  The
   output would look as follows:

   Line of Text<CR><LF><LF><LF>.

   This was done because there was no need to move the print carriage
   head for the blank lines, only line feeds were necessary.

   The following example provides the source for a CRLF fixup program.

   /***************************************************************
    * CRLF.C - Sample source code to format documents produced by
    * the MS Word IETF template so that they comply to IETF draft
    * and RFC guidelines
    * Change CR/FF ; FF/CR/LF ; FF/LF ; CR/FF/CR/LF  into CR/LF/FF
    ***************************************************************/

      #include <stdio.h>
      #include <io.h>
      #include <fcntl.h>
      #include <sys/types.h>
      #include <sys/stat.h>
      #include <memory.h>
      #include <string.h>
      #include <stdlib.h>



Gahrns & Hain                Informational                     [Page 11]

RFC 3285         Using MS Word to create I-Ds and RFCs          May 2002



      #define CR 13
      #define LF 10
      #define FF 12
      #define TRUE 1
      #define FALSE 0

      typedef int BOOL;

      int main(int argc, char *argv[])
      {
           int fSrc, fDest;
           int iNumBytesRead;
           int iNumLines;
           char cr = CR;
           char lf = LF;
           char ff = FF;
           unsigned char buff[3];
           BOOL bPrecedingCR = FALSE;
           BOOL bPrecedingLF = FALSE;
           BOOL bPrecedingFF = FALSE;

           if(argc != 3)
           {
                   printf("Usage:\n\n");
                   printf("    crlf <srcfile> <dstfile>\n\n");
                   return 0;
           }

      fSrc = open(argv[1], O_RDONLY | O_BINARY);
      fDest = open(argv[2], O_CREAT | O_RDWR | O_BINARY |
         O_TRUNC, S_IREAD | S_IWRITE);

      if(fSrc == -1)
      {
         printf("Could not open file (%s) for reading.\n",
                  argv[1]);
               printf( strerror(errno));
                   return 0;
           }

           if(fDest == -1)
           {
                   printf("Count not open file (%s) for writing.\n",
                  argv[2]);
               printf( strerror(errno));
                   return 0;
           }



Gahrns & Hain                Informational                     [Page 12]

RFC 3285         Using MS Word to create I-Ds and RFCs          May 2002



           // Using the MS Word with the generic text printer, an
           // extra CR LF starts the file.  Skip over these first 2
           // bytes,
           iNumBytesRead = _read(fSrc, buff, 2);

         bPrecedingCR = FALSE;
         bPrecedingLF = TRUE;
         bPrecedingFF = FALSE;
         iNumLines = 0;

           // Prepare to parse through the file
           iNumBytesRead = _read(fSrc, buff, 1);
           while(iNumBytesRead > 0)
           {
            if (buff[0] == FF)
            {
               // Found FF
               if (bPrecedingCR == TRUE)
               {
                  // Some drivers write CR/FF w/o LF
                  // Insert LF between
                  _write(fDest, &lf, 1);
                  _write(fDest, &(buff[0]), 1);
               }
               else if (bPrecedingLF == TRUE)
               {
                  // If driver writes LF/FF, assume preceding CR
               }
               else if (bPrecedingFF == TRUE)
               {
                  // If we just set FF from line count, ignore this
                  // one
               }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?