| 1 | #!/usr/local/bin/perl | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | # Dumb weave, just attach the titles. | ||
| 6 | |||
| 7 | my ($title); | ||
| 8 | while(<>) { | ||
| 9 | if (/^=begin +literate +\+?(\S.*?)\s*$/) { $title=$1 } | ||
| 10 | elsif(/^=for +literate +target:/) { 1 } | ||
| 11 | elsif(/^=for +literate +\.\s*$/) { 1 } | ||
| 12 | elsif(/^=for +literate +\+?(\S.*?)\s*$/) { $title=$1 } | ||
| 13 | elsif(/^=end +literate/) { 1 } | ||
| 14 | elsif(/^\s*$/) { print } | ||
| 15 | elsif($title&&/^(\s*)\S/) { print "$1< $title >=\n$_"; undef($title) } | ||
| 16 | else { print } | ||
| 17 | } | ||
| 18 |