- my $ent = $1;
- utf8::decode($ent);
- $ent = ascii_html($ent);
- my ($H, $ct, $an, $ae, $at, $s, $bdy) = split(/\n/, $ent, 7);
- undef $ent;
+ utf8::decode($bdy = $1);
+ if ($is_tag) {
+ my %r;
+ eval "$bdy";
+ for (qw(contents:subject contents:body)) {
+ $r{$_} =~ /\S/ or delete($r{$_})
+ }
+ $H = $r{objectname};
+ $s = $r{'contents:subject'} // $r{'*subject'};
+ $bdy = $r{'contents:body'} // $r{'*body'};
+ $s .= " ($r{'refname:short'})";
+ $_ = ascii_html($_) for ($s, $bdy, $r{creator});
+ ($an, $ae, $at) = split(/\s*&[gl]t;\s*/, $r{creator});
+ $at =~ s/ .*\z//; # no TZ
+ $ct = $at = strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($at));
+ } else {
+ $bdy = ascii_html($bdy);
+ ($H, $ct, $an, $ae, $at, $s, $bdy) =
+ split(/\n/, $bdy, 7);
+ $at = strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($at));
+ $ct = strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($ct));
+ }