From dd138c66d9b84710a9bf73429f25a0f69f7ab953 Mon Sep 17 00:00:00 2001 From: wolf Date: Mon, 6 Dec 1999 11:53:31 +0000 Subject: [PATCH] Finish assemblage of examples. git-svn-id: https://svn.dealii.org/trunk@1986 0785d39b-7218-0410-832d-ea1e28bc413d --- .../tutorial/chapter-2.step-by-step/Makefile | 29 ++++++++++++++----- .../{process-files => program2html} | 18 +++++++++++- .../chapter-2.step-by-step/program2plain | 26 +++++++++++++++++ .../tutorial/chapter-2.step-by-step/toc.html | 17 +++++++++-- 4 files changed, 80 insertions(+), 10 deletions(-) rename deal.II/doc/tutorial/chapter-2.step-by-step/{process-files => program2html} (62%) create mode 100644 deal.II/doc/tutorial/chapter-2.step-by-step/program2plain diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/Makefile b/deal.II/doc/tutorial/chapter-2.step-by-step/Makefile index 75386ddf39..468ee813ad 100644 --- a/deal.II/doc/tutorial/chapter-2.step-by-step/Makefile +++ b/deal.II/doc/tutorial/chapter-2.step-by-step/Makefile @@ -1,9 +1,24 @@ -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) diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/process-files b/deal.II/doc/tutorial/chapter-2.step-by-step/program2html similarity index 62% rename from deal.II/doc/tutorial/chapter-2.step-by-step/process-files rename to deal.II/doc/tutorial/chapter-2.step-by-step/program2html index 80d32a09f2..eaac0b764c 100644 --- a/deal.II/doc/tutorial/chapter-2.step-by-step/process-files +++ b/deal.II/doc/tutorial/chapter-2.step-by-step/program2html @@ -1,3 +1,11 @@ +print "

The commented program

"; + +# 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; @@ -10,13 +18,16 @@ while (<>) { # substitute special characters s//>/g; + s/\t/ /g; if (($state == $program_mode) && m!^\s*//!) { $state = $comment_mode; print "\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 "
\n";
@@ -33,3 +44,8 @@ while (<>) {
 	print "        $_";
     }
 }
+
+if ($state == $program_mode) {
+   print "
\n"; +} + diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/program2plain b/deal.II/doc/tutorial/chapter-2.step-by-step/program2plain new file mode 100644 index 0000000000..e6dbcce49e --- /dev/null +++ b/deal.II/doc/tutorial/chapter-2.step-by-step/program2plain @@ -0,0 +1,26 @@ +# ignore the first few lines +$_ = <>; +while ( m!/\*\s*\$Id$!) { + $_ = <>; +} + +print "

The plain program

"; +print "
";
+
+
+while (<>) {
+    # ignore cvs tag
+    next if m!/\*\s*\$Id:!;
+
+    # ignore comment lines
+    next if m!^\s*//!;  
+
+    # substitute special characters
+    s//>/g;
+    s/\t/        /g;
+
+    print "  $_";
+}
+
+print "
"; diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/toc.html b/deal.II/doc/tutorial/chapter-2.step-by-step/toc.html index 83b6898e3a..4f73b4d215 100644 --- a/deal.II/doc/tutorial/chapter-2.step-by-step/toc.html +++ b/deal.II/doc/tutorial/chapter-2.step-by-step/toc.html @@ -17,12 +17,25 @@ -

Step-by-Step example

+

Step-by-Step Examples

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: +

    +
  1. A brief description of what the program does and what is new + compared to the previous programs. +
  2. The program, in commented form. +
  3. The output of the program, with some comments. +
  4. 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. +
+

+

+At present, the following programs exist:

-- 2.39.5