We introduced "//" markers (see for example "shape_grad" lines in
step-8) to force a specific formatting for clang-format. Make sure we
don't output these markers to the tutorial pages.
print " * \n";
do {
- # substitute tabs. also make sure that we don't output comment end
- # markers that might confuse doxygen
+
+ # Make sure that we don't output comment end markers that might confuse
+ # doxygen.
s!/\*!/ \*!g;
s!\*/!\* /!g;
+ # substitute tabs
s/\t/ /g;
+ # Remove "//" if it is present at the end of a line. These comments exist
+ # to force a specific formatting of the line for clang-format.
+ s!//$!!g;
+
# We are entering code fragments
if (($state != $code_fragment_mode) && m!^\s*//\s*\@code!)
{
# Remove all comments from the source file
-# The variable tracing whether we are inside a block comment
+# The output of this script is used as the source for the "The plain program"
+# block at the end of each tutorial.
-my $block_comment = 0;
while (<>) {
- # Eliminate //-comment lines
+ # Eliminate comment lines starting with "//"
next if (m!^\s*//!);
+ # Remove "//" if it is present at the end of a line. These comments exist
+ # to force a specific formatting of the line for clang-format
+ s!//$!!g;
+
# Otherwise print the line
print;
}
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