diff options
Diffstat (limited to 'lib/rdoc/generator/xml/xml.rb')
-rw-r--r-- | lib/rdoc/generator/xml/xml.rb | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/lib/rdoc/generator/xml/xml.rb b/lib/rdoc/generator/xml/xml.rb new file mode 100644 index 0000000000..ffb1329c4e --- /dev/null +++ b/lib/rdoc/generator/xml/xml.rb @@ -0,0 +1,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 |