line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- cperl -*- |
2
|
|
|
|
|
|
|
# copyright (C) 2005 Topia . all rights reserved. |
3
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it |
4
|
|
|
|
|
|
|
# under the same terms as Perl itself. |
5
|
|
|
|
|
|
|
# $Id: ListDiary.pm 109 2005-02-05 10:40:18Z topia $ |
6
|
|
|
|
|
|
|
# $URL: file:///usr/minetools/svnroot/mixi/trunk/WWW-Mixi-OO/lib/WWW/Mixi/OO/ListDiary.pm $ |
7
|
|
|
|
|
|
|
package WWW::Mixi::OO::ListDiary; |
8
|
1
|
|
|
1
|
|
3813
|
use strict; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
47
|
|
9
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
28
|
|
10
|
1
|
|
|
1
|
|
5
|
use File::Basename; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
87
|
|
11
|
1
|
|
|
1
|
|
5
|
use base qw(WWW::Mixi::OO::TableHistoryListPage); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
95
|
|
12
|
1
|
|
|
1
|
|
5
|
use base qw(WWW::Mixi::OO::Util::EntryParserMixin); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
616
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub uri { |
15
|
0
|
|
|
0
|
1
|
|
my $this = shift; |
16
|
0
|
|
|
|
|
|
my $options = $this->_init_uri(@_); |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
$this->copy_hash_val($options, $options->{_params}, qw(year month)); |
19
|
0
|
|
|
|
|
|
$this->SUPER::uri($options); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub parse_uri { |
23
|
0
|
|
|
0
|
1
|
|
my ($this, $data, %options) = @_; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
$this->copy_hash_val($data->{params}, \%options, qw(year month)); |
26
|
0
|
|
|
|
|
|
$this->SUPER::parse_uri($data, %options); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _parse_table { |
30
|
0
|
|
|
0
|
|
|
my $this = shift; |
31
|
0
|
0
|
|
|
|
|
return $this->SUPER::_parse_table(@_) if @_ == 1; # overridable |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $attr_regex = $this->regex_parts->{html_attr}; |
34
|
0
|
|
|
|
|
|
my $attrval_regex = $this->regex_parts->{html_attrval}; |
35
|
0
|
|
|
|
|
|
my $maybe_attrs_regex = $this->regex_parts->{html_maybe_attrs}; |
36
|
0
|
|
|
|
|
|
$this->SUPER::_parse_table( |
37
|
|
|
|
|
|
|
qr|\s*\s* |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
((?>.*?(?>.*? | )\s* |
42
|
|
|
|
|
|
|
|oisx); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _split_tables { |
46
|
0
|
|
|
0
|
|
|
my ($this, $part) = @_; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $maybe_attrs_regex = $this->regex_parts->{html_maybe_attrs}; |
49
|
0
|
|
|
|
|
|
my @tables = $this->extract_balanced_html_parts( |
50
|
|
|
|
|
|
|
element => 'table', |
51
|
|
|
|
|
|
|
text => $part); |
52
|
0
|
|
|
|
|
|
$this->cache->{tables} = \@tables; |
53
|
0
|
|
|
|
|
|
$this->cache->{indecies}->{title} = 0; |
54
|
0
|
0
|
|
|
|
|
if (@tables > 2) { |
55
|
|
|
|
|
|
|
# remove no-need footer |
56
|
0
|
|
|
|
|
|
$this->cache->{indecies}->{navi} = 1; |
57
|
0
|
|
|
|
|
|
$this->cache->{indecies}->{body} = 2; |
58
|
|
|
|
|
|
|
} else { |
59
|
0
|
|
|
|
|
|
$this->cache->{indecies}->{body} = 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _parse_body { |
64
|
0
|
|
|
0
|
|
|
my $this = shift; |
65
|
0
|
|
|
|
|
|
my $part = $this->parse_table_item('body'); |
66
|
0
|
0
|
|
|
|
|
return () unless defined $part; |
67
|
0
|
|
|
|
|
|
my $maybe_attrs_regex = $this->regex_parts->{html_maybe_attrs}; |
68
|
0
|
|
|
|
|
|
my $attrval_regex = $this->regex_parts->{html_attrval}; |
69
|
0
|
|
|
|
|
|
my @parts = $this->extract_balanced_html_parts( |
70
|
|
|
|
|
|
|
element => 'tr', |
71
|
|
|
|
|
|
|
text => $part); |
72
|
0
|
|
|
|
|
|
my $sep = qr,\|,io; |
73
|
0
|
|
|
|
|
|
my ($title, $body, $control, $temp, $data); |
74
|
0
|
|
|
|
|
|
my @ret; |
75
|
0
|
|
|
|
|
|
while (@parts >= 3) { |
76
|
0
|
|
|
|
|
|
($title, $body, $control) = splice(@parts, 0, 3); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
next unless |
79
|
0
|
0
|
|
|
|
|
$control =~ m| | \s*
80
|
|
|
|
|
|
|
| (.*?)\s* |
81
|
|
|
|
|
|
|
$sep\s*(.*?) |
82
|
|
|
|
|
|
|
(?>.*? | ) |siox;
83
|
0
|
|
|
|
|
|
$temp = $this->html_anchor_to_uri($1); |
84
|
0
|
|
|
|
|
|
$data = { |
85
|
|
|
|
|
|
|
link => $temp, |
86
|
|
|
|
|
|
|
$this->analyze_uri($temp), |
87
|
|
|
|
|
|
|
}; |
88
|
0
|
0
|
|
|
|
|
if ($2 =~ /^.*\((\d+)\)\s*$/so) { |
89
|
0
|
|
|
|
|
|
$data->{count} = $1; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
next unless |
93
|
0
|
0
|
|
|
|
|
$title =~ m| | \s*
94
|
|
|
|
|
|
|
| (.*?)(?>.*? | )\s*
95
|
|
|
|
|
|
|
| (?>(.*?) | )\s*
96
|
|
|
|
|
|
|
| |siox;
97
|
0
|
|
|
|
|
|
$data->{subject} = $this->rewrite($2); |
98
|
0
|
|
|
|
|
|
$temp = $1; |
99
|
0
|
|
|
|
|
|
$temp =~ s| | |g; |
100
|
0
|
|
|
|
|
|
$data->{time} = $data->{date} = |
101
|
|
|
|
|
|
|
$this->convert_time($this->rewrite($temp)); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
next unless |
104
|
0
|
0
|
|
|
|
|
$body =~ m| | \s*\s* |
105
|
|
|
|
|
|
|
\s*\s*
106
|
|
|
|
|
|
|
| \s*(?>(.*?)\s* \s* | )\s*
107
|
|
|
|
|
|
|
| \s* \s* | \s* |siox;
108
|
0
|
|
|
|
|
|
$temp = $this->parse_entry($1); |
109
|
0
|
|
|
|
|
|
$this->copy_hash_val($temp, $data,[qw(body summary)], 'images'); |
110
|
|
|
|
|
|
|
#$data->{summary} = $1; |
111
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
push @ret, $data; |
113
|
|
|
|
|
|
|
} |
114
|
0
|
|
|
|
|
|
return \@ret; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |
|