-sub reformat($) {
- my $sig = shift;
-# LRC
-#$chunk=&chunksizealign($chunk,$len,$align);
- while ($sig =~ /\@(CENTER|RIGHT|LEFT)(\d+)?\@/) {
- }
+sub reformat ($) {
+ my $text = shift;
+ my ($ext,$end,$beg,$otag,$ctag,$stuff);
+ my $process = gen_extract_tagged('<(?:CENTER|RIGHT|LEFT)\d+>',
+ undef,
+ '(?s).*(?=<(?:CENTER|RIGHT|LEFT)\d+>)',
+ {reject => ['<(?:CENTER|RIGHT|LEFT)\d+>']} );
+ while (1) {
+ ($stuff, $end, $beg, $otag, $ext, $ctag) = &$process($text);
+ if (not defined $stuff) {
+ if ($text =~ /<(?:CENTER|RIGHT|LEFT)\d+>/) {
+ nicedie($@->{'error'});
+ }
+ }
+ last if !$stuff;