зеркало из https://github.com/mozilla/pjs.git
114 строки
5.1 KiB
HTML
114 строки
5.1 KiB
HTML
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<meta name="Author" content="Rick Gessner">
|
|
<meta name="GENERATOR" content="Mozilla/4.6 [en] (WinNT; U) [Netscape]">
|
|
<title>htmlgen</title>
|
|
</head>
|
|
<body>
|
|
|
|
<table COLS=1 WIDTH="100%" BGCOLOR="#FFFFCC" >
|
|
<tr>
|
|
<td><b><font face="Verdana"><font size=-1>Using HTMLGen</font></font></b>
|
|
<br><font face="Verdana"><font size=-2>Version 1.0</font></font></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p><font face="Verdana"><font size=-1>HTMLGen is a C++ text-processing
|
|
utility that lets users quickly generate HTML testcases. While HTMLGen
|
|
is not restricted to generating HTML files, the program does understand
|
|
the set of known HTML tags. HTMLGen takes user supplied file fragments
|
|
and command line arguments as input, and automatically generates a series
|
|
of derived HTML files.</font></font>
|
|
<p><font face="Verdana"><font size=-1>Here's a quick example: Let's say
|
|
you want to create a series of tests to verify that Gecko correctly renders
|
|
every tag inside the <BODY> element. To accomplish this, begin with
|
|
a small HTML fragment file given below:</font></font>
|
|
<br>
|
|
<table COLS=1 WIDTH="30%" BGCOLOR="#CCCCCC" >
|
|
<tr>
|
|
<td><font face="Verdana"><font size=-1><html></font></font>
|
|
<br><font face="Verdana"><font size=-1><body></font></font>
|
|
<br><font face="Verdana"><font size=-1><$0><i>text</i></$0></font></font>
|
|
<br><font face="Verdana"><font size=-1></body></font></font>
|
|
<br><font face="Verdana"><font size=-1></html></font></font></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p><font face="Verdana"><font size=-1>Notice that the file looks like a
|
|
typical HTML file, except for the tags that read <$0> and </$0>.
|
|
These are macros, which are content that will be replaced by arguments
|
|
provided on the HTMLGen command line. To finish our example, simply run
|
|
HTMLGen with the following command line arguments:</font></font>
|
|
<pre><tt><font color="#3333FF">HTMLGen -f test1.html a-z</font></tt></pre>
|
|
<font face="Verdana"><font size=-1>This instructs HTML to read the test1.html
|
|
file and use it as a template. Next, the tag-range argument "a-z" instructs
|
|
HTMLGen to autogenerate a file for each HTML tag between A and Z. HTMLGen
|
|
uses this argument as the 0th element of its macro substitution process.
|
|
The macros <$0> and </$0> will be replaced in each autogenerated
|
|
file with the current value of the $0 argument. So, the first file will
|
|
contain <A> where it sees <$0>, the second will use <B> and so
|
|
on.</font></font>
|
|
<p><font face="Verdana"><font size=-1>The result of running HTMLGen against
|
|
the given template with these arguments is that you'll get a new file for
|
|
each tag we see in the range between A..Z. Note that in this example
|
|
we're emitting valid HTML, but that is not a requirement. You can use HTMLGen
|
|
to generate lots of illegal content for testing as well.</font></font>
|
|
<br>
|
|
<br>
|
|
<table COLS=1 WIDTH="100%" BGCOLOR="#FFFFCC" >
|
|
<tr>
|
|
<td><b><font face="Verdana"><font size=-1>HTMLGen Command Line Arguments</font></font></b></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p><font face="Verdana"><font size=-1>The arguments you use for controlling
|
|
HTMLGen always have the same form, as shown:</font></font>
|
|
<p><tt><font color="#3333FF">HTMLGen -f test1.html [-o outfile name] taglist0
|
|
[,taglist1, ..., taglist9]</font></tt>
|
|
<p><font face="Verdana"><font size=-1>The first argument is always the
|
|
name of the template file to read.</font></font>
|
|
<br><font face="Verdana"><font size=-1>The (optional) second argument is
|
|
the name of the output file.</font></font>
|
|
<br><font face="Verdana"><font size=-1>The 3rd argument on represent represent
|
|
tag sequences to be used in macro substitution. These can have one of three
|
|
forms: 1) a single tag; 2) a list of tags (a,b,c); 3) a range of tags (a-z).</font></font>
|
|
<br>
|
|
<br>
|
|
<table COLS=1 WIDTH="100%" BGCOLOR="#FFFFCC" >
|
|
<tr>
|
|
<td><b><font face="Verdana"><font size=-1>HTMLGen Embedded Text Commands</font></font></b></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p><font face="Verdana"><font size=-1>In addition to the command line arguments,
|
|
HTMLGen can also respond to special markup found inside your template files.
|
|
Commands you can use inside your templates include:</font></font>
|
|
<p><font face="Verdana"><font size=-1>@file -- this gets replaced
|
|
with the name of the current output file.</font></font>
|
|
<br><font face="Verdana"><font size=-1>@next -- this gets replaced with
|
|
the name of the <i>next</i> output file (useful for creating links between
|
|
files).</font></font>
|
|
<br><font face="Verdana"><font size=-1>@import <i>filename </i>-- this
|
|
causes the contents of <i>filename</i> to be inserted into the current
|
|
document.</font></font>
|
|
<br>
|
|
<br>
|
|
<table COLS=1 WIDTH="100%" BGCOLOR="#FFFFCC" >
|
|
<tr>
|
|
<td><b><font face="Verdana"><font size=-1>Notes and Cautions</font></font></b></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<blockquote>
|
|
<li>
|
|
<font face="Verdana"><font size=-1>The first note of caution is that HTMLGen
|
|
can produce a large number of test files in very little time. You should
|
|
be careful when you specify arguments because the combinatorics add up
|
|
to a potentially<i> big</i> document set.</font></font></li>
|
|
</blockquote>
|
|
|
|
</body>
|
|
</html>
|