home *** CD-ROM | disk | FTP | other *** search
/ The First Hungarian Family / The_First_Hungarian_Family_CD-ROM.bin / internet / offlread / ddig6 / ddigest.doc < prev    next >
Text File  |  1995-06-04  |  16KB  |  397 lines

  1. DDigest (version 0.05)
  2.  
  3.  
  4.  
  5.    Copyright (c) 1994 Robert P. Rush
  6.  
  7.       Permission to copy and distribute this material for any
  8.       purpose and without fee is hereby granted, provided that
  9.       the above copyright  notice and this permission notice
  10.       appear in all copies.  THE AUTHOR  MAKES NO
  11.       REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY OF
  12.       THIS  MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS,"
  13.       WITHOUT ANY  EXPRESS OR IMPLIED WARRANTIES.  THE AUTHOR
  14.       WILL ASSUME NO LIABILITY  FOR DAMAGES EITHER FROM THE
  15.       DIRECT USE OF THIS PRODUCT OR AS A CONSEQUENCE OF THE
  16.       USE OF THIS PRODUCT.
  17.  
  18.  
  19.  
  20.    DDigest (De-Digest) is a program designed to extract
  21.    individual articles from a digest format mailing list.  It
  22.    will then place these articles into a rnews packet to be
  23.    imported into an off-line news reader.  DDigest will find
  24.    these digests in either a mail packet (in soup format), or a
  25.    Yarn folder.
  26.  
  27.  
  28. Requirements:
  29.  
  30.    MSDOS or other compatible operating system.
  31.  
  32.  
  33.  
  34. Installation:
  35.  
  36.    Copy ddigest.exe to a directory contained in the path.
  37.  
  38.    Edit a configuration file for each mailing list.
  39.  
  40.  
  41. Configuration files:
  42.    This contains settings telling DDigest how to find and process
  43.    a digest.  Comments may be placed in the configuration file by
  44.    placing a "#" into the first column.
  45.  
  46.    Ddigest uses regular expressions in searching for the
  47.    `FindDigest', `FirstAricleBreak', and `ArticleBreak' strings.
  48.    See the section on regular expressions for additional
  49.    information.
  50.  
  51.   Finding a digest:
  52.    DDigest will look in the "FindHeader" of each mail message for
  53.    the "FindDigest" search string.  If found, the mail message
  54.    will be processed as a digest.  Otherwise, DDigest will
  55.    continue looking in the next message.  For example, if the
  56.    configuration file contains the settings:
  57.  
  58.      FindHeader=Sender:
  59.      FindDigest=yarn-list
  60.  
  61.    Any mail message containing the string "yarn-list" in the
  62.    "Sender:" header will be considered a digest.
  63.  
  64.   Finding Articles in a digest:
  65.    Once a digest has been found, DDigest will look in the message
  66.    body for the beginning of the first article using the
  67.    "FirstArticleBreak" setting. The end of each article and the
  68.    beginning  of the next article is found with the
  69.    "ArticleBreak" setting.  The extracted article will contain
  70.    everything from the end of one article break to the beginning
  71.    of the next article break.  The  article breaks are not
  72.    included in any articles.
  73.  
  74.    For example, the digestifier places an introduction followed
  75.    by a line containing seventy-six dashes at the beginning of
  76.    the digest.  Each article in the digest is separated by three
  77.    lines, the first one being blank, the second line containing
  78.    thirty dashes, and the third line blank.  The configuration
  79.    file should contain the settings:
  80.  
  81.      FirstArticleBreak=^-{60,100}$
  82.      ArticleBreak=^$-{30}$$
  83.  
  84.    This will find a line containing between sixty and one hundred
  85.    dashes, and nothing but dashes, and use it as the break
  86.    between the introduction and the first article.  It will also
  87.    use any group of three lines where the first and third lines
  88.    in the group are blank and the middle line contains exactly
  89.    thirty dashes as a break between articles.
  90.  
  91.   Placing extracted articles into a newsgroup:
  92.    If necessary, create the newsgroup in the off-line reader.
  93.    Yarn will also allow you to set up a posting address so that
  94.    posted articles will automatically be posted to the list and
  95.    not to a phantom newsgroup.
  96.  
  97.    DDigest will add a "Newsgroup:" line to each extracted article
  98.    using the "NewsGroup" setting in the configuration file.  For
  99.    example, if the configuration file contains the setting:
  100.  
  101.        NewsGroup=Yarn-List
  102.  
  103.    All extracted articles will be placed into the newsgroup
  104.    "Yarn-List".
  105.  
  106.  
  107. Regular Expressions:
  108.    Using a regular expression in place of a simple search string
  109.    will allow searching for a string that will change from one
  110.    digest to the next.  For example, you want to look for the
  111.    line:
  112.  
  113.        This is digest #123 in a series on weather
  114.  
  115.    The following regular expression will compare the entire line
  116.    including the digest number:
  117.  
  118.          This is digest #[[:digit:]]+ in a series on weather
  119.  
  120.    The `[[:digit:]]+' part of the expression will match any
  121.    sequence of one or more digits.  It is composed of an operator
  122.    `[[:digit:]]', and a modifier `+'.  The operator will match
  123.    one digit.  The modifier tells DDigest to apply the operator
  124.    one or more times.  A modifier may follow an operator,
  125.    ordinary character, or parenthesized expression to match
  126.    multiple occurrences of what the operator, character, or
  127.    parenthesized expression would match.
  128.  
  129.    An anchor indicates that the character preceding or following
  130.    it should start or end a word or line.
  131.  
  132.  
  133.      To Find                   Operator Examples
  134.      =================         =====    =============
  135.      Any single character.     .        "f.t" finds "fat,"
  136.                                         "fet," and "fit."
  137.  
  138.      One of the specified      []       "f[ae]t" finds "fat"
  139.      characters.                        and "fet," but not
  140.                                         "fit."
  141.  
  142.      Any single character      [^]      "f[^ae]t" finds "fit,"
  143.      except one of the                  but not "fat" and
  144.      specified characters.              "fet."
  145.  
  146.      Any word constituent      \w       "f\wt" finds "fit,"
  147.      character. (A word                 "fat," and "f_t" but
  148.      constituent character is           not "f t" or "f,t."
  149.      a letter, number or
  150.      underline.)
  151.  
  152.      Any non word constituent  \W       "f\Wt" finds "f t" or
  153.      character.                         "f,t" but not "fit,"
  154.                                         "fat," and "f_t."
  155.  
  156.      Any character that would  \        "f\+t" finds "f+t" but
  157.      otherwise be an operator,          not "fft," while "f+t"
  158.      modifier, or anchor.               finds "fft" but not
  159.      (These are "^.[$()|*+?{\")         "f+t."
  160.  
  161.      A line separator.         $        "f$t" finds text where
  162.                                         "f" is the last letter
  163.                                         on one line and "t" is
  164.                                         the first letter on
  165.                                         the next line.
  166.  
  167.    Any operator or character could be followed by a modifier to
  168.    match multiple occurrences of a character or expression.
  169.  
  170.  
  171.      To Find                   modifier Examples
  172.      =================         =====    =============
  173.      Zero or more occurrences  *        "f.*t" finds "ft,"
  174.      of the previous character          "fat," "fabt," and "f
  175.      or expression.                     a whole lot more text
  176.                                         t."
  177.  
  178.      One or more occurrences   +        "f.+t" finds "fat,"
  179.      of the previous character          "fabt," and "f a whole
  180.      or expression.                     lot more text t," but
  181.                                         not "ft."
  182.  
  183.      Zero or one occurrence    ?        "f.*t" finds "ft" and
  184.      of the previous character          "fat," but not "fabt"
  185.      or expression.                     or "f a whole lot more
  186.                                         text t."
  187.  
  188.      Exactly <n> occurrences   {n}      "fa{3}t" finds "faaat"
  189.      of the previous character          but not "faat" or
  190.      or expression.                     "faaaat."
  191.  
  192.      At least <n> occurrences  {n,}     "fa{3,}t" finds
  193.      of the previous character          "faaat" and "faaaat"
  194.      or expression.                     but not "fat."
  195.  
  196.      Between zero and <n>      {,n}     "fa{,3}t" finds "ft,"
  197.      occurrences of the                 and "faaat" but not
  198.      previous character or              "faaaat."
  199.      expression.
  200.  
  201.      Between <n1> and <n2>     {n1,n2}  "fa{2,3}t" finds
  202.      occurrences of the                 "faat" and "faaat" but
  203.      previous character or              not "fat" or "faaaat."
  204.      expression.
  205.  
  206.  
  207.  
  208.      To indicate that a        Anchor   Examples
  209.      character or expression
  210.      must:
  211.      =================         =====    =============
  212.      start a line.             ^        "^hi" will match "hi"
  213.      (This must occur at the            only if it is at the
  214.      beginning of an                    beginning of a line.
  215.      expression.)
  216.  
  217.      end a line.               $        "hi$" will match "hi"
  218.                                         only if it is at the
  219.                                         end of a line.
  220.  
  221.      start a word.             \<       "\<hi" will match "hi"
  222.                                         and "hit," but not
  223.                                         "phi."
  224.  
  225.      end a word.               \>       "hi\>" will match "hi"
  226.                                         and "phi" but not
  227.                                         "hit."
  228.  
  229.  
  230.    Brackets may be used to match a range or class of characters.
  231.    A list of characters enclosed by `[' and `]' matches any
  232.    single character in that list; if the first character of the
  233.    list is the caret `^' then it matches any character not in the
  234.    list.  For example, the regular expression _[0123456789]_
  235.    matches any single digit.  A range of ASCII characters may be
  236.    specified by giving the first and last characters, separated
  237.    by a hyphen.  Finally, certain named classes of characters are
  238.    predefined.  Their names are self explanatory, and they are
  239.    `[:alnum:]`, `[:alpha:]`, `[:cntrl:]`, `[:digit:]`,
  240.    `[:graph:]`, `[:lower:]`, `[:print:]`, `[:punct:]`,
  241.    `[:space:]`, `[:upper:]`, `[:word:]`, `[:xdigit:]'.   For
  242.    example, _[[:alnum:]]_ means _[0-9A-Za-z]_ except the latter
  243.    form is dependent upon the ASCII character encoding, whereas
  244.    the former is portable, _[[:word:]]_ is equivalent to _\w_,
  245.    _[[:digit:][:alpha:]_]_ or _[0-9A-Za-z_]_.  (Note that the
  246.    brackets in these class names are part of the symbolic names,
  247.    and must be included in addition to the brackets delimiting
  248.    the bracket list.) Most metacharacters lose their special
  249.    meaning inside lists. To include a literal `]' place it first
  250.    in the list.  Similarly, to include a literal `^' place it
  251.    anywhere but first.  Finally, to include a literal `-' place
  252.    it last.
  253.  
  254.    A "^" should be used to match a line separator at the
  255.    beginning of an expression.  Otherwise, a "$" should be used
  256.    to match a line separator.  Only the "^" and "$" operators
  257.    will match a line separator.
  258.  
  259.    Two adjacent (concatenated) regular expressions match a match
  260.    of the first followed by a match of the second.
  261.  
  262.    Two regular expressions separated by | match either a match
  263.    for the first or a match for the second.
  264.  
  265.    A regular expression enclosed in parentheses matches a match
  266.    for the regular expression.
  267.  
  268.    A regular expression enclosed in parentheses followed by a
  269.    modifier will match an integer multiple of the enclosed
  270.    expression.  I.e.  "(abc)*" will match "abcabc," or
  271.    "abcabcabc" but will only match the first 6 characters of
  272.    "abcabcab."
  273.  
  274.    The order of precedence of operators at the same parenthesis
  275.    level is "[]" then "*+?{}" then concatenation then "|".
  276.  
  277.    An expression will match the longest string it can.
  278.  
  279.    Multiple line matches are limited to five lines.
  280.  
  281.    The reported start and end of a match may be specified by
  282.    embedding a `\s` or `\e` in the regular expression.  This will
  283.    allow using part of the next article in the search pattern.
  284.    I.e.  The search pattern _^$-{30}$$\eFROM:_, will match an
  285.    article break composed of: a blank line, followed by a line
  286.    containing 30 dashes, followed by a blank line, followed by a
  287.    line starting with _FROM:_.  Everything following the `\e`
  288.    will be included in the following message.
  289.  
  290.    Regular expressions used by DDigest are the same as those used
  291.    by Yarn with the following exceptions:
  292.  
  293.     1) A "\" may only be followed by one of the following
  294.        "^.[$()|*+?{\", or "sewW".  The sequence "\w" will match
  295.        any word constituent character, not a "w".  A "\" followed
  296.        by any other character is illegal.
  297.  
  298.     2) A "$" may also be used to match a newline in the middle of
  299.        a string.
  300.  
  301.     3) The "{}" operator may be used in place of "*+?".
  302.  
  303.  
  304. The command line is:
  305.  
  306.      DDigest <config file> <Email file> <rnews file>
  307.  
  308.    or
  309.  
  310.      DDigest <config file> <Yarn folder> <rnews file> -Y
  311.  
  312.    or
  313.  
  314.      DDigest <config file> <Text file> <rnews file> -T
  315.  
  316.  
  317.    Where:
  318.  
  319.       <config file>
  320.         This file contains the search patterns used to find the
  321.         digest and to separate it into individual articles.
  322.  
  323.       <Email file>
  324.         This file will be found in the soup packet imported into
  325.         the off-line news reader.
  326.  
  327.       <rnews file>
  328.         This file will be generated by DDigest.  It could then be
  329.         imported into the off-line news reader as an rnews file.
  330.  
  331.       <Yarn Folder>
  332.         A file contained in Yarns (USER)\mail directory.
  333.  
  334.       <Text file>
  335.         A file contained a single digest in text format.
  336.  
  337.    If the <Email file>, <Yarn Folder>, or <Text Folder> name is
  338.    replaced with a `-`, the input will be taken from the standard
  339.    input.  If the <rnews file> is replaced with a `-`, the output
  340.    will be sent to the standard output.  This will allow the input
  341.    to be piped from another program and the output to be piped to
  342.    another program.
  343.  
  344.  
  345. To De-Digestify a mailing list digest:
  346.  
  347.      1) Unzip the soup packet containing Email into an empty
  348.         directory.
  349.      2) Decide which file contains Email.  This is probably named
  350.         "0000000.MSG" if you are using UQWK to create your SOUP
  351.         packets.  If this does not work, you could find out which
  352.         one it by looking at the AREAS file.  Each line contains
  353.         three fields separated by tabs.  The first field is the
  354.         file name (Without the ".MSG" extension). The second field
  355.         is the file type.  Look for the line containing "Email" in
  356.         the second field.  On my system, the line is "0000000
  357.         Email   bn".  Therefore the file name is "0000000.MSG".
  358.  
  359.      3) Execute the command (substituting your filenames):
  360.  
  361.             DDigest list.CFG 0000000.MSG list.MSG
  362.  
  363.      4) Import the resultant file:
  364.  
  365.             import -r list.MSG
  366.  
  367.  
  368. Notes:
  369.  
  370.      *  Each article extracted from the digest will have unique
  371.         Message-Id based on the Message-id of the digest.
  372.         Therefore, if a digest is imported twice, the articles
  373.         will be recognized as duplicates.
  374.  
  375.      *  The program will also insert the following headers into
  376.         each extracted article based on the digest headers:
  377.  
  378.               X-Digest-Subject: <Digest subject>
  379.               X-Digest-Date: <Digest Date>
  380.  
  381.      *  The 'X-Digest-Subject:', 'X-Digest-Date:', 'Message-Id:',
  382.         and 'Newsgroups:' lines are added to the beginning of each
  383.         extracted article.
  384.  
  385.      *  The closing will be output as an extra article without a
  386.         subject.
  387.  
  388.      *  The search strings must be contained on one line, but may
  389.         be any length up to 255 characters long.
  390.  
  391.      *  A temporary file is created if either the '-T' option is
  392.         used or if the input is piped into ddigest.
  393.  
  394. Bob Rush
  395. bobr@mcs.com
  396.  
  397.