OSDN Git Service

ruby-1.9.1-rc1
[splhack/AndroidRuby.git] / lib / ruby-1.9.1-rc1 / lib / rdoc / generator / xml / rdf.rb
1 require 'rdoc/generator/xml'
2
3 module RDoc::Generator::XML::RDF
4
5   CONTENTS_RDF = <<-EOF
6 <% if defined? classes and classes["description"] then %>
7     <description rd:parseType="Literal">
8 <%= classes["description"] %>
9     </description>
10 <% end %>
11
12 <% if defined? files and files["requires"] then %>
13 <% files["requires"].each do |requires| %>
14          <rd:required-file rd:name="<%= requires["name"] %>" />
15 <% end # files["requires"] %>
16 <% end %>
17
18 <% if defined? classes and classes["includes"] then %>
19       <IncludedModuleList>
20 <% classes["includes"].each do |includes| %>
21         <included-module rd:name="<%= includes["name"] %>"  />
22 <% end # includes["includes"] %>
23       </IncludedModuleList>
24 <% end %>
25
26 <% if defined? classes and classes["sections"] then %>
27 <% classes["sections"].each do |sections| %>
28 <% if sections["attributes"] then %>
29 <% sections["attributes"].each do |attributes| %>
30         <contents>
31         <Attribute rd:name="<%= attributes["name"] %>">
32 <% if attributes["rw"] then %>
33           <attribute-rw><%= attributes["rw"] %></attribute-rw>
34 <% end %>
35           <description rdf:parseType="Literal"><%= attributes["a_desc"] %></description>
36         </Attribute>
37         </contents>
38 <% end # sections["attributes"] %>
39 <% end %>
40
41 <% if sections["method_list"] then %>
42 <% sections["method_list"].each do |method_list| %>
43 <% if method_list["methods"] then %>
44 <% method_list["methods"].each do |methods| %>
45         <contents>
46         <Method rd:name="<%= methods["name"] %>" rd:visibility="<%= methods["type"] %>"
47                 rd:category="<%= methods["category"] %>" rd:id="<%= methods["aref"] %>">
48           <parameters><%= methods["params"] %></parameters>
49 <% if methods["m_desc"] then %>
50           <description rdf:parseType="Literal">
51 <%= methods["m_desc"] %>
52           </description>
53 <% end %>
54 <% if methods["sourcecode"] then %>
55           <source-code-listing rdf:parseType="Literal">
56 <%= methods["sourcecode"] %>
57           </source-code-listing>
58 <% end %>
59         </Method>
60        </contents>
61 <% end # method_list["methods"] %>
62 <% end %>
63 <% end # sections["method_list"] %>
64 <% end %>
65      <!-- end method list -->
66 <% end # classes["sections"] %>
67 <% end %>
68   EOF
69
70 ########################################################################
71
72   ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
73 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
74         xmlns="http://pragprog.com/rdoc/rdoc.rdf#"
75         xmlns:rd="http://pragprog.com/rdoc/rdoc.rdf#">
76
77 <!-- RDoc -->
78 <% values["files"].each do |files| %>
79   <rd:File rd:name="<%= files["short_name"] %>" rd:id="<%= files["href"] %>">
80       <path><%= files["full_path"] %></path>
81       <dtm-modified><%= files["dtm_modified"] %></dtm-modified>
82 } + CONTENTS_RDF + %{
83   </rd:File>
84 <% end # values["files"] %>
85 <% values["classes"].each do |classes| %>
86   <<%= values["classmod"] %> rd:name="<%= classes["full_name"] %>" rd:id="<%= classes["full_name"] %>">
87     <classmod-info>
88 <% if classes["infiles"] then %>
89       <InFiles>
90 <% classes["infiles"].each do |infiles| %>
91         <infile>
92           <File rd:name="<%= infiles["full_path"] %>"
93 <% if infiles["full_path_url"] then %>
94                 rdf:about="<%= infiles["full_path_url"] %>"
95 <% end %>
96            />
97          </infile>
98 <% end # classes["infiles"] %>
99       </InFiles>
100 <% end %>
101 <% if classes["parent"] then %>
102      <superclass><%= href classes["par_url"], classes["parent"] %></superclass>
103 <% end %>
104     </classmod-info>
105 } + CONTENTS_RDF + %{
106   </<%= classes["classmod"] %>>
107 <% end # values["classes"] %>
108 <!-- /RDoc -->
109 </rdf:RDF>
110 }
111
112 end
113