lammps/txt2htmlb0ffa46a3bb9lammps-icms
lammps/txt2html
b0ffa46a3bb9lammps-icms
README.txt
README.txt
txt2html - a text to HTML conversion tool :h3
[txt2html] is a simple tool for converting text files into HTML files.
Text files can contain simple formatting and mark-up commands that
[txt2html] converts into HTML.
[txt2html] was written by "Steve Plimpton"_sjp. I use it for
"documentation"_doc and "WWW pages"_www. Anna Reese added the table
formatting options.
See the "example.txt"_example.txt and "example.html"_example.html
files in the [txt2html] directory for examples of what all the
formatting commands and mark-up syntax end up looking like in HTML.
:link(sjp,http://www.cs.sandia.gov/~sjplimp)
:link(www,http://www.cs.sandia.gov/~sjplimp)
:link(doc,http://www.cs.sandia.gov/~sjplimp/lammps.html)
:line
[Syntax:]
txt2html file
read from text file, write HTML to standard output
txt2html file1 file2 file3 ...
read each argument as text file, write one HTML file per argument :dl
Input files are first opened with the specified name. If that fails,
a ".txt" suffix is added. Output files are created with an ".html"
suffix, which is either added or replaces the ".txt" suffix.
:line
[Compiling:]
The source for [txt2html] is a single C++ file. Compile it by typing:
g++ -o txt2html txt2html.cpp :pre
:line
[How the tool works:]
[txt2html] reads a text file, one {paragraph} at a time. A paragraph
ends with:
a blank line
a line whose final word starts with ":" (a format string)
the end of the file :ul
Any line in the paragraph which ends with "\" is concatenated to the
following line by removing the "\" character and following newline.
This can be useful for some of the formatting commands described below
that operate on individual lines in the paragraph.
If a paragraph starts with a "<" character and ends with a ">"
character, it is treated as raw HTML and is written directly into the
output file.
If a paragraph does not end with a format string, then it is
surrounded with HTML paragraph markers (<P> and </P>),
"mark-up"_#markup is performed, and the paragraph is written to the
output file.
If the paragraph ends with a format string, then "formatting"_#format
is performed, "mark-up"_#markup is performed, and the paragraph is
written to the output file.
:line
[Formatting:] :link(format)
A format string is the last word of a paragraph if it starts with a
":" character. A format string contains one or more comma-separated
commands, like ":ulb,l" or ":c,h3". Note that a format string cannot
contain spaces, else it would not be the last word. An individual
command can have 0 or more arguments:
{b} or {line()} = 0 arguments
{image(file)} = 1 argument
{link(alias,value)} = 2 or more comma-separated arguments :ul
Format commands add HTML markers at the beginning or end of the
paragraph and individual lines. Commands are processed in the order
they appear in the format string. Thus if two commands add HTML
markers to the beginning of the paragraph, the 2nd command's marker
will appear 2nd. The reverse is true at the end of the paragraph; the
2nd command's marker will appear 1st. Some comands, like {line} or
{image} make most sense if used as stand-alone commands without an
accompanying paragraph.
Commands that format the entire paragraph:
p --> surround the paragraph with <P> </P>
b --> put <BR> at the end of the paragraph
pre --> surround the paragraph with <PRE> </PRE>
c --> surround the paragraph with <CENTER> </CENTER>
h1,h2,h3,h4,h5,h6 --> surround the paragraph with \
<H1> </H1>, etc :ul
Commands that format the lines of the paragraph as a list:
ul --> surround the paragraph with <UL> </UL>, \
put <LI> at start of every line
ol --> surround the paragraph with <OL> </OL>, \
put <LI> at start of every line
dl --> surround the paragraph with <DL> </DL>, \
alternate <DT> and <DD> at start of every line :ul
Commands that treat the paragraph as one entry in a list:
l --> put <LI> at the beginning of the paragraph
dt --> put <DT> at the beginning of the paragraph
dd --> put <DD> at the beginning of the paragraph
ulb --> put <UL> at the beginning of the paragraph
ule --> put </UL> at the end of the paragraph
olb --> put <OL> at the beginning of the paragraph
ole --> put </OL> at the end of the paragraph
dlb --> put <DL> at the beginning of the paragraph
dle --> put </DL> at the end of the paragraph :ul
Commands applied to each line of the paragraph:
all(p) --> surround each line with <P> </P>
all(c) --> surround each line with <CENTER> </CENTER>
all(b) --> append a <BR> to each line
all(l) --> prepend a <LI> to each line :ul
Special commands (all HTML is inserted at beginning of paragraph):
line --> insert a horizontal line = <HR>
image(file) --> insert an image = <IMG SRC = "file">
image(file,link) --> insert an image that when clicked on goes to link
link(name) --> insert a named link that can be referred to \
elsewhere (see "mark-up"_#markup) = <A NAME = "name"></A>
link(alias,value) --> define a link alias that can be used \
elsewhere in this file (see "mark-up"_#markup) :ul
Table command:
tb(c=3,b=5,w=100%,a=c) --> format the paragraph as a table :ul
Arguments within tb() can appear in any order and are all optional,
since they each have default values.
c=N --> Make an N-column table. Treat the paragraph as one
long list of entries (separated by the separator character) and put
them into N columns one after the other. If N = 0, treat each line
of the paragraph as one row of the table with as many columns as
there are maximum entries in any line. Default is c=0. :ulb,l
s=: --> Use the character string following the equal sign as
the separator between entries. Default separator is a comma "," which
you cannot specify directly since the comma delimits the tb() arguments :l
b=N --> Create a border N pixels wide. If N is 0, there is no
border between or outside the cells. If N is 1, there is a minimal
border between and outside all cells. For N > 1, the border between
cells does not change but the outside border gets wider. Default is
b=1. :l
w=N or w=N% --> The first form makes each cell of the table at
least N pixels wide. The second form makes the entire table take up
N% of the width of the browser window. Default is w=0 which means
each cell will be just as wide as the text it contains. :l
a=X --> Align the entire table at the left, center, or right of the
browser window, for X = "l", "c", or "r". Default is a=c. :l
ea=X --> Align the text in each entry at the left, center, or
right of its cell, for X = "l", "c", or "r". Default is browser's
default (typically left). :l
eva=X --> Vertically align the text in each entry at the
top, middle, baseline, or bottom of its cell, for X = "t", "m", "ba",
or "bo". Default is browser's default (typically middle). :l
cwM=N or cwM=N% --> The first form makes column M be at least
N pixels wide. The second form makes column M take up N% of the
width of the browser window. This setting overrides the "w"
argument for column M. Only one column per table can be tweaked
with this argument. Default is no settings for any column. :l
caM=X --> Align the text in each entry of column M at the left,
center, or right of its cell, for X = "l", "c", or "r". This
setting overrides the "ea" argument for column M. Only one column
per table can be tweaked with this argument. Default is no settings
for any column. :l
cvaM=X --> Vertically align the text in each entry of column m
at the top, middle, baseline, or bottom of its cell, for X = "t",
"m", "ba", or "bo". This setting overrides the "eva" argument for
column M. Only one column per table can be tweaked with this
argument. Default is no settings for any column. :l,ule
:line
[Mark-up:] :link(markup)
The text of the paragraph is scanned for special mark-up characters
which are converted into HTML.
Bold and italic characters:
<UL> <LI> "[" (left brace) --> turn-on bold by inserting a <B>
<LI> "]" (right brace) --> turn-off bold by inserting a </B>
<LI> "{" (left bracket) --> turn-on italics by inserting a <I>
<LI> "}" (right bracket) --> turn-off italics by
inserting a </I> </UL>
If a backslash ESCAPE character '\' preceeds any of the bold/italic
mark-up characters, then mark-up is not performed; the mark-up
character is simply left in the text.
Links are inserted by enclosing a section of text in double quotes,
and appending an underscore to the ending quote, followed by the link.
The link ends when whitespace is found, except that trailing
punctuation characters (comma, period, semi-colon, colon, question
mark, exclamation point, parenthesis) are not considered part of the
link.
<P> A link of the form "text"_link becomes <A HREF =
"link">text</A> in the HTML output. The only exception is if
"link" is defined elsewhere in the file as an alias (see the link
command above). In that case, the value is used instead of the alias
name. </P>
With these rules, links can take several forms.
<UL> <LI> "This links"_#abc to another part of this file which is
labeled with a :link(abc) command. <BR>
<LI> "This links"_other.html to another file named other.html. <BR>
<LI> "This links"_other.html#abc to another file which has an "abc"
location defined internally. <BR>
<LI> "This links"_http://www.google.com to a WWW site. <BR>
<LI> "This"_M12 could be used in place of any of the above forms. It
requires an alias like :link(M12,http://www.google.com) to be defined
elsewhere in the file. </UL>
[txt2html] is a simple tool for converting text files into HTML files.
Text files can contain simple formatting and mark-up commands that
[txt2html] converts into HTML.
[txt2html] was written by "Steve Plimpton"_sjp. I use it for
"documentation"_doc and "WWW pages"_www. Anna Reese added the table
formatting options.
See the "example.txt"_example.txt and "example.html"_example.html
files in the [txt2html] directory for examples of what all the
formatting commands and mark-up syntax end up looking like in HTML.
:link(sjp,http://www.cs.sandia.gov/~sjplimp)
:link(www,http://www.cs.sandia.gov/~sjplimp)
:link(doc,http://www.cs.sandia.gov/~sjplimp/lammps.html)
:line
[Syntax:]
txt2html file
read from text file, write HTML to standard output
txt2html file1 file2 file3 ...
read each argument as text file, write one HTML file per argument :dl
Input files are first opened with the specified name. If that fails,
a ".txt" suffix is added. Output files are created with an ".html"
suffix, which is either added or replaces the ".txt" suffix.
:line
[Compiling:]
The source for [txt2html] is a single C++ file. Compile it by typing:
g++ -o txt2html txt2html.cpp :pre
:line
[How the tool works:]
[txt2html] reads a text file, one {paragraph} at a time. A paragraph
ends with:
a blank line
a line whose final word starts with ":" (a format string)
the end of the file :ul
Any line in the paragraph which ends with "\" is concatenated to the
following line by removing the "\" character and following newline.
This can be useful for some of the formatting commands described below
that operate on individual lines in the paragraph.
If a paragraph starts with a "<" character and ends with a ">"
character, it is treated as raw HTML and is written directly into the
output file.
If a paragraph does not end with a format string, then it is
surrounded with HTML paragraph markers (<P> and </P>),
"mark-up"_#markup is performed, and the paragraph is written to the
output file.
If the paragraph ends with a format string, then "formatting"_#format
is performed, "mark-up"_#markup is performed, and the paragraph is
written to the output file.
:line
[Formatting:] :link(format)
A format string is the last word of a paragraph if it starts with a
":" character. A format string contains one or more comma-separated
commands, like ":ulb,l" or ":c,h3". Note that a format string cannot
contain spaces, else it would not be the last word. An individual
command can have 0 or more arguments:
{b} or {line()} = 0 arguments
{image(file)} = 1 argument
{link(alias,value)} = 2 or more comma-separated arguments :ul
Format commands add HTML markers at the beginning or end of the
paragraph and individual lines. Commands are processed in the order
they appear in the format string. Thus if two commands add HTML
markers to the beginning of the paragraph, the 2nd command's marker
will appear 2nd. The reverse is true at the end of the paragraph; the
2nd command's marker will appear 1st. Some comands, like {line} or
{image} make most sense if used as stand-alone commands without an
accompanying paragraph.
Commands that format the entire paragraph:
p --> surround the paragraph with <P> </P>
b --> put <BR> at the end of the paragraph
pre --> surround the paragraph with <PRE> </PRE>
c --> surround the paragraph with <CENTER> </CENTER>
h1,h2,h3,h4,h5,h6 --> surround the paragraph with \
<H1> </H1>, etc :ul
Commands that format the lines of the paragraph as a list:
ul --> surround the paragraph with <UL> </UL>, \
put <LI> at start of every line
ol --> surround the paragraph with <OL> </OL>, \
put <LI> at start of every line
dl --> surround the paragraph with <DL> </DL>, \
alternate <DT> and <DD> at start of every line :ul
Commands that treat the paragraph as one entry in a list:
l --> put <LI> at the beginning of the paragraph
dt --> put <DT> at the beginning of the paragraph
dd --> put <DD> at the beginning of the paragraph
ulb --> put <UL> at the beginning of the paragraph
ule --> put </UL> at the end of the paragraph
olb --> put <OL> at the beginning of the paragraph
ole --> put </OL> at the end of the paragraph
dlb --> put <DL> at the beginning of the paragraph
dle --> put </DL> at the end of the paragraph :ul
Commands applied to each line of the paragraph:
all(p) --> surround each line with <P> </P>
all(c) --> surround each line with <CENTER> </CENTER>
all(b) --> append a <BR> to each line
all(l) --> prepend a <LI> to each line :ul
Special commands (all HTML is inserted at beginning of paragraph):
line --> insert a horizontal line = <HR>
image(file) --> insert an image = <IMG SRC = "file">
image(file,link) --> insert an image that when clicked on goes to link
link(name) --> insert a named link that can be referred to \
elsewhere (see "mark-up"_#markup) = <A NAME = "name"></A>
link(alias,value) --> define a link alias that can be used \
elsewhere in this file (see "mark-up"_#markup) :ul
Table command:
tb(c=3,b=5,w=100%,a=c) --> format the paragraph as a table :ul
Arguments within tb() can appear in any order and are all optional,
since they each have default values.
c=N --> Make an N-column table. Treat the paragraph as one
long list of entries (separated by the separator character) and put
them into N columns one after the other. If N = 0, treat each line
of the paragraph as one row of the table with as many columns as
there are maximum entries in any line. Default is c=0. :ulb,l
s=: --> Use the character string following the equal sign as
the separator between entries. Default separator is a comma "," which
you cannot specify directly since the comma delimits the tb() arguments :l
b=N --> Create a border N pixels wide. If N is 0, there is no
border between or outside the cells. If N is 1, there is a minimal
border between and outside all cells. For N > 1, the border between
cells does not change but the outside border gets wider. Default is
b=1. :l
w=N or w=N% --> The first form makes each cell of the table at
least N pixels wide. The second form makes the entire table take up
N% of the width of the browser window. Default is w=0 which means
each cell will be just as wide as the text it contains. :l
a=X --> Align the entire table at the left, center, or right of the
browser window, for X = "l", "c", or "r". Default is a=c. :l
ea=X --> Align the text in each entry at the left, center, or
right of its cell, for X = "l", "c", or "r". Default is browser's
default (typically left). :l
eva=X --> Vertically align the text in each entry at the
top, middle, baseline, or bottom of its cell, for X = "t", "m", "ba",
or "bo". Default is browser's default (typically middle). :l
cwM=N or cwM=N% --> The first form makes column M be at least
N pixels wide. The second form makes column M take up N% of the
width of the browser window. This setting overrides the "w"
argument for column M. Only one column per table can be tweaked
with this argument. Default is no settings for any column. :l
caM=X --> Align the text in each entry of column M at the left,
center, or right of its cell, for X = "l", "c", or "r". This
setting overrides the "ea" argument for column M. Only one column
per table can be tweaked with this argument. Default is no settings
for any column. :l
cvaM=X --> Vertically align the text in each entry of column m
at the top, middle, baseline, or bottom of its cell, for X = "t",
"m", "ba", or "bo". This setting overrides the "eva" argument for
column M. Only one column per table can be tweaked with this
argument. Default is no settings for any column. :l,ule
:line
[Mark-up:] :link(markup)
The text of the paragraph is scanned for special mark-up characters
which are converted into HTML.
Bold and italic characters:
<UL> <LI> "[" (left brace) --> turn-on bold by inserting a <B>
<LI> "]" (right brace) --> turn-off bold by inserting a </B>
<LI> "{" (left bracket) --> turn-on italics by inserting a <I>
<LI> "}" (right bracket) --> turn-off italics by
inserting a </I> </UL>
If a backslash ESCAPE character '\' preceeds any of the bold/italic
mark-up characters, then mark-up is not performed; the mark-up
character is simply left in the text.
Links are inserted by enclosing a section of text in double quotes,
and appending an underscore to the ending quote, followed by the link.
The link ends when whitespace is found, except that trailing
punctuation characters (comma, period, semi-colon, colon, question
mark, exclamation point, parenthesis) are not considered part of the
link.
<P> A link of the form "text"_link becomes <A HREF =
"link">text</A> in the HTML output. The only exception is if
"link" is defined elsewhere in the file as an alias (see the link
command above). In that case, the value is used instead of the alias
name. </P>
With these rules, links can take several forms.
<UL> <LI> "This links"_#abc to another part of this file which is
labeled with a :link(abc) command. <BR>
<LI> "This links"_other.html to another file named other.html. <BR>
<LI> "This links"_other.html#abc to another file which has an "abc"
location defined internally. <BR>
<LI> "This links"_http://www.google.com to a WWW site. <BR>
<LI> "This"_M12 could be used in place of any of the above forms. It
requires an alias like :link(M12,http://www.google.com) to be defined
elsewhere in the file. </UL>
c4science · Help