File tree Expand file tree Collapse file tree 1 file changed +26
-7
lines changed Expand file tree Collapse file tree 1 file changed +26
-7
lines changed Original file line number Diff line number Diff line change 1616my $data = " " ;
1717my $line = " " ;
1818
19- foreach (@ARGV ) {
20- open (INPUT, " <$_ " );
19+ my $count = @ARGV ;
20+
21+ if ($count == 0) {
22+ # We're in "stdin mode"
23+
24+ # process stdin
25+ undef $/ ;
26+ my $data .= <>;
27+
28+ mergeLines($data );
29+ } else {
30+ foreach (@ARGV ) {
31+ open (INPUT, " <$_ " );
32+ local $/ ;
33+ my $data = <INPUT>;
34+ close (INPUT);
35+ mergeLines($data );
36+ }
37+ }
38+
2139
22- while ($line = <INPUT>) {
40+ sub mergeLines {
41+ my $file = shift ;
42+
43+ while ($file =~ / ^(.*?)$ /mg ) {
44+ $line = $1 ;
2345 if (($line !~ / ^\s *$ / ) && ($line !~ / ^\# / )) {
2446 $line =~ s / {4}/ \t / g ;
2547 $line =~ s /\s *$// ;
3961 }
4062 }
4163
42- close INPUT ;
64+ print $data ;
4365}
4466
45- print $data ;
46-
47-
4867=head1 NAME
4968
5069mmd_merge.pl - Combine text documents to create a MultiMarkdown structured
You can’t perform that action at this time.
0 commit comments