public
Fork of rubys/mars
Description: Yet Another Planet Refactoring
Homepage: http://intertwingly.net/blog/2007/12/19/Yet-Another-Planet-Refactoring
Clone URL: git://github.com/joshu/mars.git
removed rake/feedparser bug in haml.rb

top level method python2ruby in feedparser.rb was cloned to haml.rb. The 
haml version was interacting with the feedparser version
joshu (author)
Sat Apr 12 19:40:32 -0700 2008
commit  127bdf5d62b9f25fa140dc9b73294e99fbe87d71
tree    2a92a1bc2e161a5a0fc47ca02e343882dd373a35
parent  a4c9e7e1e7c6d5e675a6a6ceddc9150ae87ff746
...
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
...
59
60
61
62
 
63
64
65
...
67
68
69
70
 
71
72
73
...
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
...
61
62
63
 
64
65
66
67
...
69
70
71
 
72
73
74
75
0
@@ -9,31 +9,33 @@ H_FILES.map! {|name| name.index('.') ? name : name+".xml"}
0
 H_TESTS = H_FILES.map {|arg| Dir[File.join('test/data/filter',arg)]}
0
 
0
 # test cases are in Python syntax, convert to something that eval will accept
0
-def python2ruby(expr, source)
0
- # unicode strings
0
- expr.gsub! " u'", " '"
0
- expr.gsub! ' u"', ' "'
0
+class TestCaseConverter
0
+ def self.python2ruby(expr, source)
0
+ # unicode strings
0
+ expr.gsub! " u'", " '"
0
+ expr.gsub! ' u"', ' "'
0
 
0
- # triple strings
0
- expr.gsub! /"""(.*?)"""/, '%q{\1}'
0
+ # triple strings
0
+ expr.gsub! /"""(.*?)"""/, '%q{\1}'
0
 
0
- # dict to hash
0
- expr.gsub! "': '", "' => '"
0
+ # dict to hash
0
+ expr.gsub! "': '", "' => '"
0
 
0
- # const to variable
0
- expr.gsub! "Items[", "items["
0
- expr.gsub! "Channels[", "channels["
0
+ # const to variable
0
+ expr.gsub! "Items[", "items["
0
+ expr.gsub! "Channels[", "channels["
0
 
0
- # true
0
- expr = "true" if expr == "1"
0
+ # true
0
+ expr = "true" if expr == "1"
0
 
0
- # differences in XML/URI serializations
0
- name = source.split('/').last.split('.').first
0
- expr.sub!('"','%22') if name == 'missing_quote_in_attr'
0
- expr.sub! '>', '>' if name == 'tag_in_attr'
0
- expr.gsub!('"', "\\\\'").gsub!('"','"') if name == 'quote_in_attr'
0
+ # differences in XML/URI serializations
0
+ name = source.split('/').last.split('.').first
0
+ expr.sub!('"','%22') if name == 'missing_quote_in_attr'
0
+ expr.sub! '>', '>' if name == 'tag_in_attr'
0
+ expr.gsub!('"', "\\\\'").gsub!('"','"') if name == 'quote_in_attr'
0
 
0
- expr
0
+ expr
0
+ end
0
 end
0
 
0
 require 'planet/formatter'
0
@@ -59,7 +61,7 @@ class HamlTestCase < Test::Unit::TestCase
0
       case testdata
0
         # for .xml files
0
         when /Description:\s*(.*?)\s*Expect:\s*(.*)\s*/
0
- desc = python2ruby($2, file)
0
+ desc = TestCaseConverter.python2ruby($2, file)
0
           doc = Planet.harvest(file)
0
           output = HamlFormatter.new.haml_info(doc)
0
           channels = output['channels']
0
@@ -67,7 +69,7 @@ class HamlTestCase < Test::Unit::TestCase
0
 
0
         # for .ini files... any xml will do
0
         when /Description:\s*(.*?)\s*; Expect:\s*(.*)\s*/
0
- desc = python2ruby($2, file)
0
+ desc = TestCaseConverter.python2ruby($2, file)
0
           Planet.config.read file
0
           doc = Planet.harvest('test/data/filter/haml/new_channel.xml')
0
           output = HamlFormatter.new.haml_info(doc)

Comments

    No one has commented yet.