# and commented and plain versions of the program as well as a combined one
example-toc-prog = $(addsuffix _toc.prog,$(gen-example-names))
example-toc-plain = $(addsuffix _toc.plain,$(gen-example-names))
+example-toc-intro = $(addsuffix _toc.intro,$(gen-example-names))
+example-toc-results= $(addsuffix _toc.results,$(gen-example-names))
example-toc = $(addsuffix _toc.combined,$(gen-example-names))
# same for intermediate files for doxygen output
> $@
+$(example-toc-intro):
+ @echo ================== Making $@
+ @cat $D/examples/$(call get_basename, $@)/doc/intro.dox \
+ | egrep -i "<h[3456]>.*</h[3456]>" \
+ | $(PERL) ./intro2toc \
+ > $@
+
+
+$(example-toc-results):
+ @echo ================== Making $@
+ @cat $D/examples/$(call get_basename, $@)/doc/results.dox \
+ | egrep -i "<h[3456]>.*</h[3456]>" \
+ | $(PERL) ./intro2toc \
+ > $@
+
+
$(example-toc):
@echo ================== Making $@
@echo "<table class=\"tutorial\"> <tr> <td>" > $@
@echo "<ol>" >> $@
@echo " <li> <a href=\"#Intro\" class=bold>Introduction</a>" >> $@
+ @cat generated/$(call get_basename, $@)_toc.intro >> $@
@echo " <li> <a href=\"#CommProg\" class=bold>The commented program</a>" >> $@
@cat generated/$(call get_basename, $@)_toc.prog >> $@
@echo " <li> <a href=\"#Results\" class=bold>Results</a>" >> $@
+ @cat generated/$(call get_basename, $@)_toc.results >> $@
@echo " <li> <a href=\"#PlainProg\" class=bold>The plain program</a>" >> $@
@cat generated/$(call get_basename, $@)_toc.plain >> $@
@echo "</ol> </td> </tr> </table>" >> $@
@echo "@htmlonly" >> $@
@cat generated/$(call get_basename, $@)_toc.combined >> $@
@echo "@endhtmlonly" >> $@
- @cat $D/examples/$(call get_basename, $@)/doc/intro.dox >> $@
+ @cat $D/examples/$(call get_basename, $@)/doc/intro.dox \
+ | $(PERL) create_anchors >> $@
@cat generated/$(call get_basename, $@)_prog.dox >> $@
- @cat $D/examples/$(call get_basename, $@)/doc/results.dox >> $@
+ @cat $D/examples/$(call get_basename, $@)/doc/results.dox \
+ | $(PERL) create_anchors >> $@
@cat generated/$(call get_basename, $@)_plain.dox >> $@
@echo " */" >> $@
clean:
-rm -f $(example-toc) \
- $(example-toc-prog) $(example-toc-plain) \
+ $(example-toc-prog) $(example-toc-plain) \
+ $(example-toc-intro) $(example-toc-results) \
$(example-dox-prog) $(example-dox-plain) $(example-doxygen)
-rm -f Makefile.dep
`echo $D/examples/$${i}/*.cc` ; \
echo generated/$${i}_toc.plain : generated/$${i}_toc.prog ; \
echo generated/$${i}_toc.combined : \
- generated/$${i}_toc.prog generated/$${i}_toc.plain ; \
+ generated/$${i}_toc.intro \
+ generated/$${i}_toc.results \
+ generated/$${i}_toc.prog \
+ generated/$${i}_toc.plain ; \
echo doxygen/$$i.h : generated/$${i}_prog.dox generated/$${i}_plain.dox \
generated/$${i}_toc.combined \
$D/examples/$$i/doc/intro.dox \
$D/examples/$$i/doc/results.dox \
- ; \
+ ; \
+ echo generated/$${i}_toc.intro : \
+ $D/examples/$$i/doc/intro.dox \
+ ; \
+ echo generated/$${i}_toc.results : \
+ $D/examples/$$i/doc/results.dox \
+ ; \
done \
> $@
--- /dev/null
+#---------------------------------------------------------------------------
+# $Id: create_anchors 14782 2007-06-15 16:37:12Z kanschat $
+# Version: $Name$
+#
+# Copyright (C) 2007 by the deal.II authors
+#
+# This file is subject to QPL and may not be distributed
+# without copyright and license information. Please refer
+# to the file deal.II/doc/license.html for the text and
+# further information on this license.
+#
+#---------------------------------------------------------------------------
+
+
+# If we find a a heading in a .dox file, create an HTML anchor for it.
+
+while (<>) {
+ if ( /<h.>(.*)<\/h.>\s*/ ) {
+ $reftext = $1;
+
+ # for the anchor, use the name of the section but discard
+ # everything except for letters, numbers, and underscores
+ $reftext =~ s/[^a-zA-Z0-9_]//g;
+
+ print "<a name=\"$reftext\"></a>$_\n";
+ } else {
+ print;
+ }
+}
--- /dev/null
+#---------------------------------------------------------------------------
+# $Id: intro2toc 14782 2007-06-15 16:37:12Z kanschat $
+# Version: $Name$
+#
+# Copyright (C) 2006, 2007 by the deal.II authors
+#
+# This file is subject to QPL and may not be distributed
+# without copyright and license information. Please refer
+# to the file deal.II/doc/license.html for the text and
+# further information on this license.
+#
+#---------------------------------------------------------------------------
+
+print " <ul>\n";
+
+$level = 3;
+while (<>) {
+ if ( /<h(.)>(.*)<\/h.>\s*/ ) {
+ $newlevel = $1;
+ $text = $2;
+
+ # only allow header levels 3 through 6, since higher ones are
+ # reserved for top-level document headers
+ if (! ($newlevel =~ /[3456]/)) {
+ print STDERR "Only header levels 3 through 6 are allowed.\n";
+ print STDERR "You had $newlevel.\n";
+ die;
+ }
+
+ if ($newlevel > $level) {
+ for ($i=$level; $i<$newlevel; ++$i) {
+ print " <ul>\n";
+ }
+ } elsif ($newlevel < $level) {
+ for ($i=$newlevel; $i<$level; ++$i) {
+ print " </ul>\n";
+ }
+ }
+
+ $reftext = $text;
+
+ # for the anchor, use the name of the section but discard
+ # everything except for letters, numbers, and underscores
+ $reftext =~ s/[^a-zA-Z0-9_]//g;
+
+ # replace quotation marks by the appropriate HTML quotation marks
+ $text =~ s!``!“!g;
+ $text =~ s!''!”!g;
+
+ # replace double dashes in comments by —
+ $text =~ s!--!—!g;
+
+ print " <li><a href=\"#$reftext\">$text</a>\n";
+
+ $level = $newlevel;
+ }
+}
+
+for (; $level>=3; --$level) {
+ print " </ul>\n";
+}