summaryrefslogtreecommitdiff
path: root/lib/rdoc/generator/xml/xml.rb
blob: ffb1329c4e7fbf10cd3f8aa5362598ced49cfbf4 (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
require 'rdoc/generator/xml'

module RDoc::Generator::XML::XML

  CONTENTS_XML = <<-EOF
<% if defined? classes and classes["description"] then %>
    <description>
<%= classes["description"] %>
    </description>
<% end %>
    <contents>
<% if defined? files and files["requires"] then %>
      <required-file-list>
<% files["requires"].each do |requires| %>
         <required-file name="<%= requires["name"] %>"
<% if requires["aref"] then %>
                        href="<%= requires["aref"] %>"
<% end %>
         />
<% end # files["requires"] %>
      </required-file-list>
<% end %>
<% if defined? classes and classes["sections"] then %>
<% classes["sections"].each do |sections| %>
<% if sections["attributes"] then %>
      <attribute-list>
<% sections["attributes"].each do |attributes| %>
        <attribute name="<%= attributes["name"] %>">
<% if attributes["rw"] then %>
          <attribute-rw><%= attributes["rw"] %></attribute-rw>
<% end %>
          <description><%= attributes["a_desc"] %></description>
        </attribute>
<% end # sections["attributes"] %>
      </attribute-list>
<% end %>
<% if sections["method_list"] then %>
      <method-list>
<% sections["method_list"].each do |method_list| %>
<% if method_list["methods"] then %>
<% method_list["methods"].each do |methods| %>
        <method name="<%= methods["name"] %>" type="<%= methods["type"] %>" category="<%= methods["category"] %>" id="<%= methods["aref"] %>">
          <parameters><%= methods["params"] %></parameters>
<% if methods["m_desc"] then %>
          <description>
<%= methods["m_desc"] %>
          </description>
<% end %>
<% if methods["sourcecode"] then %>
          <source-code-listing>
<%= methods["sourcecode"] %>
          </source-code-listing>
<% end %>
        </method>
<% end # method_list["methods"] %>
<% end %>
<% end # sections["method_list"] %>
      </method-list>
<% end %>
<% end # classes["sections"] %>
<% end %>
<% if defined? classes and classes["includes"] then %>
      <included-module-list>
<% classes["includes"].each do |includes| %>
        <included-module name="<%= includes["name"] %>"
<% if includes["aref"] then %>
                         href="<%= includes["aref"] %>"
<% end %>
        />
<% end # classes["includes"] %>
      </included-module-list>
<% end %>
    </contents>
  EOF

  ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
<rdoc>
<file-list>
<% values["files"].each do |files| %>
  <file name="<%= files["short_name"] %>" id="<%= files["href"] %>">
    <file-info>
      <path><%= files["full_path"] %></path>
      <dtm-modified><%= files["dtm_modified"] %></dtm-modified>
    </file-info>
} + CONTENTS_XML + %{
  </file>
<% end # values["files"] %>
</file-list>
<class-module-list>
<% values["classes"].each do |classes| %>
  <<%= classes["classmod"] %> name="<%= classes["full_name"] %>" id="<%= classes["full_name"] %>">
    <classmod-info>
<% if classes["infiles"] then %>
      <infiles>
<% classes["infiles"].each do |infiles|  %>
        <infile><%= href infiles["full_path_url"], infiles["full_path"] %></infile>
<% end # classes["infiles"] %>
      </infiles>
<% end %>
<% if classes["parent"] then %>
     <superclass><%= href classes["par_url"], classes["parent"] %></superclass>
<% end %>
    </classmod-info>
} + CONTENTS_XML + %{
  </<%= classes["classmod"] %>>
<% end # values["classes"] %>
</class-module-list>
</rdoc>
}

end