]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Adjust the program that builds the tutorial graph to also process the code gallery.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 23 Oct 2015 19:18:19 +0000 (14:18 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sun, 25 Oct 2015 18:32:38 +0000 (13:32 -0500)
doc/doxygen/scripts/steps.pl
doc/doxygen/tutorial/CMakeLists.txt

index 87f4f0ecf9d695ce2a3554e9fe9cdd6ff003459b..d4d7eb40af09f46fda5d63445bf03144308670ef 100644 (file)
@@ -33,7 +33,8 @@ my %style = (
  "fluids"         => ',height=.25,width=.25,fillcolor="yellow"',
  "solids"         => ',height=.25,width=.25,fillcolor="lightblue"',
  "time dependent" => ',height=.25,width=.25,fillcolor="blue"',
- "unfinished"     => ',height=.25,width=.25,style="dashed"'
+ "unfinished"     => ',height=.25,width=.25,style="dashed"',
+ "code-gallery"   => ',height=.08,width=.125,shape="circle"',
     );
 
 # Print a preamble setting common attributes
@@ -64,9 +65,6 @@ EOT
 my $step;
 foreach $step (@ARGV)
 {
-    my $number = $step;
-    $number =~ s/^.*-//;
-
     # read first line of tooltip file
     open TF, "$step/doc/tooltip"
         or die "Can't open tooltip file $step/doc/tooltip";
@@ -74,18 +72,41 @@ foreach $step (@ARGV)
     close TF;
     chop $tooltip;
 
-    printf "Step$number [label=\"$number\", URL=\"\\ref step_$number\", tooltip=\"$tooltip\"";
-
-
-    # read first line of 'kind' file
-    open KF, "$step/doc/kind"
-        or die "Can't open kind file $step/doc/kind";
-    my $kind = <KF>;
-    close KF;
-    chop $kind;
-
-    die "Unknown kind '$kind' in file $step/doc/kind" if (! defined $style{$kind});
-    print "$style{$kind}";
+    # read first line of 'kind' file if it is a step;
+    # otherwise assume it is a code gallery program. for
+    # each of them, output something for 'dot' to generate
+    # the dependencies graph from
+    if ($step =~ /step-/
+        &&
+        !($step =~ /code-gallery/))
+    {
+      open KF, "$step/doc/kind"
+          or die "Can't open kind file $step/doc/kind";
+      my $kind = <KF>;
+      chop $kind;
+      close KF;
+
+      die "Unknown kind '$kind' in file $step/doc/kind" if (! defined $style{$kind});
+
+      my $number = $step;
+      $number =~ s/^.*-//;
+
+      printf "Step$number [label=\"$number\", URL=\"\\ref step_$number\", tooltip=\"$tooltip\"";
+      print "$style{$kind}";
+    }
+    else
+    {
+      # get at the name of the program; also create something
+      # that can serve as a tag without using special characters
+      my $name = $step;
+      $name =~ s/^.*code-gallery\///;
+      my $tag = $name;
+      $tag =~ s/[^a-zA-Z]/_/g;
+
+      printf "code_gallery_$tag [label=\"\", URL=\"\\ref code_gallery_$tag\", tooltip=\"$tooltip\"";
+      my $kind = "code-gallery";
+      print "$style{$kind}";
+    }
 
     print "];\n";
 }
@@ -96,9 +117,6 @@ foreach $step (@ARGV)
 my $step;
 foreach $step (@ARGV)
 {
-    my $number = $step;
-    $number =~ s/^.*-//;
-
     # read first line of dependency file
     open BF, "$step/doc/builds-on"
         or die "Can't open builds-on file $step/doc/builds-on";
@@ -106,10 +124,28 @@ foreach $step (@ARGV)
     close BF;
     chop $buildson;
 
+    my $destination;
+    if ($step =~ /step-/
+        &&
+        !($step =~ /code-gallery/))
+    {
+      my $number = $step;
+      $number =~ s/^.*-//;
+      $destination = "Step$number";
+    }
+    else
+    {
+      my $name = $step;
+      $name =~ s/^.*code-gallery\///;
+      my $tag = $name;
+      $tag =~ s/[^a-zA-Z]/_/g;
+      $destination = "code_gallery_$tag";
+    }
+
     my $source;
     foreach $source (split ' ', $buildson) {
         $source =~ s/step-/Step/g;
-        print "$source -> Step$number\n";
+        print "$source -> $destination\n";
     }
 }
 
index ce580950a5c572dd7ecc67d57032888d4779e3c5..c87ecd80c93aec405f78bbbf30886a4c971561a1 100644 (file)
 
 
 
+# Collect all of the directory names for the tutorial programs
 FILE(GLOB _deal_ii_steps
   ${CMAKE_SOURCE_DIR}/examples/step-*
   )
 
+# Also collect the names of all code gallery projects. To
+# do so, find all 'author' files, then strip the last two
+# levels of these paths.
+#
+# For unclear reasons, the glob returns these files as
+# "/a/b/c/name//doc//author", so make sure we eat the
+# double slashes in the second step
+FILE(GLOB _code_gallery_names 
+     "${CMAKE_BINARY_DIR}/doc/doxygen/code-gallery/code-gallery/*/doc/author")
+STRING(REGEX REPLACE "/+doc/+author" "" _code_gallery_names "${_code_gallery_names}")
+
 #
 # Define target for the tutorial. It depends on the
 # file tutorial.h built via the next target below, as well
@@ -53,13 +65,16 @@ ADD_CUSTOM_COMMAND(
     ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/steps.pl
     ${CMAKE_CURRENT_SOURCE_DIR}/tutorial.h.in
     ${_deal_ii_steps}
+    ${_code_gallery_names}
     > ${CMAKE_CURRENT_BINARY_DIR}/tutorial.h
   DEPENDS
+    ${CMAKE_SOURCE_DIR}/doc/doxygen/scripts/steps.pl
+    ${CMAKE_CURRENT_SOURCE_DIR}/tutorial.h.in
     ${_deal_ii_steps}
     ${_deal_ii_steps_kind}
     ${_deal_ii_steps_tooltip}
     ${_deal_ii_steps_buildson}
-    ${CMAKE_CURRENT_SOURCE_DIR}/tutorial.h.in
+    ${_code_gallery_names}
   )
 ADD_CUSTOM_TARGET(build_tutorial_h
   DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/tutorial.h)

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.