]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Copy annotated versions of .md and .cc files into the page.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 6 Jan 2016 13:40:03 +0000 (07:40 -0600)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 6 Jan 2016 13:40:03 +0000 (07:40 -0600)
Also provide links to them at the top.

doc/doxygen/scripts/make_gallery.pl

index 7caec1c0ed13fa1a015eda20723d6b8167d9447f..d8e54a8c7001d0cc00574ccc7cd13cbf7e9380f8 100644 (file)
@@ -56,6 +56,10 @@ This program consists of the following files (click to inspect):
 foreach my $file (@src_files)
 { 
   print "- <a href=\"../code-gallery/$gallery/$file\">$file</a>\n";
+  if ($file =~ /.*\.(md|markdown|cc|cpp|cxx|c\+\+|h|hh|hxx)/) 
+  {
+      print "  (see <a href=\"#ann-$file\">below</a> for an annotated version)\n";
+  }
 }
 print "\n";
 
@@ -73,7 +77,7 @@ foreach my $file (@src_files)
 
 if (@picture_files)
 {
-    print "<h2>Pictures from this code gallery program:</h2>\n";
+    print "<h1>Pictures from this code gallery program</h1>\n";
     print "<p align=\"center\">\n";
     print "<table>\n";
 
@@ -99,5 +103,38 @@ if (@picture_files)
 }
 
 
+# Then go through the list of files again and see which ones we can
+# annotate and copy into the current document
+foreach my $file (@src_files)
+{ 
+    # just copy markdown files as-is, but make sure we update links
+    if ($file =~ /.*\.(md|markdown)/)
+    {
+        print "<a name=\"ann-$file\"></a>\n";
+        print "<h1>Annotated version of $file</h1>\n";
+
+        open MD, "<$gallery_dir/$file";
+        while ($line = <MD>) {
+            # update markdown links of the form "[text](./filename)"
+            $line =~ s/(\[.*\])\(.\//\1\(..\/code-gallery\/$gallery\//g;
+            print "$line";
+        }
+
+        print "\n\n";
+    }
+
+    # annotate source files
+    if ($file =~ /.*\.(cc|cpp|cxx|c\+\+|h|hh|hxx)/)
+    {
+        print "<a name=\"ann-$file\"></a>\n";
+        print "<h1>Annotated version of $file</h1>\n";
+
+        system $^X, "$cmake_source_dir/doc/doxygen/scripts/program2doxygen", "$gallery_dir/$file";
+
+        print "\n\n";
+    }
+}
+
+
 # end the doxygen input file
 print "*/\n";

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.