1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rss: supported prety print.

* test/rss/test_1.0.rb: added test for calculating default indent size.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2004-10-16 04:39:58 +00:00
parent 64422ae494
commit 0ebac90b0e
8 changed files with 210 additions and 154 deletions

View file

@ -23,11 +23,11 @@ module RSS
install_model(x, occurs)
end
def other_element(convert, indent='')
def other_element(convert, indent)
rv = <<-EOT
#{indent}#{category_element(convert)}
#{indent}#{generator_element(convert)}
#{indent}#{ttl_element(convert)}
#{category_element(convert, indent)}
#{generator_element(convert, indent)}
#{ttl_element(convert, indent)}
EOT
rv << super
end
@ -73,12 +73,12 @@ EOT
install_model(x, occurs)
end
def other_element(convert, indent='')
def other_element(convert, indent)
rv = <<-EOT
#{indent}#{author_element(false)}
#{indent}#{comments_element(false)}
#{indent}#{pubDate_element(false)}
#{indent}#{guid_element(false)}
#{author_element(false, indent)}
#{comments_element(false, indent)}
#{pubDate_element(false, indent)}
#{guid_element(false, indent)}
EOT
rv << super
end
@ -116,7 +116,7 @@ EOT
@content = content
end
def to_s(convert=true)
def to_s(convert=true, indent=calc_indent)
if @content
rv = %Q!<guid!
rv << %Q! isPermaLink="#{h @isPermaLink}"! if @isPermaLink