summaryrefslogtreecommitdiff
path: root/trunk/lib/rdoc/generator/xml/rdf.rb
blob: 7b15c69a1842eb5978d688e7f6d6436fded7e7a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
require 'rdoc/generator/xml'

module RDoc::Generator::XML::RDF

  CONTENTS_RDF = <<-EOF
<% if defined? classes and classes["description"] then %>
    <description rd:parseType="Literal">
<%= classes["description"] %>
    </description>
<% end %>

<% if defined? files and files["requires"] then %>
<% files["requires"].each do |requires| %>
         <rd:required-file rd:name="<%= requires["name"] %>" />
<% end # files["requires"] %>
<% end %>

<% if defined? classes and classes["includes"] then %>
      <IncludedModuleList>
<% classes["includes"].each do |includes| %>
        <included-module rd:name="<%= includes["name"] %>"  />
<% end # includes["includes"] %>
      </IncludedModuleList>
<% end %>

<% if defined? classes and classes["sections"] then %>
<% classes["sections"].each do |sections| %>
<% if sections["attributes"] then %>
<% sections["attributes"].each do |attributes| %>
        <contents>
        <Attribute rd:name="<%= attributes["name"] %>">
<% if attributes["rw"] then %>
          <attribute-rw><%= attributes["rw"] %></attribute-rw>
<% end %>
          <description rdf:parseType="Literal"><%= attributes["a_desc"] %></description>
        </Attribute>
        </contents>
<% end # sections["attributes"] %>
<% end %>

<% if sections["method_list"] then %>
<% sections["method_list"].each do |method_list| %>
<% if method_list["methods"] then %>
<% method_list["methods"].each do |methods| %>
	<contents>
        <Method rd:name="<%= methods["name"] %>" rd:visibility="<%= methods["type"] %>"
                rd:category="<%= methods["category"] %>" rd:id="<%= methods["aref"] %>">
          <parameters><%= methods["params"] %></parameters>
<% if methods["m_desc"] then %>
          <description rdf:parseType="Literal">
<%= methods["m_desc"] %>
          </description>
<% end %>
<% if methods["sourcecode"] then %>
          <source-code-listing rdf:parseType="Literal">
<%= methods["sourcecode"] %>
          </source-code-listing>
<% end %>
        </Method>
       </contents>
<% end # method_list["methods"] %>
<% end %>
<% end # sections["method_list"] %>
<% end %>
     <!-- end method list -->
<% end # classes["sections"] %>
<% end %>
  EOF

########################################################################

  ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns="http://pragprog.com/rdoc/rdoc.rdf#"
        xmlns:rd="http://pragprog.com/rdoc/rdoc.rdf#">

<!-- RDoc -->
<% values["files"].each do |files| %>
  <rd:File rd:name="<%= files["short_name"] %>" rd:id="<%= files["href"] %>">
      <path><%= files["full_path"] %></path>
      <dtm-modified><%= files["dtm_modified"] %></dtm-modified>
} + CONTENTS_RDF + %{
  </rd:File>
<% end # values["files"] %>
<% values["classes"].each do |classes| %>
  <<%= values["classmod"] %> rd:name="<%= classes["full_name"] %>" rd:id="<%= classes["full_name"] %>">
    <classmod-info>
<% if classes["infiles"] then %>
      <InFiles>
<% classes["infiles"].each do |infiles| %>
        <infile>
          <File rd:name="<%= infiles["full_path"] %>"
<% if infiles["full_path_url"] then %>
                rdf:about="<%= infiles["full_path_url"] %>"
<% end %>
           />
         </infile>
<% end # classes["infiles"] %>
      </InFiles>
<% end %>
<% if classes["parent"] then %>
     <superclass><%= href classes["par_url"], classes["parent"] %></superclass>
<% end %>
    </classmod-info>
} + CONTENTS_RDF + %{
  </<%= classes["classmod"] %>>
<% end # values["classes"] %>
<!-- /RDoc -->
</rdf:RDF>
}

end