-step-1.html \
-step-2.html:
- cat step-by-step.header > $@
- cat ../../../deal.II/examples/step-by-step/$(@:.html=)/$(@:.html=.cc) \
- | perl process-files \
+# $Id$
+# Create proper HTML output from the different example programs
+
+example-directories = $(shell echo ../../../deal.II/examples/step-by-step/step-*)
+example-names = $(notdir $(example-directories))
+example-htmls = $(addsuffix .html,$(example-names))
+
+all: $(example-htmls)
+
+
+$(example-htmls):
+ @echo ================== Assembling $@
+ @cat step-by-step.header > $@
+ @cat ../../../deal.II/examples/step-by-step/$(@:.html=)/$(@:.html=.cc) \
+ | perl program2html \
+ >> $@
+ @cat ../../../deal.II/examples/step-by-step/$(@:.html=)/$(@:.html=.cc) \
+ | perl program2plain \
>> $@
- cat step-by-step.foot >> $@
+ @cat step-by-step.foot >> $@
+
-.PHONY: step-1.html step-2.html
+# mark the output files as phony, i.e. generate them every time
+.PHONY: $(example-htmls)
+print "<h1> The commented program</h1>";
+
+# ignore the first few lines
+$_ = <>;
+while ( m!/\*\s*\$Id$!) {
+ $_ = <>;
+}
+
# have two states, in which the program can be:
# comment-mode and program-mode
$comment_mode = 0;
# substitute special characters
s/</</g;
s/>/>/g;
+ s/\t/ /g;
if (($state == $program_mode) && m!^\s*//!)
{
$state = $comment_mode;
print "</code></pre>\n";
}
- elsif (($state == $comment_mode) && !m!^\s*//!)
+ # if in comment mode and no comment line: toggle state.
+ # don't do so, if only a blank line
+ elsif (($state == $comment_mode) && !m!^\s*//! && !m!^\s*$!)
{
$state = $program_mode;
print "<pre><code>\n";
print " $_";
}
}
+
+if ($state == $program_mode) {
+ print "</code></pre>\n";
+}
+
--- /dev/null
+# ignore the first few lines
+$_ = <>;
+while ( m!/\*\s*\$Id$!) {
+ $_ = <>;
+}
+
+print "<h1> The plain program</h1>";
+print "<pre><code>";
+
+
+while (<>) {
+ # ignore cvs tag
+ next if m!/\*\s*\$Id:!;
+
+ # ignore comment lines
+ next if m!^\s*//!;
+
+ # substitute special characters
+ s/</</g;
+ s/>/>/g;
+ s/\t/ /g;
+
+ print " $_";
+}
+
+print "</code></pre>";
<!-- Page Body -->
<body lang="en">
-<h1>Step-by-Step example</h1>
+<h1>Step-by-Step Examples</h1>
<p>
In this chapter, we present a collecting of small programs, each more
or less built atop of the previous one, which demonstrate various
-aspects of the library. At present, the following programs exist:
+aspects of the library. The general layout of each such example is as
+follows:
+<ol>
+ <li> A brief description of what the program does and what is new
+ compared to the previous programs.
+ <li> The program, in commented form.
+ <li> The output of the program, with some comments.
+ <li> Since the program itself usually is a little bit unreadable
+ with all the comments intertwingled, we present the program again,
+ with all comments stripped off, to allow getting an overview of it.
+</ol>
+</p>
+<p>
+At present, the following programs exist:
</p>
<dl>