mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-01 23:45:53 +02:00
Improve emitj()
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5717 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
b522fb46a2
commit
03a4c6c322
@ -174,7 +174,7 @@ sub emit ( $ ) {
|
|||||||
print $object "$line\n";
|
print $object "$line\n";
|
||||||
$lastlineblank = ( substr( $line, -1, 1 ) eq "\n" );
|
$lastlineblank = ( substr( $line, -1, 1 ) eq "\n" );
|
||||||
} else {
|
} else {
|
||||||
print $object "\n" unless $lastlineblank;
|
print $object "\n" unless $lastlineblank;
|
||||||
$lastlineblank = 1;
|
$lastlineblank = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,7 +185,22 @@ sub emit ( $ ) {
|
|||||||
#
|
#
|
||||||
sub emitj {
|
sub emitj {
|
||||||
if ( $object ) {
|
if ( $object ) {
|
||||||
for ( @_ ) { emit $_ };
|
#
|
||||||
|
# 'compile' as opposed to 'check'
|
||||||
|
#
|
||||||
|
for ( @_ ) {
|
||||||
|
unless ( /^\s*$/ ) {
|
||||||
|
my $line = $_;
|
||||||
|
$line =~ s/^\n// if $lastlineblank;
|
||||||
|
$line =~ s/^/$indent/gm if $indent;
|
||||||
|
1 while $line =~ s/^ /\t/;
|
||||||
|
print $object "$line\n";
|
||||||
|
$lastlineblank = ( substr( $line, -1, 1 ) eq "\n" );
|
||||||
|
} else {
|
||||||
|
print $object "\n" unless $lastlineblank;
|
||||||
|
$lastlineblank = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user