create-table.rex |
Pipelines v2.1 |
.....|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....10... |
**** Top of file ****
1
2 /* The following pipeline reads the file: table.txt and builds a two column HTML table
3 which it writes to the output file: table.htm.
4
5 The input file: table.txt contains a list of the Pipelines stage functionality HTML
6 document names and their corresponding descriptions separated by a (;) semi-colon.
7 The pipeline creates an entry in the table for each document name; decorating the name
8 entry with a hyperlink to the actual target document.
9
10 The pipeline is intended to demonstrate how you can specify multiple literal values
11 that are used repeatedly to build output records. */
12
13 Address Rxpipe
14
15 'pipe (endchar ?)',
16 ,
17 /* The following literals define the header record. */,
18 ,
19 'literal /<table class=MsoTableContemporary border=1 cellspacing=0 cellpadding=0/',
20 '| lit app /width="100%" style=''width:100.0%;border-collapse:collapse;border:none;/',
21 '| lit app /mso-border-alt:solid white 1.5pt;mso-padding-alt:0cm 5.4pt 0cm 5.4pt;/',
22 '| lit app /mso-border-insideh:1.5pt solid white;mso-border-insidev:1.5pt solid white''>/',
23 ,
24 '| b: fanout', /* Send out a copy so that we can determine eof. */
25 '| a: fanin 0 1 2', /* Read all of stream 0 (the header), stream 1, then 2 */
26 '| > &sysdrive:\Documents and Settings\&username\My Documents\table.htm',
27 '| take last',
28 '| specs /Created: &sysdrive:\Documents and Settings\&username\My Documents\table.htm/ 1',
29 '| cons',
30 '?',
31 '< &installdrive:\&installpath\examples\input\table.txt', /* Read the input file. */
32 ,
33 /* The following specs stage builds a two column output record; the first column is a
34 hyperlink to the target file, the second; the item description. */,
35 ,
36 '| specs 1-* 1 ws /;/ /;/ n w1 n', /* Tag the stage name on end of record. */
37 '| xlate ws /;/ w-1 x20 & < & > & ( & ) &', /* Translate SPACE, <, >, ( and ) to '&'. */
38 '| change /&/ //', /* Remove the '&' chars; this enables us to.. */
39 , /* ..use the stage name to build hyperlink. */
40 ,
41 /* Construct table entry. */,
42 ,
43 '| specs',
44 '~<tr style=''mso-yfti-irow:0;mso-yfti-firstrow:yes;height:10.0pt;mso-height-rule: exactly''>~',
45 '1',
46 'x0a n',
47 '~<td width="15%" valign=top style=''width:15.8%;border:solid white .5pt;~ n x0a n',
48 '~background:#D9D9D9;padding:0cm 5.4pt 0cm 5.4pt;height:8.0pt;height-rule:exactly''>~ n',
49 'x0a n',
50 '~<p style=''line-height:12.0pt''><span style=''font-size:10.0pt;~ n x0a n',
51 '~font-family:Verdana;color:blue''>~ n write',
52 ,
53 /* Define the hyperlink. */,
54 ,
55 '~<a href="https://www.1052.co.uk\pipelines\2.1\stage-command\~ n',
56 'ws /;/ w-1 n ~.htm">~ n x0a n',
57 '~<span style=''text-decoration:none''>~ n w1 n ~</span></a></span><span~ n x0a n',
58 '~style=''font-family:Verdana;mso-bidi-font-family:Verdana''>~ n x0a n write',
59 ,
60 /* Add the item description. */,
61 ,
62 '~<o:p></o:p></span></b></p>~ 1 x0a n',
63 '~</td>~ n x0a n',
64 '~<td width="84%" valign=middle style=''width:84.2%;border:solid white .5pt;~ n x0a n',
65 '~border-left:none;mso-border-left-alt:solid white .5pt;background:#D9D9D9;~ n x0a n',
66 '~padding:0cm 5.4pt 0cm 5.4pt''>~ n x0a n',
67 '~<p style=''mso-line-height:7.0pt''><span style=''font-size:10pt;font-family:Verdana''>~ n',
68 'w-2 n',
69 '~</span></b></span><b~ n x0a n',
70 '~style=''mso-bidi-font-weight:normal''><span style=''font-size:10.0pt;font-family:~ n x0a n',
71 '~Verdana''><o:p></o:p></span></b></p>~ n x0a n',
72 '~</td>~ n x0a n',
73 '~</tr>~ n',
74 '| change x09 //',
75 '| a:',
76 '?',
77 'b:',
78 '| take last', /* Use the last record as the eof indicator. */
79 '| specs ~</table>~ 1', /* Write the table footer. */
80 '| a:' /* Route back to fanin. */
81
82 Say 'Hit Enter to close..'
83 Parse Pull
84
85 Exit 0
**** End of file ****
|