]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Finish assemblage of examples.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 6 Dec 1999 11:53:31 +0000 (11:53 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 6 Dec 1999 11:53:31 +0000 (11:53 +0000)
git-svn-id: https://svn.dealii.org/trunk@1986 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/tutorial/chapter-2.step-by-step/Makefile
deal.II/doc/tutorial/chapter-2.step-by-step/program2html [moved from deal.II/doc/tutorial/chapter-2.step-by-step/process-files with 62% similarity]
deal.II/doc/tutorial/chapter-2.step-by-step/program2plain [new file with mode: 0644]
deal.II/doc/tutorial/chapter-2.step-by-step/toc.html

index 75386ddf39b3908ddcd2cec60b95ba8804cb30a3..468ee813adb64255f622b26005d114d2ff0d072c 100644 (file)
@@ -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)
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 80d32a09f2fee359140ccad47ad965787ff5300f..eaac0b764c7d400106f28316a2fec4a1e1bc5b24 100644 (file)
@@ -1,3 +1,11 @@
+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;
@@ -10,13 +18,16 @@ while (<>) {
     # substitute special characters
     s/</&lt;/g;
     s/>/&gt;/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";
@@ -33,3 +44,8 @@ while (<>) {
        print "        $_";
     }
 }
+
+if ($state == $program_mode) {
+   print "</code></pre>\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 (file)
index 0000000..e6dbcce
--- /dev/null
@@ -0,0 +1,26 @@
+# 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/</&lt;/g;
+    s/>/&gt;/g;
+    s/\t/        /g;
+
+    print "  $_";
+}
+
+print "</code></pre>";
index 83b6898e3a3feaab2717ecc345c2ee6076d5c87b..4f73b4d215b32915ce35d6376f095d85480b00ae 100644 (file)
 <!-- 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>

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.