use strict; package SuikaWiki::Plugin::Registry; our %Info; $Info{q#Calender#}->{Name} = q#Calender#; $Info{q#Calender#}->{q#Version#} = q#2004.0831.0328#; $Info{q#Calender#}->{q#InterfaceVersion#} = q#2.9.1#; $Info{q#Calender#}->{q#mkpluginVersion#} = q#2.1.19#; $Info{q#Calender#}->{q#module_name#} = q#SuikaWiki::Plugin::plugin::Calender1040731032806j8zY#; $Info{q#Calender#}->{q#Date.RCS#} = q#$Date: 2010/05/16 23:05:49 $#; $Info{q#Calender#}->{RequiredPlugin} = [q#Phrase#, q#WikiResource#, q#WikiStructure#, q#WikiLinking#]; $Info{q#Calender#}->{Description} = [[q#Calender#, q#en#, q##]]; $Info{q#Calender#}->{License} = [[q#%%Perl%%#, q##, q##]]; $Info{q#Calender#}->{Author} = [[[[q#Wakaba#, q#ja#, q#Latn#]], [[q#w@suika.fam.cx#]], [q##]]]; package SuikaWiki::Plugin::plugin::Calender1040731032806j8zY; #line 1 "(WikiPlugin module source calender.wp2, block Plugin/Use)" my $WIKILINKING; my $WIKIRESOURCE; #line 1 "(WikiPlugin module Calender, chunk 1)" {my $def = {q#Parameter#, {q#page#, {q#Type#, q#WikiName#, q#Default#, q#(auto)#, q#Description#, [[q#WikiPage to be tested#, q##, q##]]}, q#false#, {q#Type#, q#CDATA#, q#Default#, q#(none)#, q#Description#, [[q#Template to be evaluated when it is part of calender#, q#en#, q##]]}, q#month#, {q#Type#, q#CDATA#, q#Default#, q#(none)#, q#Description#, [[q#Template to be evaluated when it is part of calender and has "month" part. This template will not be used if "day" template is used.#, q#en#, q##]]}, q#day#, {q#Type#, q#CDATA#, q#Default#, q#(none)#, q#Description#, [[q#Template to be evaluated when it is part of calender and has "day" information.#, q#en#, q##]]}, q#true#, {q#Type#, q#CDATA#, q#Default#, q#(none)#, q#Description#, [[q#Template to be evaluated when it is part of calender. This template will not be used if "year", "month" or "day" template is used.#, q#en#, q##]]}, q#year#, {q#Type#, q#CDATA#, q#Default#, q#(none)#, q#Description#, [[q#Template to be evaluated when it is part of calender. This template will not be used if "month" or "day" template is used.#, q##, q##]]}}, q#Description#, [[q#Test whether the WikiPage is part of calender or not#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source calender.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/if_calender']/Formatting)" my $page = $o->{wiki}->name ($p->{page} or $o->{wiki}->{var}->{page}); my $date = SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->wikiname_to_date (name => $page, o => $o); if ($date->{year}) { if ($date->{day} and $p->{day}) { $f->parse_attr ($p=>q#day#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt); } elsif ($date->{month} and $p->{month}) { $f->parse_attr ($p=>q#month#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt); } elsif ($p->{year}) { $f->parse_attr ($p=>q#year#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt); } else { $f->parse_attr ($p=>q#true#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt); } } else { $f->parse_attr ($p=>q#false#, $o, -parent => $p->{-parent}, -non_parsed_to_node => 1, %opt); }}} #line 1 "(WikiPlugin module Calender, chunk 2)" ; $SuikaWiki::Plugin::Rule{view}->{if_calender} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{if_calender} = $def; $SuikaWiki::Plugin::Rule{form_input}->{if_calender} = $def; }; {my $def = {q#Parameter#, {q#month#, {q#Type#, q#<<1*2DIGIT>>#, q#Default#, q#(auto)#, q#Description#, [[q#Month#, q#en#, q##]]}, q#label#, {q#Type#, q#template#, q#Default#, q#(auto)#, q#Description#, [[q#Template to be used to construct day item#, q#en#, q##]]}, q#year#, {q#Type#, q#<<4*DIGIT>>#, q#Default#, q#(auto)#, q#Description#, [[q#Year#, q#en#, q##]]}}, q#Description#, [[q#List of months in the year#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source calender.wp2, block FormattingRule[name()='[q#form-input#, q#view#, q#view-resource#]/calender']/Formatting)" require Time::Local; my $date = SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->wikiname_to_date (name => $o->{wiki}->name ($p->{page} || $o->{wiki}->{var}->{page}), o => $o); my $year = $p->{year} || $date->{year} || (gmtime)[5] + 1900; my $month = $p->{month} || $date->{month} || (gmtime)[4] + 1; my $dow = 0; eval q{$dow = (gmtime (Time::Local::timegm_nocheck (0,0,0,1, $month-1, $year)))[6]}; my $lom = 0; eval {$lom = (gmtime (Time::Local::timegm_nocheck (0,0,0,0, $month==12?0:$month, $year)))[3]}; my $tbl = $p->{-parent}->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'table'); $tbl->set_attribute (class => 'calender'); $tbl->set_attribute (summary => ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op ('Calender:Table:Summary', $o) ->inner_text); $p->{q#nocaption#} = do { my $r = $f->parse_attr ($p=>q#nocaption#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; unless ($p->{nocaption}) { my $caption = $tbl->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'caption'); local $o->{link}->{option} = {-cal__year => $year, -cal__month => $month}; if ($p->{caption}) { $f->parse_attr ($p=>q#caption#, $o, -parent => $caption, -non_parsed_to_node => 1, %opt); } else { ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op ('Calender:Table:Caption', $o, $caption); } } my @dayname = qw(sun mon tue wed thu fri sat); for (@dayname) { $tbl->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'col') ->set_attribute (class => $_); } $p->{q#noheader#} = do { my $r = $f->parse_attr ($p=>q#noheader#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; unless ($p->{noheader}) { my @wname = map {($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get_op ('Calender:Weekday:Label:'.$_, $o)} @dayname; my $row = $tbl->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'thead') ->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'tr'); for my $i (0..6) { my $cell = $row->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'th'); $cell->set_attribute (class => $dayname[$i]); $cell->set_attribute (scope => 'col'); $cell->append_node ($wname[$i]); } } my $tb = $tbl->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'tbody'); my $e_week; unless ($dow == 0) { ## 1st day is not sunday $e_week = $tb->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'tr'); for (1..$dow) { $e_week->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'td'); } } $p->{q#day_label#} = do { my $r = $f->parse_attr ($p=>q#day_label#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; my $label = $p->{day_label} || ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'Calender:Day:Label', o => $o, wiki => $o->{wiki}); $p->{q#mode#} = do { my $r = $f->parse_attr ($p=>q#mode#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; for my $day (1..$lom) { $e_week = $tb->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'tr') if $dow == 0; ## New week my $e_day = $e_week->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'td'); $e_day->set_attribute (class => $dayname[$dow]); ($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))->to_wikipage_in_html ({ label => $label, } => { base => $o->{wiki}->{var}->{page}, page_name_relative => SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->date_to_wikiname (year => $year, month => $month, day => $day, base => $date->{base}, o => $o), wiki_mode => $p->{mode}, }, { o => $o, parent => $e_day, -cal__year => $year, -cal__month => $month, -cal__day => $day, }); $dow++; $dow = 0 if $dow == 7; }}} #line 1 "(WikiPlugin module Calender, chunk 4)" ; $SuikaWiki::Plugin::Rule{form_input}->{calender} = $def; $SuikaWiki::Plugin::Rule{view}->{calender} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{calender} = $def; }; {my $def = {q#Parameter#, {q#label#, {q#Type#, q#template#, q#Default#, q#(auto)#, q#Description#, [[q#Template to be used to construct month item#, q#en#, q##]]}, q#year#, {q#Type#, q#<<4*DIGIT>>#, q#Default#, q#(auto)#, q#Description#, [[q#Year#, q#en#, q##]]}}, q#Description#, [[q#List of months in the year#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source calender.wp2, block FormattingRule[name()='[q#form-input#, q#view#, q#view-resource#]/calender_months']/Formatting)" $p->{q#year#} = do { my $r = $f->parse_attr ($p=>q#year#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; my $date = SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->wikiname_to_date (name => $o->{wiki}->name ($p->{page} || $o->{wiki}->{var}->{page}), o => $o); my $year = $p->{year} || $date->{year} || (gmtime)[5] + 1900; my $list = $p->{-parent}->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'ol'); $list->set_attribute (class => 'calender year'); $p->{q#label#} = do { my $r = $f->parse_attr ($p=>q#label#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; my $label = $p->{label} || ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'Calender:MonthList:Item', wiki => $o->{wiki}, o => $o); for (1..12) { ($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))->to_wikipage_in_html ({ label => $label, } => { base => $o->{wiki}->{var}->{page}, page_name_relative => SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->date_to_wikiname (year => $year, month => $_, base => $date->{base}, o => $o), }, { o => $o, parent => $list->append_new_node (type => '#element', namespace_uri => q#http://www.w3.org/1999/xhtml#, local_name => 'li'), -cal__year => $year, -cal__month => $_, }); $list->append_text ("\n"); }}} #line 1 "(WikiPlugin module Calender, chunk 6)" ; $SuikaWiki::Plugin::Rule{form_input}->{calender_months} = $def; $SuikaWiki::Plugin::Rule{view}->{calender_months} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{calender_months} = $def; }; {my $def = {q#Parameter#, {}, q#Description#, [[q#Year number#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source calender.wp2, block FormattingRule[name()='[q#page-link#, q#view-resource#]/calender__year']/Formatting)" $p->{-parent}->append_text ($o->{link}->{option}->{-cal__year} + 0);}} #line 1 "(WikiPlugin module Calender, chunk 8)" ; $SuikaWiki::Plugin::Rule{page_link}->{calender__year} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{calender__year} = $def; }; {my $def = {q#Parameter#, {}, q#Description#, [[q#Month number#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source calender.wp2, block FormattingRule[name()='[q#page-link#, q#view-resource#]/calender__month']/Formatting)" $p->{-parent}->append_text ($o->{link}->{option}->{-cal__month} + 0);}} #line 1 "(WikiPlugin module Calender, chunk 10)" ; $SuikaWiki::Plugin::Rule{page_link}->{calender__month} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{calender__month} = $def; }; {my $def = {q#Parameter#, {}, q#Description#, [[q#Day number#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source calender.wp2, block FormattingRule[name()='[q#page-link#, q#view-resource#]/calender__day']/Formatting)" $p->{-parent}->append_text ($o->{link}->{option}->{-cal__day} + 0);}} #line 1 "(WikiPlugin module Calender, chunk 12)" ; $SuikaWiki::Plugin::Rule{page_link}->{calender__day} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{calender__day} = $def; }; {my $def = {q#Parameter#, {q#page#, {q#Type#, q#WikiName#, q#Default#, q#(auto)#, q#Description#, [[q#Some WikiPage in calender#, q#en#, q##]]}, q#year#, {q#Type#, q#<<4*DIGIT>>#, q#Default#, q#(auto)#, q#Description#, [[q#Year number#, q#en#, q##]]}}, q#Description#, [[q#Year WikiPage name#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source calender.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/cal__year_page']/Formatting)" my $page = $o->{wiki}->name ($p->{page} or $o->{wiki}->{var}->{page}); my $date = SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->wikiname_to_date (name => $page, o => $o); $p->{-parent}->append_text (SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->date_to_wikiname (base => $date->{base}, year => $date->{year} || (gmtime)[5] + 1900, o => $o)->stringify (wiki => $o->{wiki}));}} #line 1 "(WikiPlugin module Calender, chunk 14)" ; $SuikaWiki::Plugin::Rule{view}->{cal__year_page} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{cal__year_page} = $def; $SuikaWiki::Plugin::Rule{form_input}->{cal__year_page} = $def; }; {my $def = {q#Parameter#, {q#page#, {q#Type#, q#WikiName#, q#Default#, q#(auto)#, q#Description#, [[q#Some WikiPage in calender#, q#en#, q##]]}, q#month#, {q#Type#, q#<<1*2DIGIT>>#, q#Default#, q#(auto)#, q#Description#, [[q#Month number#, q#en#, q##]]}, q#year#, {q#Type#, q#<<4*DIGIT>>#, q#Default#, q#(auto)#, q#Description#, [[q#Year number#, q#en#, q##]]}}, q#Description#, [[q#Year-month WikiPage name#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source calender.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/cal__month_page']/Formatting)" my $page = $o->{wiki}->name ($p->{page} or $o->{wiki}->{var}->{page}); my $date = SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->wikiname_to_date (name => $page, o => $o); $p->{-parent}->append_text (SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->date_to_wikiname (base => $date->{base}, year => $p->{year} || $date->{year} || (gmtime)[5] + 1900, month => $p->{month} || $date->{month} || (gmtime)[4] + 1, o => $o)->stringify (wiki => $o->{wiki}));}} #line 1 "(WikiPlugin module Calender, chunk 16)" ; $SuikaWiki::Plugin::Rule{view}->{cal__month_page} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{cal__month_page} = $def; $SuikaWiki::Plugin::Rule{form_input}->{cal__month_page} = $def; }; {my $def = {q#Parameter#, {q#page#, {q#Type#, q#WikiName#, q#Default#, q#(auto)#, q#Description#, [[q#Some WikiPage in calender#, q#en#, q##]]}, q#month#, {q#Type#, q#<<1*2DIGIT>>#, q#Default#, q#(auto)#, q#Description#, [[q#Month number#, q#en#, q##]]}, q#day#, {q#Type#, q#<<1*2DIGIT>>#, q#Default#, q#(auto)#, q#Description#, [[q#Day number#, q#en#, q##]]}, q#year#, {q#Type#, q#<<4*DIGIT>>#, q#Default#, q#(auto)#, q#Description#, [[q#Year number#, q#en#, q##]]}}, q#Description#, [[q#Year-month-day WikiPage name#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source calender.wp2, block FormattingRule[name()='[q#view#, q#view-resource#, q#form-input#]/cal__day_page']/Formatting)" my $page = $o->{wiki}->name ($p->{page} or $o->{wiki}->{var}->{page}); my $date = SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->wikiname_to_date (name => $page, o => $o); $p->{-parent}->append_text (SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->date_to_wikiname (base => $date->{base}, year => $p->{year} || $date->{year} || (gmtime)[5] + 1900, month => $p->{month} || $date->{month} || (gmtime)[4] + 1, day => $p->{day} || $date->{day} || (gmtime)[3], o => $o)->stringify (wiki => $o->{wiki}));}} #line 1 "(WikiPlugin module Calender, chunk 18)" ; $SuikaWiki::Plugin::Rule{view}->{cal__day_page} = $def; $SuikaWiki::Plugin::Rule{view_resource}->{cal__day_page} = $def; $SuikaWiki::Plugin::Rule{form_input}->{cal__day_page} = $def; }; $SuikaWiki::Plugin::Rule{view}->{link_calender_date} = {q#Parameter#, {}, q#Description#, [[q#Link to previous/next calender WikiPage#, q#en#, q##]], q#main#, sub {my ($f, $rule_name, $p, $o, %opt) = @_; #line 1 "(WikiPlugin module source calender.wp2, block FormattingRule[name()='[q#view#]/link_calender_date']/Formatting)" my $page = $o->{wiki}->name ($p->{page} or $o->{wiki}->{var}->{page}); my $date = SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->wikiname_to_date (name => $page, o => $o); my $year = $p->{year} || $date->{year} || return; my $month = $p->{month} || $date->{month}; my $day = $p->{day} || $date->{day}; my ($Year, $Month, $Day) = (0, 0, 0); my ($yeaR, $montH, $daY) = (0, 0, 0); my %page; if ($day) { ## 2003-04-01 require Time::Local; (undef, undef, undef, $Day, $Month, $Year) = gmtime (Time::Local::timegm_nocheck (0,0,0,$day, $month - 1, $year) - 24 * 3600); $Month++; $Year += 1900; $page{prev} = {year => $Year, month => $Month, day => $Day}; (undef, undef, undef, $daY, $montH, $yeaR) = gmtime (Time::Local::timegm_nocheck (0,0,0,$day, $month - 1, $year) + 25 * 3600); $montH++; $yeaR += 1900; $page{next} = {year => $yeaR, month => $montH, day => $daY}; $page{up} = {year => $year, month => $month}; (undef, undef, undef, $Day, $Month, $Year) = gmtime (Time::Local::timegm_nocheck (0,0,0,$day, $month - 1, $year) - 7 * 24 * 3600); $Month++; $Year += 1900; $page{'prev-week'} = {year => $Year, month => $Month, day => $Day}; (undef, undef, undef, $daY, $montH, $yeaR) = gmtime (Time::Local::timegm_nocheck (0,0,0,$day, $month - 1, $year) + 7 * 25 * 3600); $montH++; $yeaR += 1900; $page{'next-week'} = {year => $yeaR, month => $montH, day => $daY}; } elsif ($month) { ## 2003-04 ($Year, $Month) = ($year, $month - 1); ($Month = 12, $Year--) if $Month == 0; $page{prev} = {year => $Year, month => $Month}; ($yeaR, $montH) = ($year, $month + 1); ($montH = 1, $yeaR++) if $montH == 13; $page{next} = {year => $yeaR, month => $montH}; $page{up} = {year => $year}; } else { ## 2003 $Year = $year - 1; $page{prev} = {year => $Year}; $yeaR = $year + 1; $page{next} = {year => $yeaR}; } my @gmtime = gmtime; $page{today} = {year => $gmtime[5] + 1900, month => $gmtime[4] + 1, day => $gmtime[3]}; $p->{q#mode#} = do { my $r = $f->parse_attr ($p=>q#mode#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r};$p->{q#with_lm#} = do { my $r = $f->parse_attr ($p=>q#with_lm#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r};$p->{q#up_to_date#} = do { my $r = $f->parse_attr ($p=>q#up_to_date#, $o, -non_parsed_to_node => 1, %opt); ref $r?$r->inner_text:$r}; for my $rel (qw/prev next up prev-week next-week today/) { next unless $page{$rel}; ($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))->to_wikipage_in_html ({ label => qq(%html-link;\n), -ht__alt_description => ($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))->get (name => 'Calender:Link:'.$rel .($page{$rel}->{day}?':ymd': $page{$rel}->{month}?':ym':':y') .':Description', o => $o, wiki => $o->{wiki}), } => { base => $page, page_name_relative => SuikaWiki::Plugin::plugin::Calender1040731032806j8zY->date_to_wikiname (base => $date->{base}, o => $o, %{$page{$rel}}), wiki_mode => $p->{mode}, _with_lm => $p->{with_lm}, _up_to_date => $p->{up_to_date}, }, { o => $o, parent => $p->{-parent}, -rel => $rel, -cal__year => $page{$rel}->{year}, -cal__month => $page{$rel}->{month}, -cal__day => $page{$rel}->{day}, }); }}} #line 1 "(WikiPlugin module Calender, chunk 20)" ; sub wikiname_to_date { #line 1 "(WikiPlugin module source calender.wp2, block Function[Name='wikiname_to_date']/Main)" my (undef, %opt) = @_; if ($opt{name}->[$#{$opt{name}}] =~ /^([0-9]{4,})(?:-([0-9][0-9])(?:-([0-9][0-9]))?)?$/) { {year => $1, month => $2, day => $3, base => $opt{o}->{wiki}->name ([@{$opt{name}}[0..$#{$opt{name}}-1]])}; } else { {base => $opt{name}}; } } #line 1 "(WikiPlugin module Calender, chunk 22)" sub date_to_wikiname { #line 1 "(WikiPlugin module source calender.wp2, block Function[Name='date_to_wikiname']/Main)" my (undef, %opt) = @_; my $date = sprintf '%04d', $opt{year}; if ($opt{month}) { $date .= sprintf '-%02d', $opt{month}; $date .= sprintf '-%02d', $opt{day} if $opt{day}; } my $clone = $opt{base}->clone; $clone->append_component ($date); $clone; } #line 1 "(WikiPlugin module Calender, chunk 23)" push @{$SuikaWiki::View::Implementation::TemplateFragment{q#wr__read_body#}}, { Main => q#%if-calender ( month => {%calender;}p, year => {%calender-months;}p, );#, Order => -10, Description => [[q#"Read" mode body -- Calender#, q#en#, q##]], }; push @{$SuikaWiki::View::Implementation::TemplateFragment{q#links#}}, { Main => q#%link-calender-date;#, Order => -100, Description => [[q#Link to previous/next WikiPage in calender#, q#en#, q##]], }; package SuikaWiki::Plugin::Resource; our $BaseResource; $BaseResource->{q#und#}->{q##}->{q#Calender:Day:Label#} = q#%link-to-it ( label => {%calender--day;}p, description=>{%page-name(absolute);; %if-linked-wikipage-exist( true=>{%page-headline;}, false=>{(%res(name=>{Link:toWikiPage:NotExist:Description});)}, );}p, class=>{%if-linked-wikipage-exist(false=>{not-exist});}p, );#; $BaseResource->{q#und#}->{q##}->{q#Calender:Link:prev:y:Description#} = q#%calender--year; (%page-name;)#; $BaseResource->{q#und#}->{q##}->{q#Calender:Link:next:y:Description#} = q#%calender--year; (%page-name;)#; $BaseResource->{q#und#}->{q##}->{q#Calender:Link:up:y:Description#} = q#%calender--year; (%page-name;)#; $BaseResource->{q#und#}->{q##}->{q#Calender:Link:prev:ym:Description#} = q#%calender--year;-%calender--month; (%page-name;)#; $BaseResource->{q#und#}->{q##}->{q#Calender:Link:next:ym:Description#} = q#%calender--year;-%calender--month; (%page-name;)#; $BaseResource->{q#und#}->{q##}->{q#Calender:Link:up:ym:Description#} = q#%calender--year;-%calender--month; (%page-name;)#; $BaseResource->{q#und#}->{q##}->{q#Calender:Link:prev:ymd:Description#} = q#%calender--year;-%calender--month;-%calender--day; (%page-name;)#; $BaseResource->{q#und#}->{q##}->{q#Calender:Link:next:ymd:Description#} = q#%calender--year;-%calender--month;-%calender--day; (%page-name;)#; $BaseResource->{q#und#}->{q##}->{q#Calender:Link:prev-week:ymd:Description#} = q#%calender--year;-%calender--month;-%calender--day; (%page-name;)#; $BaseResource->{q#und#}->{q##}->{q#Calender:Link:next-week:ymd:Description#} = q#%calender--year;-%calender--month;-%calender--day; (%page-name;)#; $BaseResource->{q#en#}->{q##}->{q#Calender:Link:today:ymd:Description#} = q#Today's WikiPage (%page-name;)#; $BaseResource->{q#und#}->{q##}->{q#Calender:MonthList:Item#} = q#%link-to-it ( label => {%calender--month;}p, description=>{%page-name(absolute);; %if-linked-wikipage-exist( true=>{%page-headline;}, false=>{(%res(name=>{Link:toWikiPage:NotExist:Description});)}, );}p, class=>{%if-linked-wikipage-exist(false=>{not-exist});}p, );#; $BaseResource->{q#und#}->{q##}->{q#Calender:Table:Caption#} = q#%link-to-wikipage ( label => {%percent;link-to-it (label => {%calender--year;});}p, page => {%cal--year-page;}p, rel => {up up}, );-%link-to-wikipage ( label => {%percent;link-to-it (label => {%calender--month;});}p, page => {%cal--month-page;}p, rel => {up}, );#; $BaseResource->{q#en#}->{q##}->{q#Calender:Table:Summary#} = q#A calender. Days are listed with columns assigned to days in week (i.e. Sunday, Monday, ..., and Saturday)#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Long:sun#} = q#Sunday#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Long:mon#} = q#Monday#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Long:tue#} = q#Tuesday#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Long:wed#} = q#Wednesday#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Long:thu#} = q#Thursday#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Long:fri#} = q#Friday#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Long:sat#} = q#Saturday#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Short:sun#} = q#Sun#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Short:mon#} = q#Mon#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Short:tue#} = q#Tue#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Short:wed#} = q#Wed#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Short:thu#} = q#Thu#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Short:fri#} = q#Fri#; $BaseResource->{q#en#}->{q##}->{q#Calender:Weekday:Short:sat#} = q#Sat#; $BaseResource->{q#und#}->{q##}->{q#Calender:Weekday:Label:sun#} = q#%abbr ( short => {%res (name => {Calender:Weekday:Short:sun});}p, long => {%res (name => {Calender:Weekday:Long:sun});}p, );#; $BaseResource->{q#und#}->{q##}->{q#Calender:Weekday:Label:mon#} = q#%abbr ( short => {%res (name => {Calender:Weekday:Short:mon});}p, long => {%res (name => {Calender:Weekday:Long:mon});}p, );#; $BaseResource->{q#und#}->{q##}->{q#Calender:Weekday:Label:tue#} = q#%abbr ( short => {%res (name => {Calender:Weekday:Short:tue});}p, long => {%res (name => {Calender:Weekday:Long:tue});}p, );#; $BaseResource->{q#und#}->{q##}->{q#Calender:Weekday:Label:wed#} = q#%abbr ( short => {%res (name => {Calender:Weekday:Short:wed});}p, long => {%res (name => {Calender:Weekday:Long:wed});}p, );#; $BaseResource->{q#und#}->{q##}->{q#Calender:Weekday:Label:thu#} = q#%abbr ( short => {%res (name => {Calender:Weekday:Short:thu});}p, long => {%res (name => {Calender:Weekday:Long:thu});}p, );#; $BaseResource->{q#und#}->{q##}->{q#Calender:Weekday:Label:fri#} = q#%abbr ( short => {%res (name => {Calender:Weekday:Short:fri});}p, long => {%res (name => {Calender:Weekday:Long:fri});}p, );#; $BaseResource->{q#und#}->{q##}->{q#Calender:Weekday:Label:sat#} = q#%abbr ( short => {%res (name => {Calender:Weekday:Short:sat});}p, long => {%res (name => {Calender:Weekday:Long:sat});}p, );#; package SuikaWiki::Plugin::Registry; $Info{q#Calender#}->{provide} = {q#rule#, {q#form_input#, [q#if_calender#, q#calender#, q#calender_months#, q#cal__year_page#, q#cal__month_page#, q#cal__day_page#], q#view#, [q#if_calender#, q#calender#, q#calender_months#, q#cal__year_page#, q#cal__month_page#, q#cal__day_page#, q#link_calender_date#], q#view_resource#, [q#if_calender#, q#calender#, q#calender_months#, q#calender__year#, q#calender__month#, q#calender__day#, q#cal__year_page#, q#cal__month_page#, q#cal__day_page#], q#page_link#, [q#calender__year#, q#calender__month#, q#calender__day#]}, q#viewfragment#, [{q#Name#, q#wr__read_body#}, {q#Name#, q#links#}]}; 1;