annotate interps/c-intercal/doc/fixtoc.pl @ 8497:2c419f225667
<izabera> ` echo \'for file do mapfile -t lines < "$file"; for (( i = ${#lines[@]} -1; i >= 0; i-- )) do printf "%s\\n" "${lines[i]}"; done done\' >> bin/tac
author |
HackBot |
date |
Thu, 16 Jun 2016 09:40:02 +0000 |
parents |
859f9b4339e6 |
children |
|
rev |
line source |
996
|
1 #!/bin/perl -w
|
|
2
|
|
3 # Deindent and delink part headings in the TOC, and remove the initial
|
|
4 # H2 entry.
|
|
5
|
|
6 my $f=1;
|
|
7
|
|
8 while(<>)
|
|
9 {
|
|
10 $f and /<ul>/ and do{$f=0; next;};
|
|
11 /^<li><a[^>]*>C-INTERCAL / and next;
|
|
12 s%^<li><a[^>]*>(PART .*?)</a>%</ul><h3>$1</h3><ul>%;
|
|
13 print;
|
|
14 last if $_ eq "</div>\n";
|
|
15 }
|
|
16 while(<>) {print;}
|