CreateTable

Pipelines v1.9

 

.* Example by TenFiftyTwo(c).

Home

 
.* The following pipeline reads the file: TableData.txt and builds a two column HTML table
.* which it writes to the output file: Table.htm.
 
.* The input file: TableData.txt contains a list of the Pipelines Stage command HTML
.* document names and their corresponding usage descriptions separated by a (;) semi-colon.
.* The pipeline creates an entry in the table for each document name; decorating the name
.* entry with a hyperlink to the actual target document.
 
.* The pipeline is intended to demonstrate how you can specify multiple literal values that
.* are used repeatedly to build output records.
 
pipe (endchar ?)
 
     .* The following literals define the header record.
 
     literal /<table class=MsoTableContemporary border=1 cellspacing=0 cellpadding=0/
     | literal app /width="100%" style='width:100.0%;border-collapse:collapse;border:none;/
     | literal app /mso-border-alt:solid white 1.5pt;mso-padding-alt:0cm 5.4pt 0cm 5.4pt;/
     | literal app /mso-border-insideh:1.5pt solid white;mso-border-insidev:1.5pt solid white'>/
     
     | b: fanout             .* Send out a copy so that we can determine eof.
     | a: fanin 0 1 2        .* Read all of stream 0 (the header), stream 1 and them stream 2.
     | > &sysdrive:\Documents and Settings\&username\My Documents\Table.htm .* Write to output file.
     | take last
     | specs /Table created: &sysdrive:\Documents and Settings\&username\My Documents\Table.htm/ 1
     | cons
     ?
     < &installdrive:\&installpath\Examples\Input\TableData.txt .* Read the input file.
 
     .* The following specs stage builds a two column output record; the first column is a hyperlink to
     .* the target file, the second; the item description.
 
     | specs 1-* 1 ws /;/ /;/ n w1 n           .* Tag the stage name onto the end of the record.
     | xlate ws /;/ w-1 x20 & < & > & ( & ) &  .* Translate the characters; SPACE, <, >, ( and ) to '&'.
     | change /&/ //                           .* Remove the '&' characters; this enables us to use..
                                               .* ..the stage name to build the hyperlink.
 
     .* Construct table entry.
 
     | specs ~<tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;height:10.0pt;mso-height-rule: exactly'>~ 
             1
             x0a n
             ~<td width="15%" valign=top style='width:15.8%;border:solid white .5pt;~ n x0a n
             ~background:#D9D9D9;padding:0cm 5.4pt 0cm 5.4pt;height:8.0pt;height-rule:exactly'>~ n x0a n
             ~<p style='line-height:12.0pt'><span style='font-size:10.0pt;~ n x0a n
             ~font-family:Tahoma;color:blue'>~ n write
 
             .* Define the hyperlink.
 
             ~<a href="http://www.tenfiftytwo.co.uk\pipelines\documentation 1.9\stage command\
~ n ws /;/ w-1 n ~.htm">~ n x0a n
             ~<span style='text-decoration:none'>~ n w1 n ~</span></a></span><span~ n x0a n
             ~style='font-family:Tahoma;mso-bidi-font-family:Tahoma'>~ n x0a n write
 
             .* Add the item description.
 
             ~<o:p></o:p></span></b></p>~ 1 x0a n
             ~</td>~ n x0a n
             ~<td width="84%" valign=middle style='width:84.2%;border:solid white .5pt;~ n x0a n
             ~border-left:none;mso-border-left-alt:solid white .5pt;background:#D9D9D9;~ n x0a n
             ~padding:0cm 5.4pt 0cm 5.4pt'>~ n x0a n
             ~<p style='mso-line-height:7.0pt'><span style='font-size:10pt;font-family:Tahoma'>~ n 
             w-2 n
             ~</span></b></span><b~ n x0a n
             ~style='mso-bidi-font-weight:normal'><span style='font-size:10.0pt;font-family:~ n x0a n
             ~Tahoma'><o:p></o:p></span></b></p>~ n x0a n
             ~</td>~ n x0a n
             ~</tr>~ n
     | change x09 //
     | a:
     ?
     b:
     | take last              .* Use the last record as the eof indicator.
     | specs ~</table>~ 1     .* Write the table footer.
     | a:                     .* Route back to fanin.