From b6d92a3fee308a0191ac1fb9ecce2c5880e93a97 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 23 Oct 2015 14:18:19 -0500 Subject: [PATCH] Adjust the program that builds the tutorial graph to also process the code gallery. --- doc/doxygen/scripts/steps.pl | 76 +++++++++++++++++++++-------- doc/doxygen/tutorial/CMakeLists.txt | 17 ++++++- 2 files changed, 72 insertions(+), 21 deletions(-) diff --git a/doc/doxygen/scripts/steps.pl b/doc/doxygen/scripts/steps.pl index 87f4f0ecf9..d4d7eb40af 100644 --- a/doc/doxygen/scripts/steps.pl +++ b/doc/doxygen/scripts/steps.pl @@ -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 = ; - 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 = ; + 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"; } } diff --git a/doc/doxygen/tutorial/CMakeLists.txt b/doc/doxygen/tutorial/CMakeLists.txt index ce580950a5..c87ecd80c9 100644 --- a/doc/doxygen/tutorial/CMakeLists.txt +++ b/doc/doxygen/tutorial/CMakeLists.txt @@ -15,10 +15,22 @@ +# 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) -- 2.39.5