$(example-htmls):
@echo ================== Assembling $@
- @cat head.html \
+ @TOC=`cat $D/examples/$(@:.html=)/$(@:.html=.cc) \
+ | grep "@sect" \
+ | perl -pi -e 's/.*\{(.*)\}.*/\1/; $$n=$$1; $$nn=$$1; \
+ $$nn=~s/\s/_/g; $$_="<li><a href=\"#$$nn\">$$n</a></li>\n";' \
+ | perl -pi -e 's/\"/\\\"/g;'` ; \
+ cat head.html \
| perl -pi -e '$$step="$@"; \
$$step=~s/step-(\d+).html/$$1/g; \
s/step xxx/step $$step/g;' \
+ | perl -pi -e "s!TOC!$$TOC!g;" \
> $@
@cat $(@:.html=.data/intro.html) >> $@
@cat $D/examples/$(@:.html=)/$(@:.html=.cc) \
if ($state == $comment_mode)
{
- m!\s*//\s*(.*)!;
- print $1, "\n";
+ # in comment mode: first skip leading whitespace and
+ # comment // signs
+ s!\s*//\s*(.*)!$1!;
+
+ # second, replace section headers, and generate addressable
+ # anchor
+ s!\@sect(\d)\{(.*)\}\s*$!<h$1>$2</h$1>!g;
+ $sect_name = $2;
+ $sect_name =~ s/\s/_/g;
+ $_ = "\n<a name=\"$sect_name\"></a>" . $_;
+
+ # finally print this line
+ print $_, "\n";
+
+ # if empty line, introduce paragraph break
print "</p>\n\n<p>" if $1 =~ m!^\s*$!;
}
else
#include <fstream>
-
- // Since we want to compare the
- // exactly known continuous solution
- // to the computed one, we need a
- // function object which represents
- // the continuous solution. On the
- // other hand, we need the right hand
- // side function, and that one of
- // course shares some characteristics
- // with the solution. In order to
- // reduce dependencies which arise if
- // we have to change something in
- // both classes at the same time, we
+ // @sect3{Equation data}
+
+ // Before implementing the classes
+ // that actually solve something, we
+ // first declare and define some
+ // function classes that represent
+ // right hand side and solution
+ // classes. Since we want to compare
+ // the exactly known continuous
+ // solution to the computed one, we
+ // need a function object which
+ // represents the continuous
+ // solution. On the other hand, we
+ // need the right hand side function,
+ // and that one of course shares some
+ // characteristics with the
+ // solution. In order to reduce
+ // dependencies which arise if we
+ // have to change something in both
+ // classes at the same time, we
// exclude the common characteristics
// of both functions into a base
// class.
};
+ // @sect3{The Laplace solver class}
// Then we need the class that does
// all the work. It is mostly the
}
};
+ // @sect3{Main function}
// The main function is mostly as
// before. The only difference is
# define M_PI 3.14159265358979323846
#endif
+ // @sect3{AdvectionProblem class declaration}
// Following we declare the main
// class of this program. It is very
+ // @sect3{Equation data declaration}
// Next we declare a class that
// describes the advection
+ // @sect3{GradientEstimation class declaration}
// Now, finally, here comes the class
// that will compute the difference
-
+ // @sect3{AdvectionProblem class implementation}
// Now for the implementation of the
+ // @sect3{GradientEstimation class implementation}
// Now for the implementation of the
// ``GradientEstimation'' class. The
};
+ // @sect3{Main function}
+
// The ``main'' function is exactly
// like in previous examples, with
// the only difference in the name of