25 |
default => 50, |
default => 50, |
26 |
); |
); |
27 |
|
|
28 |
sub as_markup { |
sub iterator { |
29 |
my ($self) = @_; |
my ($self,$coderef) = @_; |
30 |
|
|
|
# extract svk revision: r113@athlon (orig r999): dpavlin | 2005-09-01 20:38:07 +0200 |
|
|
my $svk_rev_re = '\s+(r\d+@\w+(\s+\(orig\s+r\d+\))*:\s+\w+\s+\|\s+\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\s+\+\d+)\s*'; |
|
|
|
|
|
sub encode { |
|
|
my $foo = shift; |
|
|
$foo =~ s/$svk_rev_re//gsm; |
|
|
$foo =~ s/</</g; |
|
|
$foo =~ s/>/>/g; |
|
|
$foo =~ s/"/"/g; |
|
|
$foo =~ s/([\n\r][\n\r]+)/<\/p>$1<p>/gis; |
|
|
$foo =~ s/([\n\r]+)([\-\*]\s+)/$1<br\/>$2/gis; |
|
|
$foo =~ s/([\n\r]+)(r\d+:\s+)/$1<br\/>$2/gis; |
|
|
$foo =~ s/([\n\r]+)(\s+r\d+@)/$1<br\/>$2/gis; # svk |
|
|
return $foo; |
|
|
} |
|
|
|
|
31 |
sub sh_regex($$) { |
sub sh_regex($$) { |
32 |
my ($cmd,$regex) = @_; |
my ($cmd,$regex) = @_; |
33 |
open(my $sh, $cmd . ' |') || die "sh_regex failed on $cmd: $!"; |
open(my $sh, $cmd . ' |') || die "sh_regex failed on $cmd: $!"; |
89 |
|
|
90 |
my $xml = XMLin($log, ForceArray => [ 'logentry', 'path' ]); |
my $xml = XMLin($log, ForceArray => [ 'logentry', 'path' ]); |
91 |
|
|
92 |
|
foreach my $e (@{$xml->{'logentry'}}) { |
93 |
|
warn "# e = ",$self->dump( $e ); |
94 |
|
$coderef->($e); |
95 |
|
} |
96 |
|
} |
97 |
|
|
98 |
|
sub as_markup { |
99 |
|
my ($self) = @_; |
100 |
|
|
101 |
|
# extract svk revision: r113@athlon (orig r999): dpavlin | 2005-09-01 20:38:07 +0200 |
102 |
|
our $svk_rev_re = '\s+(r\d+@\w+(\s+\(orig\s+r\d+\))*:\s+\w+\s+\|\s+\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\s+\+\d+)\s*'; |
103 |
|
|
104 |
|
sub encode { |
105 |
|
my $foo = shift; |
106 |
|
$foo =~ s/$svk_rev_re//gsm; |
107 |
|
$foo =~ s/</</g; |
108 |
|
$foo =~ s/>/>/g; |
109 |
|
$foo =~ s/"/"/g; |
110 |
|
$foo =~ s/([\n\r][\n\r]+)/<\/p>$1<p>/gis; |
111 |
|
$foo =~ s/([\n\r]+)([\-\*]\s+)/$1<br\/>$2/gis; |
112 |
|
$foo =~ s/([\n\r]+)(r\d+:\s+)/$1<br\/>$2/gis; |
113 |
|
$foo =~ s/([\n\r]+)(\s+r\d+@)/$1<br\/>$2/gis; # svk |
114 |
|
return $foo; |
115 |
|
} |
116 |
|
|
117 |
our $html = ''; |
our $html = ''; |
118 |
sub html { |
sub html { |
119 |
$html .= join("\n", @_); |
$html .= join("\n", @_); |
120 |
} |
} |
121 |
|
|
122 |
foreach my $e (@{$xml->{'logentry'}}) { |
$self->iterator( sub { |
123 |
|
my $e = shift; |
124 |
|
|
125 |
my $rev = $e->{'revision'}; |
my $rev = $e->{'revision'}; |
126 |
my $date = $e->{'date'}; |
my $date = $e->{'date'}; |
127 |
|
|
146 |
|
|
147 |
html '<blockquote><p><tt style="color:#808080">',join(", ",@files),':</tt> ',encode($e->{'msg'}),'</p></blockquote>'; |
html '<blockquote><p><tt style="color:#808080">',join(", ",@files),':</tt> ',encode($e->{'msg'}),'</p></blockquote>'; |
148 |
|
|
149 |
} |
}); |
150 |
|
|
151 |
return $html; |
return $html; |
152 |
} |
} |
153 |
|
|
154 |
|
sub codeswarm_as_markup { |
155 |
|
my ($self) = @_; |
156 |
|
|
157 |
|
$self->content_type('text/xml'); |
158 |
|
|
159 |
|
my $file_events = ''; |
160 |
|
|
161 |
|
$self->iterator( sub { |
162 |
|
my $e = shift; |
163 |
|
|
164 |
|
my $rev = $e->{'revision'}; |
165 |
|
my $date = $e->{'date'}; |
166 |
|
my $author = $e->{'author'}; |
167 |
|
|
168 |
|
foreach my $p (@{$e->{'paths'}->{'path'}}) { |
169 |
|
my ($action,$path) = ($p->{'action'},$p->{'content'}); |
170 |
|
$file_events .= qq|\t<event filename="$path" date="$date" author="$author" />\n|; |
171 |
|
} |
172 |
|
|
173 |
|
}); |
174 |
|
|
175 |
|
return qq|<?xml version="1.0"?> |
176 |
|
<!-- One commit per day for one month by a documenter and programmer. --> |
177 |
|
<file_events> |
178 |
|
$file_events |
179 |
|
</file_events> |
180 |
|
|; |
181 |
|
|
182 |
|
} |
183 |
|
|
184 |
1; |
1; |