system $^X, "$cmake_source_dir/doc/doxygen/scripts/create_anchors", "$cmake_source_dir/examples/$step/doc/intro.dox";
+
+# Start the commented program by writing two empty lines. We have had
+# cases where the end of the intro.dox was missing a newline, and in
+# that case doxygen might get confused about what is being added here
+# to the end of an existing line. So add a newline.
+#
+# But then we also had a situation where doxygen was confused about a
+# line starting with an anchor (see #9357). It's not clear what the
+# cause is, but making sure that there is an empty line in between
+# solves the problem -- so a second newline character.
+print " *\n";
+print " *\n";
print " * <a name=\"CommProg\"></a>\n";
print " * <h1> The commented program</h1>\n";
system $^X, "$cmake_source_dir/doc/doxygen/scripts/create_anchors", "$cmake_source_dir/examples/$step/doc/results.dox";
+
+# Move to the stripped, plain program. The same principle as above
+# applies for newlines.
+print " *\n";
+print " *\n";
print
"<a name=\"PlainProg\"></a>
<h1> The plain program</h1>