iptxt2tab
iptxt2tab
This program is used to convert plain text tables to NITF/HTML - where possible
!
If the input switch '-Z' is on, the FipHdr of the incoming file may have a 'DY'
which is the parameter file to use. If that does not exist, or that file does
not exist
in tables/setup then the default is used.
The default parameter file is TXT2TAB (Winnt = Txt2Tab.fip) in tables/setup.
Keywords for Txt2TAB parameter file are :
; comment line
chr:(octal/dec/hex number):(FipSeq string)
Replace this character with the string - usually an Sgml escaped chr.
This can be a printable chr or an escaped number. The number is
octal/dec/hex depending on the preceding 'number' keyword (if any).
eg chr:\313:£ chr:<:<
Note that the ';' is part of the string and NOT a comment as it does NOT
start the line.
extra-fiphdr (FipSeq) Extra information to be added to the FipHdr of the
output file.default: none
outque Output queue for the new file (overrides the -o input switch)
default:spool/2db
donque Done queue for the raw input file (overrides the -d input switch)
default: none
script: script to run against the New file. default: none
newname: name of output file default: same as input
file-before: name of a template file to add BEFORE any data - such as an HTML
top.default: none
file-after: name of a template file to add AFTER any data - such as an HTML
end. default: none
log-line: Custom log string for the Item Log entry default:\SU \SN
no-fiphdr: do NOT add a FipHdr to the output file. default: do
always-start-on-para: Always start the file with a <P> tag default: do NOT
data-format: reuters/afx/ap/dpa/afp source format default: reuters
use-pi:yes/no
Use the PI for TableColumnWidths (ie use FipHdr FE and NOT FD)
'no' for use FD and ignore FE; default is no
paragraph-indent: normal paragraph indent default: 4 spaces
minimum-river: number of spaces between cells default: 2
cell-gap: Used for PI and CharWidth default: 2
table-border: usually 2 - 1 at start of line default: 2
min-rogue-lines: no of data lines before we will accept a rogue/colspan.
default: 4
preserve-tab-spacing:no/yes default: no
NO=zap all leading and trailing spaces inside a tab cell
YES=leave all spaces
Parameters for changing the markup :
para-start default "<p>"
para-end default "\n</p>"
standAloneEnd-BR default "<br/>"
standAloneEnd-P default "<p></p>"
ul-start default "<ul>"
ul-end default "</ul>"
ol-start default "<ol>"
ol-end default "</ol>"
li-start default "<li>"
li-end default "</li>"
table-start default "<table\\VC style=\"CharWidth:\\FC\"\\$o>\\VE<?FingerPost
IDNtableColWidth=\"\\FE\"?>\\$o"
table-end default "</table>"
row-start default "<tr>"
row-end default "</tr>"
tab-start default "<td align=\"\\FA\"\\VB colspan=\"\\FB\"\\$o\\VD
style=\"CharWidth:\\FD\"\\$o>"
tab-end default "</td>"
FipHdr fields used internally are :
FA cell alignment for TD or TH - left, right, center
FB number of columns spanned for this TD (default is 1)
FC width of this table (in chrs)
FD width of this cell (in chrs) - the cell being TD or TH
FE width of all cells (in chrs)
plus VA to VE are options for the 5 above
Where sections of FipHdr fields are required or changes to the output style,
use keywords : fixed, partial, combie, optional, repeat, newdate and/or style.
(see The SysAdmin manual for more information).
They are normally specified :
fixed:QZ 1234543
partial:QT ST,3,2,U,<,>
combie:QY ep|na,(0000000)a
option:QE ep,11,7,s
repeat:QK XK,-,3
or repeat:QP PK,,4,#X
style:QS XN,%.03d
Example of a Parameter file
;
; 'Txt2Tab' - default
;
; add the following fields for first ipxchg then ipedsys
; xchg - CQ - send to lookup next
; xchg - CX - use param file NTM2NewsML.fip
; edsys - EQ - stuff in 2tibrv after
; edsys - DF - use param file NEWSML-Text.fip
extra-fiphdr:#CQ:2lookup#EQ:2tibrv#CX:convert2NewsML.fip#DF:NewsML-Text.FIP
; always map these chrs pls
chr:<:<
chr:>:>
chr:&:&
chr:\000
chr:\177
; but not these - yes pls
chr:':'
chr:":"
; NONONO need a <P> and </P> at end...
;;;always-start-on-para:yes
; for colspan - only output if there is an FB
option:VB FB
; default is 3
;;;normal-para:4
; default is unlimited/
;;;line-length-max:64
; End
Input Parameters are (all optional) :
Either
-1 : path/filename for single shot default: spooled
The input file is NOT deleted
If this does NOT start with a '/', it is assumed relative to the current
path.
Or
-i : input queue default: spool/txt2tab
If this does NOT start with a '/', it is assumed under spool.
-d : optional done folder for the input files default: none
-l : do NOT log files in default: log
-o : output queue default: spool/2go
If this does NOT start with a '/', it is assumed under spool.
-P : add raw data as a PRE afterwards default: no
add add NL to every start tag to help viewing
-w : file wait for files arriving across a network. def: 8 secs
-z : default parameter file in tables/setup
default: tables/setup/TXT2TAB (or TXT2TAB.fip for NT)
-Z : allow FipHdr field DY to override the parameter file name
default: use ONLY the default.
-v : print version number and exit
---NOTES---
Version Control
;02d2 08nov04 RTRS (( is an Xref and 002 ->the Xref NL
;c 05feb05 allow rows of dashes to be part of the table
;d12 minor
;01z 30apr03 cleanups
;b use <p></p> not <p/>
;c blank lines endtable plus colhdr bugette
;d added -d doneque
;e 12jun03 minors as per rtrs build 65
;f-r 18jun03 minors as per rtrs NNG build
;s-t 27sep03 look after <FipTextType-TW:X>
;u 03nov03 timings
;v 08nov03 v3.0 pre
;w-y 03apr04 v3.7 exceptions/lists
;z 20sep04 speedy
;00z 20nov01 original version
;t for Lists
;u for stripping spaces after <p>
;v startpara can be 4 +/- 2 spaces Uppercase or quotes
;w redo spcs
;x check for ALL UPPERCASE lines at start of para = CrossHead
;y 05apr03 bugette - not zapping extra fiphdr used for tabs.
;z 07apr03 zapped all extra NL from data
(copyright) 2025 and previous years FingerPost Ltd.