/[pub]/suikawiki/script/lib/SuikaWiki/Plugin/WikiRead.wp2
Suika

Contents of /suikawiki/script/lib/SuikaWiki/Plugin/WikiRead.wp2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Sun Feb 1 12:19:16 2004 UTC (21 years, 9 months ago) by wakaba
Branch: MAIN
Changes since 1.5: +10 -6 lines
Use try..catch for WikiDB

1 wakaba 1.1 #?SuikaWikiConfig/2.0
2    
3     Plugin:
4     @Name: WikiRead
5     @Description:
6     @@@: Showing WikiPage content
7     @@lang:en
8     @License: %%GPL%%
9     @Author:
10     @@Name:
11     @@@@: Wakaba
12     @@@lang:ja
13     @@@script:Latn
14     @@Mail[list]: w@suika.fam.cx
15 wakaba 1.6 @Date.RCS: $Date: 2004/01/16 07:48:11 $
16 wakaba 1.2 @RequiredModule[list]:
17 wakaba 1.3 SuikaWiki::Format::Definition
18 wakaba 1.2 @RequiredPlugin[list]:
19 wakaba 1.5 WikiFormat
20 wakaba 1.2 WikiView
21     WikiStruct
22     WikiLinking
23     HTML
24     SuikaWiki09
25 wakaba 1.3 @Use:
26     require SuikaWiki::Format::Definition;
27 wakaba 1.6 use Message::Util::Error;
28 wakaba 1.1
29     ViewDefinition:
30     @Mode: read
31     @Condition:
32     @@http-method[list]:
33     GET
34     HEAD
35     @Description:
36     @@@: Show WikiPage content as whole
37     @@lang: en
38     @template:
39     @@http-status-code: 200
40     @@media-type: text/html
41     @@use-media-type-charset: 1
42     @@expires: %%view%%
43     @@body:
44     %html-document (
45 wakaba 1.2 title => {%res (name => {View:WebPageTitle});}p,
46     link-meta => {%template (name => links);}p,
47 wakaba 1.1 content => {
48     %template (
49     name => ws--page,
50     -content => {
51     %block (
52 wakaba 1.3 class => "bodytext",
53 wakaba 1.2 content => {%template (name => wr--read-body);}p,
54 wakaba 1.1 );
55     },
56     );
57     }p,
58     );
59    
60 wakaba 1.2 ViewFragment:
61     @Template[list]:wr--read-body
62     @Order: 0
63     @Description:
64     @@@: "Read" mode body -- WikiPage main content
65     @@lang:en
66     @Formatting:
67     %read (comment);
68    
69 wakaba 1.1 PluginConst:
70     @NS_XHTML1:
71     http://www.w3.org/1999/xhtml
72    
73     FormattingRule:
74     @Category[list]: view
75     @Name: read
76     @Description:
77     @@@:
78     Show the WikiPage to be "read"
79     @@lang: en
80     @Parameter:
81     @@Name: page
82     @@Type: WikiName
83     @@Default: (current)
84     @@Description:
85     @@@@: WikiPage shown
86     @@@lang:en
87     @Parameter:
88     @@Name: comment
89     @@Type: boolean
90     @@Default: {0}
91     @@Description:
92     @@@@: Append comment form
93     @@@lang:en
94     @Formatting:
95 wakaba 1.3 __ATTRTEXT:%page__;__ATTRTEXT:%comment__;
96     ## TODO: pagename
97 wakaba 1.5 my $page = $p->{page} ?
98     [split $o->{wiki}->{config}->{name}->{space}->{separator_reg},
99     $p->{page}] :
100     $o->{wiki}->{var}->{page};
101 wakaba 1.6 my $content;
102     try {
103     $content = $o->{wiki}->{db}->get (content => $page);
104     } catch SuikaWiki::DB::Util::Error with {
105     $content = undef;
106     };
107 wakaba 1.4
108 wakaba 1.5 my $format = SuikaWiki::Plugin->module_package ('WikiFormat')
109     ->handler (\$content,
110     o => $o, wiki => $o->{wiki});
111     $format->convert (\$content, Type => 'text/html',
112 wakaba 1.4 IsFragment => 1, -parent => $p->{-parent},
113 wakaba 1.6 o => $o, page => $page,
114     -with_annotation_input => $p->{comment});
115 wakaba 1.1
116     ViewFragment:
117     @Name: links
118     @Description:
119     @@@: Link to read mode of the WikiPage
120     @@lang:en
121     @Formatting:
122     %link-wiki(mode=>read,rel=>view,class=>wiki-cmd,
123 wakaba 1.4 description=>{%res(name=>{Link:View:Description});}p,up-to-date);
124 wakaba 1.1
125     ViewFragment:
126     @Name: navbar
127     @Description:
128     @@@: Link to read mode of the WikiPage
129     @Order: 0
130     @Formatting:
131 wakaba 1.3 %link-to-wikipage (
132     rel => view,
133     mode => read,
134     up-to-date,
135     label => {%link-to-it (
136     class => wiki-cmd,
137     label => {%res(name=>ViewThisPage);}p,
138     description => {%res(name=>ViewThisPageLong);}p,
139     );},
140     );
141 wakaba 1.1
142     Resource:
143     @Link:View:Description:
144     @@@: Show this WikiPage in reading mode
145     @@lang:en
146     @ViewThisPage:
147     @@@: View
148     @@lang:en
149     @ViewThisPageLong:
150     @@@: Show latest version of this WikiPage
151     @@lang:en
152     @View:WebPageTitle:
153     @@@: %page-name;
154     @@lang:en
155    
156    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24