@TOC=`cat $D/examples/$(@:.html=)/$(@:.html=.cc) \
| $(PERL) program2toc \
| $(PERL) -pi -e 's/\"/\\\"/g;'` ; \
+ plainTOC=`echo $$TOC | $(PERL) -pi -e 's/href=.../href=\\\"\#plain-/g;'` ; \
cat head.html \
| $(PERL) -pi -e '$$step="$@"; \
$$step=~s/step-(\d+).html/$$1/g; \
s/step xxx/step $$step/g;' \
- | $(PERL) -pi -e "s!TOC!$$TOC!g;" \
+ | $(PERL) -pi -e "s!commentedTOC!$$TOC!g;" \
+ | $(PERL) -pi -e "s!plainTOC!$$plainTOC!g;" \
> $@
@cat $(@:.html=.data/intro.html) >> $@
@cat $D/examples/$(@:.html=)/$(@:.html=.cc) \
<h2>Overview of step xxx</h2>
<ol>
- <li> <a href="#Intro">Introduction</a>
- <li> <a href="#CommProg">The commented program</a>
-TOC
- <li> <a href="#Results">Results</a>
- <li> <a href="#PlainProg">The plain program</a>
+ <li> <a href="#Intro" class=bold>Introduction</a>
+ <li> <a href="#CommProg" class=bold>The commented program</a>
+commentedTOC
+ <li> <a href="#Results" class=bold>Results</a>
+ <li> <a href="#PlainProg" class=bold>The plain program</a>
+plainTOC
</ol>
s/\t/ /g;
print " $_";
- }
+ } else {
+ # second, replace section headers, and generate addressable
+ # anchor
+ if ( /\@sect/ ) {
+ # replace quotation marks by the appropriate HTML quotation marks
+ s!``!“!g;
+ s!''!”!g;
+
+ # replace double dashes in comments by —
+ s!--!—!g;
+
+ m!\@sect(\d)\{(.*)\}\s*$!;
+ $sect_name = $2;
+ $sect_name =~ s/\s/_/g;
+ $_ = "\n<a name=\"plain-$sect_name\"></a>";
+ print;
+ }
+ }
} while (<>);
print "</code></pre>\n</p>\n\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