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

Outline collapser-expander programs



Manuel asked for this pair of programs to expand and contract an outline.
The programs presume that the outline levels are defined via tab characters, as in the following, which may cut and pasted into a file and used for testing (assuming the tab characters come through, rather than being expanded into spaces--if not, a judicious search-and-replace will fix that).

I. Top level (I)..........
	A. Second level (A)................
		1. Third level (1)..............
		2. Third level (2)...........
		3. Third level (3)..............
			a) Fourth level (a)..............
			b) Fourth level (b)..............
		4. Third level (4).............
	B. Second level (B).............
	C. Second level (C)..............
	D. Second level (D)..........
II. Top level (II)........................
	A. Second Level (II-A).............
		1. Third level (II-A-1).................
		2. Third level (II-A-2)........................
The programs will work either on a DeFined block or--if no block has been DeFined--on the whole file that is onscreen.
These two programs should be DECODED and then assigned to separate keys.
E.g., for use with ctrl-1 and ctrl-2, the key assignments are:

2=bx,r,u,n, ,c,o,l,l,4,.,p,g,m,q2
3=bx,r,u,n, ,e,x,p,4,.,p,g,m,q2

Better: integrate them into U2, and still assign them to keys via, for example:
{{5&C}} and {{5&X}}, putting &C and &X onto ctrl-1 and ctrl-2 (or whatever) in your .kbd file. (If that's not the right way to do it using U2, someone will correct me.)
I must add that I'm not good at testing programs, so these are to be
considered beta versions, or even alpha versions.
A final disclaimer: I make an assumption that SEarching your file will not
find any string beginning "≪N" (without quotes, and the two angle brackets
stand for the left guillemet) EXCEPT for the "notes" markers: ≪NT....≫
that are used to hide tabs in doing the collapse. Well, actually, there
seems to be no problem with having ≪NB≫ (for non-breaking text), but it
could run afoul of something or other beginning ≪N

COLL4.PGM -- Outline collapser for use in Xy4 only
XPLeNCODE v2.0
b-gin [UNTITLED]
[BX_]es 1[Q2_]{<}SX01,{<}VA$DE{>}{>}[BX_]se {<}NT[Q2_]{<}IF{
<}ER{>}{>}[TF_]{<}NT{>}[BX_]ci /[wC]/[wC]{<}NT{>}/[Q2_]{<}EI{
>};*;[cr|lf][WG_][NM_]{<}IF{<}PV01{>}==0{>}{<}SV02,{>}[TF_]{<
}GL,A{>}{<}EI{>};*;[cr|lf]{<}SV02,/s{>}{<}LB,A{>}[BX_]es 1[Q2
_][BX_]ci{<}PV02{>} /{<}N[wW]{>}{tab}/{<}N[wW]{tab}{>}/[Q2_]{
<}IF{<}ER{>}{>}{<}PRFully collapsed{>}{<}EI{>};*;[cr|lf]{<}EX
{>}[cr|lf]
-nd
XPLeNCODE

XPLeNCODE v2.0
b-gin [UNTITLED]
[BX_]es 1[Q2_]{<}SX01,{<}VA$DE{>}{>}[BX_]se {<}NT[Q2_]{<}IF{
<}ER{>}{>}[TF_]{<}NT{>}[BX_]ci /[wC]/[wC]{<}NT{>}/[Q2_]{<}EI{
>};*;[cr|lf][WG_][NM_]{<}IF{<}PV01{>}==0{>}{<}SV02,{>}[TF_]{<
}GL,A{>}{<}EI{>};*;[cr|lf]{<}SV02,/s{>}{<}LB,A{>}[BX_]es 1[Q2
_][BX_]ci{<}PV02{>} /{<}N[wW]{>}{tab}/{<}N[wW]{tab}{>}/[Q2_]{
<}IF{<}ER{>}{>}{<}PRFully collapsed{>}{<}EI{>};*;[cr|lf]{<}EX
{>}[cr|lf]
-nd
XPLeNCODE


Harry Binswanger
hb@xxxxxxxx