| 1 | #!/usr/local/bin/perl | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | my ($title); | ||
| 5 | while(<>) { | ||
| 6 | while(/\bC<\s*D<([^>]+)>/) { | ||
| 7 | my $name=$1; $name=~s/^\s*//; $name=~s/\s*$//; | ||
| 8 | s/\bC<\s*D<[^>]+>\s*(=\s*)?/C<E<lt> $name E<gt>=/; | ||
| 9 | } | ||
| 10 | if(0) { 1 } | ||
| 11 | elsif(/^=for +literate:command +target=/) { 1 } | ||
| 12 | elsif(/^=for +literate +target:/) { 1 } # deprecated | ||
| 13 | elsif(/^=end\h+literate/) { undef($title) } | ||
| 14 | elsif(/^=for\h+literate\h+\.\h*$/) { undef($title) } | ||
| 15 | elsif(/^=begin\h+literate\h+\+?(\H.*?)\h*$/) { $title=$1 } | ||
| 16 | elsif(/^=for\h+literate\h+\+?(\H.*?)\h*$/) { $title=$1 } | ||
| 17 | elsif($title&&/^(\h*)\S/) { print "$1< $title >=\n$_"; undef($title) } | ||
| 18 | else { print } | ||
| 19 | } | ||
| 20 |