[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Hard footnote numbers; stripping out formatting



As so often in XPL, my methods for Phil Ferreira's two tasks are more
tedious to describe than to write. Only my deep aversion to encoding/
decoding keeps me from sending the following as an XPL attachment.
    For purposes of this e-mail, I use SINGLE angle-brackets < and > in
place of the "guillemets" that enclose embedded commands in an actual Xy
file; [L] or [W] for a wild-card letter or string in a command-line or XPL
expression; *BC* (etc.) for "bold"-looking function calls in a program
file.

I. HARD-NUMBERING FOOTNOTES

My program for this is pretty kludgy, and I look forward to seeing others'
more graceful methods; but this works for me --

(1) create a second (empty) file called NOTES.TMP

(2) in the book (or chapter) file, in expanded display, do a global change
from >
    *DF**CR**DF* (i.e. define the triangle) *BC*append
NOTES.TMP*XC*
    *RD* (i.e. RuboutDefine)

(4) step (3) left s where the footnotes were in the text file. So with
all the notes themselves now hived off to NOTES.TMP, go through the TEXT
file converting s to sequential hard numbers (as part of the same step
these hard numbers can be superscripted, or a defined Style can be added to
each).
    If Phil doesn't have a subroutine for converting s to hard
numbers, I or others can supply one.

(5) in NOTES.TMP, repeat step (2) and then step (4)

II. STRIPPING OUT FORMATTING COMMANDS

Print-to-screen inserts hard returns at line-ends within paragraphs, which
makes it unacceptable for most purposes -- including Phil F's plan of
sending his files for typesetting. My method is (again) probably less
elegant than some others', but it works for me.

Note: I avoid mode commands that take the / format, in
favor of  and . (As I recall, Xy3 used only the
four-letter formula; the -- vastly more flexible -- plus/minus formula was
one of the great gains of Xy4?) But because a 4-letter mode command can
creep in occasionally (my wife sometimes uses them), I run a macro that
seeks out such commands and converts them:

(1) globally change  -- if any -- temporarily to {MDNM} (i.e., get
rid of guillemets for "MDNM" only); then go to top of file

(2) search for ; if found, change to ; highlight the
last two letters [L][L] and save them as an on-the-fly SaveGet; from this
point, search for the *next* {MDNM}, delete the two letters "NM" before the
} and insert a minus sign plus the SaveGet in their place

(3) from that point, repeat step (2)

(4) when step (3) returns a "Not Found" error message, go to the top of the
file, globally change {MD-[L][L]} to 

Thus any phrase that was underlined by ... is now underlined as
... and similarly for other mode commands.

Now, assured that there are no 4-letter mode commands, I do the following
to strip out all formatting features *except* modes:

(1) temporarily change  to {MD[S][L][L]} -- i.e. make its
guillemets into something else, so that a search for <...> will pass by
these mode-command strings

(2) superficially, it now seems as if all non-mode formatting features can
be eliminated by a global change in expanded display --
    *BC*cia /<[W]>//*XC*
-- i.e. "change" any string-between-chevrons to nothing-at-all.
    But this won't work with (e.g.) running headers or "SetStyle"
commands (to name only two) if they include sub-sets of chevrons. So my
method is to go to NON-expanded display and search for an opening guillemet
ONLY (again, this works in Xy4, though in Xy3 it returns a Not Found
message); when the opening guillemet is found, the cursor will be on a
triangle, and a character-delete at that point will remove the whole
triangle. In my XPL program this is a subroutine that loops back on itself,
i.e.
    *BC*se />
    *RC*
    

(3) change {MD[S][L][L]} back to  (this is quicker in expanded
display, I believe)


Cheers
Eric Van Tassel