diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-13 03:13:37 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-13 03:13:37 +0000 |
commit | ec519b9b43db7756fcc2c19020ece2d7e2263fe4 (patch) | |
tree | df6a1e6827f788c68e430d44a5ff913a62af6cf7 /lib/rdoc/generator/xml | |
parent | 937b7ab8b59346f02da81ef324b8955b01d7cc25 (diff) | |
download | ruby-ec519b9b43db7756fcc2c19020ece2d7e2263fe4.tar.gz |
Complete RDoc namespace change
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/generator/xml')
-rw-r--r-- | lib/rdoc/generator/xml/rdf.rb | 113 | ||||
-rw-r--r-- | lib/rdoc/generator/xml/xml.rb | 111 |
2 files changed, 224 insertions, 0 deletions
diff --git a/lib/rdoc/generator/xml/rdf.rb b/lib/rdoc/generator/xml/rdf.rb new file mode 100644 index 0000000000..7b15c69a18 --- /dev/null +++ b/lib/rdoc/generator/xml/rdf.rb @@ -0,0 +1,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 + 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 |