Changeset 10863

Show
Ignore:
Timestamp:
05/01/08 11:24:22 (5 years ago)
Author:
lyokato
Message:

lang/ruby/atomutil: ver 0.0.6

Location:
lang/ruby/atomutil/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/ruby/atomutil/trunk/History.txt

    r10786 r10863  
     1== 0.0.6 2008-05-01 
     2 
     3Removed dependency on REXML::Formatters::Pretty, 
     4because REXML::Formatters::Pretty inserts linebreaks into each tags... 
     5But this isn't best solution. 
     6 
    17== 0.0.5 2008-04-30 
    28 
    39* bugfix: Atom::Content didn't work as expected with multibyte UTF-8 string. 
    4           Atom::Element::to_s didn't work well on ruby 1.8.6 or above. 
     10          Atom::Element::to_s didn't work well on ruby 1.8.6 or above, because 
     11          REXML::Document::to_s is deprecated and has a bug on 1.8.6 or 1.9 patched release. 
    512          require 'sha1' -> require 'digest/sha1' 
    613 
  • lang/ruby/atomutil/trunk/lib/atomutil.rb

    r10862 r10863  
    4242require 'rexml/document' 
    4343 
    44 ATOM_CAN_PRETTY_INDENT = true 
    45 begin 
    46   require 'rexml/formatters/pretty' 
    47 rescue LoadError 
    48   ATOM_CAN_PRETTY_INDENT = false 
    49 end 
    50  
    5144# = Utilities for AtomPub / Atom Syndication Format 
    5245# 
     
    6356    MAJOR = 0 
    6457    MINOR = 0 
    65     TINY  = 5 
     58    TINY  = 6 
    6659    STRING = [MAJOR, MINOR, TINY].join('.') 
    6760  end 
     
    602595      doc.add_element @elem.deep_clone 
    603596      if indent 
    604         if ATOM_CAN_PRETTY_INDENT 
    605           result = "" 
    606           REXML::Formatters::Pretty.new(0, false).write(doc, result) 
    607           result 
    608         else 
    609           if RUBY_VERSION >= "1.8.6" 
    610             warn "REXML::Document::to_s( param ) is deprecated and has a bug under 1.8.6 or above." 
    611           end 
    612           doc.to_s(0) 
    613         end 
     597        doc.to_s(0) 
    614598      else 
    615599        doc.to_s 
  • lang/ruby/atomutil/trunk/spec/person_spec.rb

    r7073 r10863  
    2828    person_xml = @person.to_s 
    2929    person_xml.should =~ /<author(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>/ 
    30     person_xml.should =~ /<name(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>\s*?Lyo Kato\s*?<\/name>/ 
    31     person_xml.should =~ /<email(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>\s*?lyo\.kato\@gmail\.com\s*?<\/email>/ 
     30    person_xml.should =~ /<name(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>Lyo Kato<\/name>/ 
     31    person_xml.should =~ /<email(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>lyo\.kato\@gmail\.com<\/email>/ 
    3232  end 
    3333 
     
    4141    author_xml = author.to_s 
    4242    author_xml.should =~ /<author(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>/ 
    43     author_xml.should =~ /<name(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>\s*?Lyo Kato\s*?<\/name>/ 
    44     author_xml.should =~ /<email(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>\s*?lyo\.kato\@gmail\.com\s*?<\/email>/ 
     43    author_xml.should =~ /<name(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>Lyo Kato<\/name>/ 
     44    author_xml.should =~ /<email(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>lyo\.kato\@gmail\.com<\/email>/ 
    4545  end 
    4646 
     
    5454    contributor_xml = contributor.to_s 
    5555    contributor_xml.should =~ /<contributor(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')>/ 
    56     contributor_xml.should =~ /<name(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>\s*?Lyo Kato\s*?<\/name>/ 
    57     contributor_xml.should =~ /<email(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>\s*?lyo\.kato\@gmail\.com\s*?<\/email>/ 
     56    contributor_xml.should =~ /<name(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>Lyo Kato<\/name>/ 
     57    contributor_xml.should =~ /<email(?: xmlns='http:\/\/www\.w3\.org\/2005\/Atom')?>lyo\.kato\@gmail\.com<\/email>/ 
    5858  end 
    5959