/[pub]/suikawiki/script/misc/plugins/link/map.wp2
Suika

Contents of /suikawiki/script/misc/plugins/link/map.wp2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (hide annotations) (download)
Sat Mar 20 04:08:11 2004 UTC (21 years, 3 months ago) by wakaba
Branch: MAIN
Changes since 1.10: +26 -21 lines
(FormattingRule[search--namazu]): Give both absolute and (possibily) relative URIs to WikiLinking function

1 wakaba 1.1 #?SuikaWikiConfig/2.0
2    
3     Plugin:
4     @Name: Map
5     @Description:
6     @@@:
7     Visualization of page to page relatinships
8     @@lang:en
9 wakaba 1.3 @License: %%Perl%%
10 wakaba 1.1 @Author:
11     @@Name:
12     @@@@: Wakaba
13     @@@lang:ja
14     @@@script:Latn
15     @@Mail[list]: w@suika.fam.cx
16 wakaba 1.2 @Date.RCS:
17 wakaba 1.11 $Date: 2004/03/19 03:42:06 $
18 wakaba 1.1 @RequiredPlugin[list]:
19     WikiLinking
20     @Use:
21     use Message::Util::Error;
22     my $WIKILINKING;
23     my $WIKIRESOURCE;
24    
25     PluginConst:
26     @NS_XHTML1:
27     http://www.w3.org/1999/xhtml
28     @NS_RDF:
29     http://www.w3.org/1999/02/22-rdf-syntax-ns#
30     @NS_RSS:
31     http://purl.org/rss/1.0/
32     @NS_DC:
33     http://purl.org/dc/elements/1.1/
34     @NS_MAP:
35     http://members.jcom.home.ne.jp/jintrick/2003/02/site-concept.xml#
36     @WIKILINKING:
37     {($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))}
38     @WIKIRESOURCE:
39     {($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))}
40    
41     FormattingRule:
42     @Category[list]:
43     form-input
44     view
45     view-resource
46     @Name: recent-change-list
47     @Description:
48     @@@: Recently changed WikiPage list
49     @@lang: en
50     @Parameter:
51     @@Name: ns
52     @@Type: WikiName
53     @@Default: (auto)
54     @@Description:
55     @@@@:
56     WikiNamespace name to which listed WikiPages belong
57     @@@lang: en
58     @Formatting:
59     my $list = $p->{-parent}->append_new_node
60     (type => '#element',
61     namespace_uri => $NS_XHTML1,
62     local_name => 'ol');
63     $list->set_attribute (class => 'm--recent-changes');
64    
65     __ATTRTEXT:%ns__;__ATTRTEXT:%recursive__;
66     __ATTRTEXT:%n__;
67     $p->{recursive} = 1 unless length $p->{recursive};
68 wakaba 1.2 my $ns = $o->{wiki}->name ($p->{ns});
69     #$ns->append_component ('') unless $ns->[$#$ns] eq '';
70 wakaba 1.1 my $i = 0;
71     $p->{n} ||= 10;
72     __ATTRTEXT:%template__;
73     $p->{template} ||= $WIKIRESOURCE->get
74     (name => 'Link:toWikiPage:SourceLabelLong:RecentChangeItem',
75     wiki => $o->{wiki}, o => $o);
76     __ATTRTEXT:%mode__;
77     for (sort {$b->[1] <=> $a->[1]}
78     map { try { [$_, $o->{wiki}->{db}->get (lastmodified => $_)] }
79 wakaba 1.4 catch SuikaWiki::DB::Util::Error with {
80     my $err = shift;
81     $err->throw if $err->{-type} eq 'ERROR_REPORTED';
82     [$_, undef]} }
83 wakaba 1.1 $o->{wiki}->{db}->keys ('content',
84 wakaba 1.2 -ns => $ns,
85 wakaba 1.1 -type => 'key',
86     -recursive => $p->{recursive})) {
87     next unless $_->[0];
88     last if $i++ == $p->{n};
89    
90     $WIKILINKING->to_wikipage_in_html ({
91     label => $p->{template},
92     } => {
93 wakaba 1.2 base => $o->{wiki}->{var}->{page},
94     page_name_relative => $o->{wiki}->name ($_->[0]),
95 wakaba 1.1 wiki_mode => $p->{mode},
96     _with_lm => 1,
97     page_lastmodified => $_->[1],
98     }, {
99     o => $o,
100 wakaba 1.5 parent => $list->append_new_node
101     (type => '#element',
102     namespace_uri => $NS_XHTML1,
103     local_name => 'li'),
104 wakaba 1.1 });
105     }
106    
107     FormattingRule:
108     @Category[list]:
109     form-input
110     view
111     view-resource
112     @Name: page-list
113     @Description:
114     @@@: WikiPage list
115     @@lang: en
116     @Parameter:
117     @@Name: ns
118     @@Type: WikiName
119     @@Default: (auto)
120     @@Description:
121     @@@@:
122     WikiNamespace name to which listed WikiPages belong
123     @@@lang: en
124     @Formatting:
125     my $list = $p->{-parent}->append_new_node
126     (type => '#element',
127     namespace_uri => $NS_XHTML1,
128     local_name => 'ul');
129    
130     __ATTRTEXT:%ns__;__ATTRTEXT:%recursive__;
131     __ATTRTEXT:%n__;
132     $p->{recursive} = 1 unless length $p->{recursive};
133 wakaba 1.2 my $ns = $o->{wiki}->name ($p->{ns});
134     #$ns->append_component ('') unless $ns->[$#$ns] eq '';
135 wakaba 1.1 my $i = 0;
136     $p->{n} ||= -1;
137     __ATTRTEXT:%template__;
138     $p->{template} ||= $WIKIRESOURCE->get
139     (name => 'Link:toWikiPage:SourceLabelLong:PageList',
140     wiki => $o->{wiki}, o => $o);
141 wakaba 1.3 __ATTRTEXT:%match__; ## WARNING: This parameter might be dangerous!
142     my $reg = $p->{match} ? qr/$p->{match}/ : qr/./;
143 wakaba 1.1 __ATTRTEXT:%mode__;
144     try {
145     for (sort {$a->[1] cmp $b->[1]}
146 wakaba 1.3 grep {$_->[1] =~ /$reg/}
147 wakaba 1.2 map {[$_, join '//', @{$_}]} # make sort key
148 wakaba 1.1 $o->{wiki}->{db}->keys ('content',
149 wakaba 1.2 -ns => $ns,
150 wakaba 1.1 -type => 'key',
151     -recursive => $p->{recursive})) {
152     last if $i++ == $p->{n};
153    
154     $WIKILINKING->to_wikipage_in_html ({
155     label => $p->{template},
156     } => {
157 wakaba 1.2 base => $o->{wiki}->{var}->{page},
158     page_name_relative => $o->{wiki}->name ($_->[0]),
159 wakaba 1.1 wiki_mode => $p->{mode},
160     }, {
161     o => $o,
162 wakaba 1.5 parent => $list->append_new_node
163     (type => '#element',
164     namespace_uri => $NS_XHTML1,
165     local_name => 'li'),
166 wakaba 1.1 });
167     }
168     } catch SuikaWiki::DB::Util::Error with {
169 wakaba 1.4 my $err = shift;
170     $err->throw if $err->{-type} eq 'ERROR_REPORTED';
171 wakaba 1.1 };
172     $p->{-parent}->remove_child_node ($list) unless $list->count;
173    
174     FormattingRule:
175     @Category[list]:
176     page-link
177     @Name: m--link-weight
178     @Formatting:
179     $p->{-parent}->append_text ($o->{link}->{option}->{-m__weight}+0);
180    
181     ViewFragment:
182     @Name: ws--post-content
183     @Description:
184 wakaba 1.6 @@@: After content body -- children and backward links
185 wakaba 1.1 @@lang:en
186     @Order: 100
187     @Formatting:
188     %section (
189     id => children,
190     title => {%res(name=>{Children:Title});}p, heading,
191     content => {%page-list (
192     ns => {%page-name;}p, recursive => 0,
193     type => both,
194     template => {%resource-as-plain-text (name => {Children:Item});}p,
195     );}p,
196     );
197    
198 wakaba 1.7 ## TODO: Make recent-changes page name customizable
199 wakaba 1.1 ViewFragment:
200     @Name: navbar
201     @Order: 21
202     @Formatting:
203     %link-to-wikipage (
204     page => {RecentChanges},
205     label => {%link-to-it (
206 wakaba 1.7 label => {%res (name => GoToRecentChanges);}p,
207     description => {%res (name => GoToRecentChangesLong);}p,
208 wakaba 1.1 );},
209     rel => news,
210     );
211    
212     ## TODO:
213     ViewFragment:
214     @Name: links
215     @Formatting:
216     %link-to-wikipage (
217     page => {RecentChanges},
218     rel => news,
219     label => {%html-link (
220     description => {%res(name=>GoToRecentChangesLink);}p,
221     );},
222 wakaba 1.7 );
223    
224     Resource:
225 wakaba 1.11 @Children:Title:
226     %link-to-it(label=>{%ns-short-page-name;}p,
227     description=>{%page-name(absolute);}p,
228     );
229     %span(class=>headline, content=>{%page-headline;}p);
230     @Link:toWikiPage:SourceLabelLong:PageList:
231     %link-to-it(
232     label=>{%page-title(relative);}p,
233     description=>{%page-name(absolute);}p,
234     );
235     %span(class=>headline,content=>{%page-headline;}p);
236     @Link:toWikiPage:SourceLabelLong:RecentChangeItem:
237     %last-modified;
238     %link-to-it(
239     label=>{%page-title(relative);}p,
240     description=>{%page-name(absolute);}p,
241     );
242     %span(class=>headline,content=>{%page-headline;}p);
243     @Link:toWikiPage:SourceLabelLong:SearchResult:
244     {%m--link-weight;}
245     %link-to-it(
246     label=>{%page-title(relative);}p,
247     description=>{%page-name(absolute);}p,
248     );
249     %span(class=>headline,content=>{%page-headline;}p);
250 wakaba 1.7 @GoToRecentChanges:
251     @@@: Recent
252     @@lang: en
253     @GoToRecentChangesLink:
254     @@@: Recently modified WikiPages list
255     @@lang: en
256     @GoToRecentChangesLong:
257     @@@: Review recently modified WikiPages list
258     @@lang: en

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24