MayaChemTools

Previous  TOC  NextTextFilesToHTML.plCode | PDF | PDFGreen | PDFA4 | PDFA4Green

NAME

TextFilesToHTML.pl - Generate HTML table file(s) from TextFile(s)

SYNOPSIS

TextFilesToHTML.pl ... TextFile(s)...

TextFilesToHTML.pl [-a, --align left | center | right,[top | middle | bottom]] [-b, --border borderwidth] [--cellpadding padding] [--cellspacing spacing] [--footer string] [-d, --displaylinks top | bottom | both] [--displaylinksinfo line | table | both] [-h, --help] [--headeralign left | center | right,[top | middle | bottom]] [--headercolor "#RRGGBB"] [--highlight "fieldlabel,datatype,criterion,value,[fieldlabel,datatype,criterion,value,]..."] [--highlightby colnum | collabel] [--highlightcolor "#RRGGBB,#RRGGBB"] [--highlightstyle text | background] [--indelim comma | semicolon] [-m, --mode plain | shade | highlight | shadedhighlight] [-n, --numrows number] [-o, --overwrite] [-r, --root rootname] [--stylesheet old | new | none] [--stylesheetname filename] [ --shadecolor "#RRGGBB,#RRGGBB"] [-t, --title string] [--titledisplay yes | no] [-w, --workingdir dirname] TextFile(s)...

DESCRIPTION

Generate HTML file(s) from TextFile(s). The HTML file(s) contain data tables and appropriate navigational links to view other tables. These files can be generated for local viewing or deployment on a web server. A variety of options are provided to control style and appearence of tables.

Multiple TextFile(s) names are separated by spaces. The valid file extensions are .csv and .tsv for comma/semicolon and tab delimited text files respectively. All other file names are ignored. All the text files in a current directory can be specified by *.csv, *.tsv, or the current directory name. The --indelim option determines the format of TextFile(s). Any file which doesn't correspond to the format indicated by --indelim option is ignored.

OPTIONS

-a, --align left | center | right,[top | middle | bottom]

Horizontal and vertical alignment for table rows except for header row which is specified using --headeralign option. Possible horizontal alignment values: left, center, or right. Possible vertical alignment values: top, middle, or bottom.

Default values: left,middle

-b, --border borderwidth

Table border width. Default value: 1 for plain and highlight mode; 0 for shade and shadedhightlight mode. Zero indicates no border.

--cellpadding padding

Table cell padding. Default value: 2.

--cellspacing spacing

Table cell spacing. Default value: 1.

--footer string

Text string to be included at bottom of each HTML file. Default: none.

-d, --displaylinks top | bottom | both

Specify where to display navigation links in each HTML file for accessing all other HTML files. Possible values: top, bottom, or both. Default value: both. This option is only valid during multiple HTML files generation for an input file.

--displaylinksinfo line | table | both

Control display of additional information along with navigational links: Showing line n of m is displyed for line and showing table n of m for table. Possible values: line | table | both. Default: both. This option is only valid during multiple HTML files generation.

-h, --help

Print this help message

--headeralign left | center | right,[top | middle | bottom]

Horizontal and vertical alignment for table header rows. Possible horizontal alignment values: left, center, or right. Possible vertical alignment values: top, middle, or bottom.

Default values: center,middle

--headercolor "#RRGGBB"

Color used to fill background of table header row containing column labels represented as a hexadecimal string. None for -m, --mode option value of plain and #ccccff, light blue, for others.

--highlight "fieldlabel,datatype,criterion,value,[fieldlabel,datatype,criterion,value,]..."

This value is mode specific. It specifies how to highlight various column values for each text file. Same set of quartets values are applied to all TextFile(s).

For highlightbycolnum mode, input text format contains these quartets: colnum,datatype,criterion,value,.... Possible datatype values: numeric or text. Possible criterion values: le, ge, or eq. Examples: "1,numeric,le,450>" or "2,numeric,ge,150,6,numeric,le,10".

For highlightbycollabel mode, input text format contains these quartets: collabel,datatype,criterion,value,....

--highlightby colnum | collabel

This value is mode specific. It indicates how columns to be highlighted are specified using --hightlight option. Possible values: colnum or collabel. Default value: colnum.

--highlightcolor "#RRGGBB,#RRGGBB"

Colors used to highlight column values during highlight and shadedhightlight mode represented as hexadecimal strings.

For --highlighstyle option values of text and background, these colors represent text or background colors respectively. For a specific column, first color string is used for values which meet criterion indicated by --highlight option; the second color is used for rest of the values.

Default values for background --highlightstyle: #0fff0f,#ff0f0f. And default values for text --highlightstyle: #0fbb0f,#ff0f0f. Hexadecimal strings for both --highlightstyle colors correspond to reddish and greenish.

--highlightstyle text | background

This value is mode specific. It indicates highlight style used to differentiate column values which pass a specified criterion from others. Possible values: text or background. Default: background.

--indelim comma | semicolon

