/[pub]/suikawiki/script/misc/plugins/Versions.wps
Suika

Contents of /suikawiki/script/misc/plugins/Versions.wps

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Sat Feb 14 10:53:48 2004 UTC (21 years, 2 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -0 lines
FILE REMOVED
Removed

1 wakaba 1.1 Name:
2     Versions
3     FullName:
4     SuikaWiki: cooperation with version control systems
5     URI:
6     IW:SuikaWiki:SuikaWiki
7    
8     {
9     Name:
10     wikiview/link-viewcvs
11     FullName:
12     LINK element referring ViewCVS page of the wiki page
13     Format:
14 wakaba 1.2 my $ename = $p->{page} || $o->{page};
15     $ename =~ s/(.)/sprintf '%%%02X', ord $1/ges;
16     $ename =~ s!%2F%2F!.ns/!g; $ename =~ tr/%//d;
17     $p->{href} .= $ename . ($p->{suffix} || '.txt');
18 wakaba 1.1 $r = qq(<link);
19     for my $attr (qw/rel rev href class type hreflang charset/) {
20     $r .= qq( $attr="@{[$o->escape($p->{$attr})]}") if $p->{$attr};
21     }
22     for my $attr (qw/title/) {
23     $r .= qq( $attr="@{[$o->formatter('view')->replace($p->{$attr},$o)]}") if $p->{$attr};
24     }
25 wakaba 1.2 $r .= ' />';
26 wakaba 1.1 }
27    
28     {
29     Name:
30     wikiview/diff-between-previous
31     FullName:
32     Difference between previous version of this WikiPage
33     Format:
34     $r = qq(<pre class="diff">);
35     for (split /\n/, $o->escape ($o->database->traverse_diff ($o->{page}))) {
36     if (/^\+(.*)/) {
37     $r .= qq(<ins class="added">$1</ins>\n);
38     } elsif (/^\-(.*)/) {
39     $r .= qq(<del class="deleted">$1</del>\n);
40     } elsif (/^\=(.*)/) {
41     $r .= qq(<span class="same">$1</span>\n);
42     } else {
43     $r .= qq|??? $_\n|;
44     }
45     }
46     $r .= qq(</pre>);
47     }
48    
49     MODULE:
50     SuikaWiki::View->definition ('diff')->properties (
51     {media => {type => 'text/html', charset => 1, expires => 120},
52     #xmedia => {type => 'application/xhtml+xml', charset => 1, expires => 120},
53     template => <<EOH});
54     %html-start;%html-head(title=>"%res(name=>\\"Diff:WebPageTitle\\");"p,link_meta=>"%predefined-template(name=>links);"p);
55     %section(level=>1,add_to_toc=>0,type=>body,title=>"%ns-short-page-name;",heading,content=>"
56     %section(id=>tools1,class=>tools,add_to_toc=>0,content=>\\"%predefined-template(name=>navbar);\\"p);
57     %section(level=>2,id=>\\"diff\\",title=>\\"Diff:Title\\",heading,content=>\\"
58     <p>%res(name=>\\\\\\"Diff:Notice\\\\\\");</p>
59     %diff-between-previous;
60     \\");
61     %section(level=>2,id=>toc,title=>\\"TOC:Title\\",heading,add_to_toc=>0,content=>\\"%toc(drag);\\");
62     %section(class=>tools,add_to_toc=>0,content=>\\\"%predefined-template(name=>navbar);\\"p);
63     %section(id=>footer,add-to-toc=>0,content=>\\"%predefined-template(name=>footer);\\");
64     ");
65     EOH
66    
67     my $l = SuikaWiki::View->template ('links');
68     $l .= <<'EOH';
69     %link-wiki(mode=>diff,rel=>history,class=>wiki-cmd,title=>"%res(name=>ViewDiffOfThisPageLink);"p);
70     EOH
71    
72     my $cvsuri = SuikaWiki::Plugin->uri ('cvs_repository');
73     $l .= <<EOH if $cvsuri;
74     %link-viewcvs(href=>"$cvsuri",rel=>history,class=>wiki-cmd,title=>"%res(name=>ViewHistoryOfThisPageLink);",hreflang=>en);
75     EOH
76    
77     POD:LICENSE:
78     Copyright 2003 Wakaba <w@suika.fam.cx>
79    
80     %%GNUGPL2%%

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24