Flexgesteuertes Auskommentieren von rtf-Passagen

Thomas Berger ThB at gymel.com
So Nov 23 19:56:04 CET 2003


Lieber Herr Allers,

> > Ich weiß zwar nun, daß es bei rtf "destinations" gibt, verstehe aber noch
> > nicht das Wie des Umgehens damit. Welche rtf-Dokumentation benutzen Sie?
> > Diese etwas abschreckende offizielle von Microsoft? Oder gibt es eine etwas
> > zugänglichere, die wiederum über das hinausgeht, was vor ein paar Jahren mal -
> >  wenn ich mich recht erinnere - über die Allegro-Distribution in unsere Hände
> > kam?
> 
> Heute war es Version 1.5 (korrespondierend zu Word 97).
> Aktuell ist bekanntlich 1.7 (korrespondierend zu Word 2002).
> 
> Wichtig zu wissen ist, dass RTF vorwaertskompatibel ist,
> d.h. Reader muessen darauf eingestellt sein, im Text Dinge
> vorzufinden, die sie nicht verstehen.
> 
> Die Semantik von RTF kann man sich teilweise aus den
> Spezifikations-Dokumenten herauslesen, darueber hinaus
> ist mir nichts bekannt.
> 
> Das mit den "Destinations" hatte ich verkuerzt dargestellt,
> \*\allers kennzeichnet allers als (in jeder Version unbekannte)
> Destination, \allers ohne vorangestelltes \* ist einfach nur ein
> (unbekannter) Steuerbefehl.

aus Seite 3ff der aktuellen Spezifikation (RTF Syntax):

>>>
A control word is a specially formatted command that RTF uses to mark
printer
control codes and information that applications use to manage documents.
A control word cannot be longer than 32 characters. A control word takes
the following form:
\LetterSequence<Delimiter>
Note that a backslash begins each control word.

The LetterSequence is made up of lowercase alphabetic characters (a
through z).
RTF is case sensitive. Control words (also known as Keywords) may not
contain
any uppercase alphabetic characters.

[...]

A group consists of text and control words or control symbols enclosed
in braces ({ }). The opening brace ({ ) indicates the start of the group
and the closing brace ( }) indicates the end of the group. Each group
specifies the text affected by the group and the different attributes
of that text. The RTF file can also include groups for fonts, styles,
screen
color, pictures, footnotes, comments (annotations), headers and footers,
summary information, fields, and bookmarks, as well as document-,
section-,
paragraph-, and character-formatting properties. If the font, file,
style,
screen color, revision mark, and summary-information groups and
document-
formatting properties are included, they must precede the first
plain-text
character in the document. These groups form the RTF file header.  [...]

Certain control words, referred to as destinations, mark the beginning
of
a collection of related text that could appear at another position, or
destination, within the document. Destinations may also be text that is
used but should not appear within the document at all. An example of a
destination is the \footnote group, where the footnote text follows the
control word. Page breaks cannot occur in destination text.
Destination control words and their following text must be enclosed in
braces. No other control words or text may appear within the destination
group. Destinations added after the RTF Specification published in the
March 1987 Microsoft Systems Journal may be preceded by the control
symbol
\*. This control symbol identifies destinations whose related text
should be
ignored if the RTF reader does not recognize the destination. (RTF
writers
should follow the convention of using this control symbol when adding
new
destinations or groups.) Destinations whose related text should be
inserted
into the document even if the RTF reader does not recognize the
destination
should not use \*. All destinations that were not included in the March
1987 revision of the RTF Specification are shown with \* as part of the
control word.
<<<

aus Seite 6 (Conventions of an RTF reader):

>>>
If the RTF reader cannot find a particular control word or control
symbol
in the lookup table described in the preceding list, the control word or
control symbol should be ignored. If a control word or control symbol is
preceded by an opening brace ({), it is part of a group. The current
state
should be saved on the stack, but no state change should occur. When a
closing brace (}) is encountered, the current state should be retrieved
from the stack, thereby resetting the current state. If the \* control
symbol
precedes a control word, then it defines a destination group and was
itself
preceded by an opening brace ({). The RTF reader should discard all text
up
to and including the closing brace (}) that closes this group. All RTF
readers must recognize all destinations defined in the March 1987 RTF
Specification. The reader may skip past the group, but it is not allowed
to simply discard the control word. Destinations defined since March
1987
are marked with the \* control symbol.

Note All RTF readers must implement the \* control symbol so that they
can
read RTF files written by newer RTF writers.

For control words or control symbols that the RTF reader can find in the
lookup table, the possible actions are as follows.

...
<<<

d.h. \* und voranstehende geschweifte Klammer {\*\allers ...} machen 
alles folgende bis zur korrespondierenden schliessenden Klammer
definitiv
zu einer destination group, die ueberdies zu ignorieren ist.
Fehlt \*, so ist es nur eine einfache "group", \allers ist nur ein
Steuerbefehl, der keine Auswirkungen hat.

viele Gruesse
Thomas Berger




Mehr Informationen über die Mailingliste Allegro