From 4f0a27e7691bc2188b53bb8a9c7a7535fa1d55ed Mon Sep 17 00:00:00 2001 From: wolf Date: Wed, 21 Nov 2001 10:22:15 +0000 Subject: [PATCH] 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 --- .../chapter-2.step-by-step/program2html | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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 -- 2.39.5