1 | package CFPlus::Pod; |
1 | package CFPlus::Pod; |
2 | |
2 | |
3 | use strict; |
3 | use strict; |
|
|
4 | use utf8; |
4 | |
5 | |
5 | use Storable; |
6 | use Storable; |
6 | |
7 | |
7 | our $VERSION = 1; |
8 | our $VERSION = 1; |
8 | |
9 | |
|
|
10 | our $on_link = sub { }; |
9 | our %wiki; |
11 | our %wiki; |
10 | |
12 | |
11 | my $MA_BEG = "\x{fcd0}"; |
13 | my $MA_BEG = "\x{fcd0}"; |
12 | my $MA_SEP = "\x{fcd1}"; |
14 | my $MA_SEP = "\x{fcd1}"; |
13 | my $MA_END = "\x{fcd2}"; |
15 | my $MA_END = "\x{fcd2}"; |
… | |
… | |
96 | my ($par, $path) = @_; |
98 | my ($par, $path) = @_; |
97 | |
99 | |
98 | "<small>img</small>" |
100 | "<small>img</small>" |
99 | }, |
101 | }, |
100 | link => sub { |
102 | link => sub { |
101 | my ($par, $link) = @_; |
103 | my ($par, $text, $link) = @_; |
102 | |
104 | |
103 | "<big>" . (CFPlus::asxml $link) . "</big>" |
105 | "<span foreground='#ffff00'>↺</span><span foreground='#c0c0ff' underline='single'>" . (CFPlus::asxml $text) . "</span>" |
104 | }, |
106 | }, |
105 | ); |
107 | ); |
106 | |
108 | |
107 | sub as_label(@) { |
109 | sub as_label(@) { |
108 | thaw_section @_, %as_label; |
110 | thaw_section @_, %as_label; |
… | |
… | |
122 | image => sub { |
124 | image => sub { |
123 | my ($par, $path) = @_; |
125 | my ($par, $path) = @_; |
124 | |
126 | |
125 | push @{ $par->{widget} }, new CFPlus::UI::Image path => $path; |
127 | push @{ $par->{widget} }, new CFPlus::UI::Image path => $path; |
126 | |
128 | |
127 | "\x{FFFC}" |
129 | "\x{fffc}" |
128 | }, |
130 | }, |
129 | link => sub { |
131 | link => sub { |
130 | my ($par, $link) = @_; |
132 | my ($par, $text, $link) = @_; |
131 | |
133 | |
132 | "<big>" . (CFPlus::asxml $link) . "</big>" |
134 | push @{ $par->{widget} }, new CFPlus::UI::Label |
|
|
135 | markup => "<span foreground='#ffff00'>↺</span><span foreground='#c0c0ff' underline='single'>" . (CFPlus::asxml $text) . "</span>", |
|
|
136 | size => 0.8, |
|
|
137 | can_hover => 1, |
|
|
138 | can_events => 1, |
|
|
139 | padding_x => 0, |
|
|
140 | padding_y => 0, |
|
|
141 | on_button_up => sub { |
|
|
142 | $on_link->(split /\//, $link); |
|
|
143 | }; |
|
|
144 | |
|
|
145 | "\x{fffc}" |
133 | }, |
146 | }, |
134 | ); |
147 | ); |
135 | |
148 | |
136 | sub as_paragraphs(@) { |
149 | sub as_paragraphs(@) { |
137 | thaw_section @_, %as_paragraphs; |
150 | thaw_section @_, %as_paragraphs; |