From: wolf
Date: Wed, 21 Nov 2001 10:22:15 +0000 (+0000)
Subject: Take over the changes 1.7->1.9 introducing the ability to have subsections in example...
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f0a27e7691bc2188b53bb8a9c7a7535fa1d55ed;p=dealii-svn.git
Take over the changes 1.7->1.9 introducing the ability to have subsections in example programs.
git-svn-id: https://svn.dealii.org/branches/Branch-3-2@5229 0785d39b-7218-0410-832d-ea1e28bc413d
---
diff --git a/deal.II/doc/tutorial/chapter-2.step-by-step/program2html b/deal.II/doc/tutorial/chapter-2.step-by-step/program2html
index 6e3c359e2c..0b7cc35b5e 100644
--- a/deal.II/doc/tutorial/chapter-2.step-by-step/program2html
+++ b/deal.II/doc/tutorial/chapter-2.step-by-step/program2html
@@ -44,8 +44,23 @@ while (<>) {
if ($state == $comment_mode)
{
- m!\s*//\s*(.*)!;
- print $1, "\n";
+ # in comment mode: first skip leading whitespace and
+ # comment // signs
+ s!\s*//\s*(.*)\n!$1!;
+
+ # second, replace section headers, and generate addressable
+ # anchor
+ if ( /\@sect/ ) {
+ s!\@sect(\d)\{(.*)\}\s*$!$2!g;
+ $sect_name = $2;
+ $sect_name =~ s/\s/_/g;
+ $_ = "\n" . $_;
+ }
+
+ # finally print this line
+ print $_, "\n";
+
+ # if empty line, introduce paragraph break
print "
\n\n" if $1 =~ m!^\s*$!;
}
else