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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by wakaba, Sun Jul 25 06:54:29 2004 UTC revision 1.15 by wakaba, Tue Sep 21 03:18:22 2004 UTC
# Line 26  Plugin: Line 26  Plugin:
26    @Namespace:    @Namespace:
27      @@relrev:      @@relrev:
28        http://suika.fam.cx/~wakaba/archive/2004/7/25/html-relrev#        http://suika.fam.cx/~wakaba/archive/2004/7/25/html-relrev#
29        @@sw:
30          http://suika.fam.cx/~wakaba/archive/2004/7/20/sw#
31    
32  PluginConst:  PluginConst:
33    @NS_XHTML1:    @NS_XHTML1:
# Line 45  PluginConst: Line 47  PluginConst:
47    
48  FormattingRule:  FormattingRule:
49    @Category[list]: view    @Category[list]: view
50      @Name: m--wikipage-obsolete
51      @Description:
52        @@@:
53          The navigation notify that this WikiPage is obsolete and
54          should refer the other WikiPages.
55        @@lang: en
56      @Parameter:
57        @@Name: desc-after
58        @@Type: template
59        @@Default: (none)
60        @@Description:
61          @@@lang:en
62          @@@@: The description should be located after WikiPage names if any.
63      @Parameter:
64        @@Name: desc-before
65        @@Type: template
66        @@Default: (none)
67        @@Description:
68          @@@lang:en
69          @@@@: The description should be located before WikiPage names if any.
70      @Parameter:
71        @@Name: page
72        @@Type: WikiName
73        @@Default: (current)
74        @@Description:
75          @@@lang: en
76          @@@@: The WikiPage that might be obsoleted.
77      @Formatting:
78          my $page = $o->{wiki}->name ($p->{page} || $o->{wiki}->{var}->{page});
79          my $content_prop;
80          try {
81            $content_prop = $o->{wiki}->{db}->get (content_prop => $page);
82          } catch SuikaWiki::DB::Util::Error with {
83            my $err = shift;
84            $err->throw if $err->{-type} eq 'ERROR_REPORTED';
85          } catch SuikaWiki::Format::Definition::error with {
86            #
87          };
88    
89        if ($content_prop) {
90          my $obs = $content_prop->get_attribute_value
91                                            (<Q:sw:obsolete>, as_array => 1,
92                                             default => []);
93          if (@$obs) {
94            my $pp = $p->{-parent}->append_new_node
95                                     (type => '#element',
96                                      namespace_uri => $NS_XHTML1,
97                                      local_name => 'p');
98            $pp->set_attribute (class => 'm--wikipage-obsolete');
99            __ATTRNODE:%desc_before->{$pp}__;
100            my $i = 0;
101            for (@$obs) {
102              $pp->append_text (', ') if $i++;
103                __FUNCPACK{WikiLinking}__->to_wikipage_in_html (
104                {
105                } => {
106                  base            => $page,
107                  page_name_relative => $o->{wiki}->name ($_),
108                }, {
109                  o               => $o,
110                  parent          => $pp,
111                });
112            }
113            __ATTRNODE:%desc_after->{$pp}__;
114          }
115        }
116    
117    FormattingRule:
118      @Category[list]: view
119    @Name: m--html-link-navigation    @Name: m--html-link-navigation
120    @Description:    @Description:
121      @@@: Navigation links (HTML link elements) made from content properties      @@@: Navigation links (HTML link elements) made from content properties
# Line 69  FormattingRule: Line 140  FormattingRule:
140        };        };
141    
142      if ($content_prop) {      if ($content_prop) {
143        for (        for my $rel (
144          {uri => <Q:relrev:prev>, html => 'prev'},          {uri => <Q:relrev:prev>, html => 'prev'},
145          {uri => <Q:relrev:next>, html => 'next'},          {uri => <Q:relrev:next>, html => 'next'},
146          {uri => <Q:relrev:contents>, html => 'contents'},          {uri => <Q:relrev:contents>, html => 'contents'},
147          {uri => <Q:relrev:index>, html => 'index'},          {uri => <Q:relrev:index>, html => 'index'},
148          {uri => <Q:relrev:up>, html => 'up'},          {uri => <Q:relrev:up>, html => 'up'},
149        ) {        ) {
150          if (my $val = $content_prop->get_attribute ($_->{uri})) {          if (my $val = $content_prop->get_attribute ($rel->{uri})) {
151            __FUNCPACK{WikiLinking}__->to_wikipage_in_html (            $val = $val->value;
152            {            for (ref $val eq 'ARRAY' ? @$val : $val) {
153              label           => qq(%html-link (              __FUNCPACK{WikiLinking}__->to_wikipage_in_html (
154                                      description => {%res (name => {Map:LinkNav:$_->{html}:Description});: %page-name;: %page-headline;}p,              {
155                                    );\n),                label           => qq(%html-link (
156            } => {                                        description => {%res (name => {Map:LinkNav:$rel->{html}:Description});: %page-name;: %page-headline;}p,
157              base            => $page,                                      );\n),
158              page_name_relative => $o->{wiki}->name ($val->value),              } => {
159            }, {                base            => $page,
160              o               => $o,                page_name_relative => $o->{wiki}->name ($_),
161              parent          => $p->{-parent},              }, {
162              -rel            => $_->{html},                o               => $o,
163            });                parent          => $p->{-parent},
164                  -rel            => $rel->{html},
165                });
166              }
167          }          }
168        }        }
169      }      }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.15

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24