Input delimiter for CSV TextFile(s). Possible values: comma or semicolon. Default value: comma. For TSV files, this option is ignored and tab is used as a delimiter.

-m, --mode plain | shade | highlight | shadedhighlight

Specify how to generate HTML table(s): plain tables with line borders, background of alternate rows filled with a specified color, column values hightlighted using a specified criteria, or combination of previous two styles.

Possible values: plain, shade, highlight, or shadedhighlight. Default: shade.

-n, --numrows number

Maximum number of rows per table. Default value: 100. Use 0 to put all rows into one table. For TextFile(s) with more than maximum number of specified rows, multiple HTML tables, with appropriate navigation links, are created.

-o, --overwrite

Overwrite existing files.

-r, --root rootname

New file or directory name is generated using the root: <root>.html or <root>-html. Default new file name: <InitialTextFileName>.html. Default directory name: <InitialTextFileName>-html.

For TextFile(s) with more than maximum number of rows specified per table, this directory tree is generated using <Name> where <Name> corresponds to <root> or <InitialTextFileName>:Top dir - <Name>-html; Sub dirs - html and mols. <Top dir> contains <Name>.html and <Name>.css files and <sub dir> html conatins various <Name>Lines<Start>To<End>.html files; <sub dir> mols is created as needed and contains

This option is ignored for multiple input files.

--stylesheet old | new | none

Controls usage of stylesheet for newly generated HTML file(s). Possible values: old, new, or none. Default value: new.

Stylesheet file contains various properties which control apperance of HTML pages: type, size, and color of fonts; background color; and so on.

For old value, an existing stylesheet file specified by --stylesheetname option is used for each HTML file; no new stylesheet file is created. This option is quite handy for deploying HTML file(s) on a web server: assuming you specify a valid stylesheet file location relative to your WWWRoot, a reference to this stylesheet is added to each HTML file. For local deployment of HTML file(s), a complete path to a local stylesheet is fine as well.

For create value, a new stylesheet is created and reference to this local stylesheet is added to each HTML file. Use option --stylesheetname to specify name.

For none value, stylesheet usage is completely ignored.

--stylesheetname filename

Stylesheet file name to be used in conjunction with -s --stylesheet option. It is only valid for old value of -s --stylesheet option. Specify a valid stylesheet file location relative to your WWWRoot and a reference to this stylesheet is added to each HTML file. Example: "/stylesheets/MyStyleSheet.css". Or a complete path name to a local stylesheet file.

For create value of -s --stylesheet option, a new stylesheet file is created using -r --root option. And value of --stylesheetname is simply ignored.

--shadecolor "#RRGGBB,#RRGGBB"

Colors used to fill background of rows during shade and shadedhightlight mode represented as a pair of hexadecimal string; the first and second color values are used for odd and even number rows respectively.

Default value: "#ffffff,#e0e9eb" - it's white and very light blue for odd and even number rows.

-t, --title string

Title for HTML table(s). Default value: <TextFileName>. For multiple input files, -r --root option is used to generate appropriate titles.

--titledisplay yes | no

Display title for HTML table(s). Possible values: yes or no. Default value: yes.

-w, --workingdir dirname

Location of working directory. Default: current directory.

EXAMPLES

To generate HTML tables with rows background filled with white and greyish colors and navigation links on top and botton of each page, type:

% TextFilesToHTML.pl -o Sample1.csv

To generate HTML tables with rows background filled with golden and greyish colors, navigation links on top and botton of each page, 10 rows in each table, greyish header row color, and cell spacing of 1, type:

% TextFilesToHTML.pl -o -n 10 --headeralign "center" --headercolor "#a1a1a1" --shadecolor "#ddd700,#d1d1d1" --cellspacing 1 Sample1.csv

To generate plain HTML tables with 10 rows in each table and navigation links only at the bottom, type:

% TextFilesToHTML.pl -o -n 10 --displaylinks bottom -m plain Sample1.csv

To highlight values in column 3 using specified highlight criteria and fill in default background colors, type:

% TextFilesToHTML.pl -n 10 --highlight "3,numeric,le,450" --highlightby colnum --highlightstyle background -m shadedhighlight -o Sample1.csv

To highlight values in column MolWeight using specified highlight criteria, color the text using default colors, and add a footer message in every page, type:

% TextFilesToHTML.pl -n 4 --highlight "MolWeight,numeric,le,500" --highlightby collabel --highlightstyle text -m shadedhighlight -o --footer "Copyright (C) MayaChemTools" --cellspacing 1 Sample1.csv

AUTHOR

Manish Sud

SEE ALSO

JoinTextFiles.plMergeTextFilesWithSD.plModifyTextFilesFormat.plSplitTextFiles.plSortTextFiles.pl

COPYRIGHT

Copyright (C) 2017 Manish Sud. All rights reserved.

This file is part of MayaChemTools.

MayaChemTools is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

 

 

Previous  TOC  NextJanuary 13, 2017TextFilesToHTML.pl