wraptext 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - checksums.yaml.gz.sig +0 -0
 - data.tar.gz.sig +1 -2
 - data/gem-public_cert.pem +11 -10
 - data/lib/wraptext/parser.rb +4 -0
 - data/spec/wraptext/parser_spec.rb +129 -32
 - data/wraptext.gemspec +2 -2
 - metadata +34 -43
 - metadata.gz.sig +1 -2
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 399cb52b3d2a6eb6b3df9abf1ff4aa33c7309b35
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 69cab50e1d33734c994d108c89311bb215e36f47
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e66b1c677408bafe97de17b209eae254eb2bf8657330c1e8a396b52f901425d011a061379482d160277690ae9d531e09e75d02333b993598745194bc1aef3fa3
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 7b80f3f0b2a48bd0133603994e521ea87f486c02632ae34bc6f00b4f9b5d74efe5f602ceb203be430ab9b41e6ef31e3991fc0e7e727750e95985549161e038ae
         
     | 
    
        checksums.yaml.gz.sig
    ADDED
    
    | 
         Binary file 
     | 
    
        data.tar.gz.sig
    CHANGED
    
    | 
         @@ -1,2 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
            hQS9#���3��t@�cD��X�F��1x�Q`<��R>����V�D��"�_,�Mp�~/�ȸ��d�u"n8�?(��&�t���̵Ga���%a�K��M�Y1�nߖ�4�R<��J=�H��
         
     | 
| 
      
 1 
     | 
    
         
            +
            !�����L2}�U��u���Lk����S�08}�_���Z.�F�f�| ��`�3�n�0k$0!c�b/d���%�|mF�x�)�?�W&(R/nc�����R�m�:П#��/ �r*ZR�d�F�nk�:{�����}�:��-��ρٓO�}��ty����:���[��r�����(�Tps˝@P4�I��g�Ku���e������@i(GA���	����>�!�D�#fFL�c���H�����W`�x	M
         
     | 
    
        data/gem-public_cert.pem
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            -----BEGIN CERTIFICATE-----
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
            MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA9MQ8wDQYDVQQDDAZjaGVh
         
     | 
| 
       3 
3 
     | 
    
         
             
            bGQxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2NvbTAe
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
            Fw0xNDAzMDEyMTE4MzJaFw0xNTAzMDEyMTE4MzJaMD0xDzANBgNVBAMMBmNoZWFs
         
     | 
| 
       5 
5 
     | 
    
         
             
            ZDEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29tMIIB
         
     | 
| 
       6 
6 
     | 
    
         
             
            IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwcnX2yl+rbjUztC4V+iUJgWv
         
     | 
| 
       7 
7 
     | 
    
         
             
            NPxqU4bQBaL+w00wVABWr04Hjg+cEkqiJ6A0kXxZIz5uXKhhvsaO50NvHfplVcUf
         
     | 
| 
         @@ -9,12 +9,13 @@ BxQabIfCS79xdvexXN0or3F5saatGaGa4cj/0uUHjX7w+K5MpEVfbjJp0uAKp62B 
     | 
|
| 
       9 
9 
     | 
    
         
             
            wUU2ilmn7EvZhEUPOMQi01t8z8OsOGc8kF2UtU1kGCxLV7eThWqu8CdXrux5E140
         
     | 
| 
       10 
10 
     | 
    
         
             
            7SnFnPlnXNeHqwZdOMZzQ9PiTQAPCKO3AY0aBFQeG3wlFPqkcEjOrtV1h7werUwz
         
     | 
| 
       11 
11 
     | 
    
         
             
            aNb4t5sAuu0f/9B646BOjiMgj1WeUlhgiAsaF5kVvLFNCxwS/xpcN3X01M2KdQID
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
            AQABo3MwcTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUtFVpwfEG
         
     | 
| 
      
 13 
     | 
    
         
            +
            78mBd2ulzsS+SlffdOcwGwYDVR0RBBQwEoEQY2hlYWxkQGdtYWlsLmNvbTAbBgNV
         
     | 
| 
      
 14 
     | 
    
         
            +
            HRIEFDASgRBjaGVhbGRAZ21haWwuY29tMA0GCSqGSIb3DQEBBQUAA4IBAQANcBIJ
         
     | 
| 
      
 15 
     | 
    
         
            +
            vIk27iNu4Ic6awNRy4Rd2YchzW4DaMhfpTXxtYWgAE502OdqUTFtmihd2PmnVRIP
         
     | 
| 
      
 16 
     | 
    
         
            +
            xdP5K2SpbCLuLKFCZ825qp8R02JSNMdgi2d4Btl0vHSO8O3lQ1ZAOM1BZPn2+Kbn
         
     | 
| 
      
 17 
     | 
    
         
            +
            KsiSURg3SnDXItcoedMsS+CQdNyBSdqvpkQ5gn22dN4BSwJg5ApwEYJ9tTuTpRXt
         
     | 
| 
      
 18 
     | 
    
         
            +
            1KCQFe5hamoenfoHO6uUXPEs24PUHnXl8QibWCLbt1FIBpTrJYNGiMHHnB7ip+zv
         
     | 
| 
      
 19 
     | 
    
         
            +
            E7PWS50D9moUJ6xWcemf0qKYC87qBFh0ng73awjG9uf+13lMslqJRMtek8C92cvh
         
     | 
| 
      
 20 
     | 
    
         
            +
            +R9zgQlbeNjy9O1i
         
     | 
| 
       20 
21 
     | 
    
         
             
            -----END CERTIFICATE-----
         
     | 
    
        data/lib/wraptext/parser.rb
    CHANGED
    
    
| 
         @@ -27,63 +27,108 @@ describe Wraptext::Parser do 
     | 
|
| 
       27 
27 
     | 
    
         
             
                it "should return a Nokogiri::XML::Element from #to_doc" do
         
     | 
| 
       28 
28 
     | 
    
         
             
                  @doc.to_doc.should be_a(Nokogiri::XML::Element)
         
     | 
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                it 'should return a string from #to_text' do
         
     | 
| 
      
 32 
     | 
    
         
            +
                  @doc.to_text.should be_a(String)
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
       30 
34 
     | 
    
         
             
              end
         
     | 
| 
       31 
35 
     | 
    
         | 
| 
       32 
36 
     | 
    
         
             
              context "given a set of plain text" do
         
     | 
| 
       33 
     | 
    
         
            -
                 
     | 
| 
       34 
     | 
    
         
            -
                  doc = <<-EOF
         
     | 
| 
      
 37 
     | 
    
         
            +
                let(:text) {<<-EOF
         
     | 
| 
       35 
38 
     | 
    
         
             
                  This is some text.
         
     | 
| 
       36 
39 
     | 
    
         | 
| 
       37 
40 
     | 
    
         
             
                  This is some more text.
         
     | 
| 
       38 
41 
     | 
    
         
             
                  EOF
         
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
      
 42 
     | 
    
         
            +
                }
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                let(:doc) { Wraptext::Parser.new(text) }
         
     | 
| 
       41 
45 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                 
     | 
| 
       43 
     | 
    
         
            -
                   
     | 
| 
      
 46 
     | 
    
         
            +
                describe '#to_html' do
         
     | 
| 
      
 47 
     | 
    
         
            +
                  it "should convert plain text to p-wrapped text" do
         
     | 
| 
      
 48 
     | 
    
         
            +
                    expects = <<-EOF
         
     | 
| 
       44 
49 
     | 
    
         
             
            <p>This is some text.</p>
         
     | 
| 
       45 
50 
     | 
    
         
             
            <p>This is some more text.</p>
         
     | 
| 
       46 
51 
     | 
    
         
             
            EOF
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 52 
     | 
    
         
            +
                    doc.to_html.should == expects.strip
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                describe '#to-text'  do
         
     | 
| 
      
 57 
     | 
    
         
            +
                  it 'should do nothing to p-wrapped text' do
         
     | 
| 
      
 58 
     | 
    
         
            +
                    doc.to_text.should == text.strip
         
     | 
| 
      
 59 
     | 
    
         
            +
                  end
         
     | 
| 
       48 
60 
     | 
    
         
             
                end
         
     | 
| 
       49 
61 
     | 
    
         
             
              end
         
     | 
| 
       50 
62 
     | 
    
         | 
| 
       51 
63 
     | 
    
         
             
              context "given plain text with a block element in the middle" do
         
     | 
| 
       52 
     | 
    
         
            -
                 
     | 
| 
       53 
     | 
    
         
            -
                  doc = <<-EOF
         
     | 
| 
      
 64 
     | 
    
         
            +
                let(:text) {<<-EOF
         
     | 
| 
       54 
65 
     | 
    
         
             
            This is some text
         
     | 
| 
       55 
66 
     | 
    
         
             
            <div>This is a block level element</div>
         
     | 
| 
       56 
67 
     | 
    
         
             
            This is some text after the block element
         
     | 
| 
       57 
68 
     | 
    
         
             
            EOF
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
      
 69 
     | 
    
         
            +
                }
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                let(:doc) { Wraptext::Parser.new(text) }
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
                describe '#to_html' do
         
     | 
| 
      
 74 
     | 
    
         
            +
                  it "should respect block-level elements" do
         
     | 
| 
      
 75 
     | 
    
         
            +
                    expects = <<-EOF
         
     | 
| 
       59 
76 
     | 
    
         
             
            <p>This is some text</p>
         
     | 
| 
       60 
77 
     | 
    
         
             
            <div><p>This is a block level element</p></div>
         
     | 
| 
       61 
78 
     | 
    
         
             
            <p>This is some text after the block element</p>
         
     | 
| 
       62 
79 
     | 
    
         
             
            EOF
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
      
 80 
     | 
    
         
            +
                    doc.to_html.should == expects.strip
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                describe '#to_text'  do
         
     | 
| 
      
 85 
     | 
    
         
            +
                  it 'should seperate block-level elements with newlines' do
         
     | 
| 
      
 86 
     | 
    
         
            +
                    expects = <<-EOF
         
     | 
| 
      
 87 
     | 
    
         
            +
            This is some text
         
     | 
| 
      
 88 
     | 
    
         
            +
            This is a block level element
         
     | 
| 
      
 89 
     | 
    
         
            +
            This is some text after the block element
         
     | 
| 
      
 90 
     | 
    
         
            +
            EOF
         
     | 
| 
      
 91 
     | 
    
         
            +
                    doc.to_text.should == expects.strip
         
     | 
| 
      
 92 
     | 
    
         
            +
                  end
         
     | 
| 
       64 
93 
     | 
    
         
             
                end
         
     | 
| 
       65 
94 
     | 
    
         
             
              end
         
     | 
| 
       66 
95 
     | 
    
         | 
| 
       67 
96 
     | 
    
         | 
| 
       68 
97 
     | 
    
         
             
              context "given plain text with some p-peer tags" do
         
     | 
| 
       69 
     | 
    
         
            -
                 
     | 
| 
       70 
     | 
    
         
            -
                  doc = <<-EOF
         
     | 
| 
      
 98 
     | 
    
         
            +
                let(:text) {<<-EOF
         
     | 
| 
       71 
99 
     | 
    
         
             
            This is some text
         
     | 
| 
       72 
100 
     | 
    
         
             
            <h1>This is a p-peer element</h1>
         
     | 
| 
       73 
101 
     | 
    
         
             
            This is some text after the block element
         
     | 
| 
       74 
102 
     | 
    
         
             
            EOF
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
      
 103 
     | 
    
         
            +
                }
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
                let(:doc) { Wraptext::Parser.new(text) }
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                describe '#to_html' do
         
     | 
| 
      
 108 
     | 
    
         
            +
                  it "should not inject p tags directly inside p-peer tags" do
         
     | 
| 
      
 109 
     | 
    
         
            +
                    expects = <<-EOF
         
     | 
| 
       76 
110 
     | 
    
         
             
            <p>This is some text</p>
         
     | 
| 
       77 
111 
     | 
    
         
             
            <h1>This is a p-peer element</h1>
         
     | 
| 
       78 
112 
     | 
    
         
             
            <p>This is some text after the block element</p>
         
     | 
| 
       79 
113 
     | 
    
         
             
            EOF
         
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
      
 114 
     | 
    
         
            +
                    doc.to_html.should == expects.strip
         
     | 
| 
      
 115 
     | 
    
         
            +
                  end
         
     | 
| 
      
 116 
     | 
    
         
            +
                end
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
                describe '#to_text' do
         
     | 
| 
      
 119 
     | 
    
         
            +
                  it 'should seperate block-level elements with newlines' do
         
     | 
| 
      
 120 
     | 
    
         
            +
                    expects = <<-EOF
         
     | 
| 
      
 121 
     | 
    
         
            +
            This is some text
         
     | 
| 
      
 122 
     | 
    
         
            +
            This is a p-peer element
         
     | 
| 
      
 123 
     | 
    
         
            +
            This is some text after the block element
         
     | 
| 
      
 124 
     | 
    
         
            +
            EOF
         
     | 
| 
      
 125 
     | 
    
         
            +
                    doc.to_text.should == expects.strip
         
     | 
| 
      
 126 
     | 
    
         
            +
                  end
         
     | 
| 
       81 
127 
     | 
    
         
             
                end
         
     | 
| 
       82 
128 
     | 
    
         
             
              end
         
     | 
| 
       83 
129 
     | 
    
         | 
| 
       84 
130 
     | 
    
         
             
              context "given a <script> tag" do
         
     | 
| 
       85 
     | 
    
         
            -
                 
     | 
| 
       86 
     | 
    
         
            -
                  doc = <<-EOF
         
     | 
| 
      
 131 
     | 
    
         
            +
                let(:text) {<<-EOF
         
     | 
| 
       87 
132 
     | 
    
         
             
            This is some precursor text
         
     | 
| 
       88 
133 
     | 
    
         | 
| 
       89 
134 
     | 
    
         
             
            And another line
         
     | 
| 
         @@ -93,7 +138,13 @@ And another line 
     | 
|
| 
       93 
138 
     | 
    
         
             
              elem = elem.toUpperCase();
         
     | 
| 
       94 
139 
     | 
    
         
             
            </script>
         
     | 
| 
       95 
140 
     | 
    
         
             
            EOF
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
      
 141 
     | 
    
         
            +
                }
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
                let(:doc) { Wraptext::Parser.new(text) }
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
                describe '#to_html' do
         
     | 
| 
      
 146 
     | 
    
         
            +
                  it "should not perform any transformation inside the tag" do
         
     | 
| 
      
 147 
     | 
    
         
            +
                    expects = <<-EOF
         
     | 
| 
       97 
148 
     | 
    
         
             
            <p>This is some precursor text</p>
         
     | 
| 
       98 
149 
     | 
    
         
             
            <p>And another line</p>
         
     | 
| 
       99 
150 
     | 
    
         
             
            <script>
         
     | 
| 
         @@ -102,10 +153,12 @@ EOF 
     | 
|
| 
       102 
153 
     | 
    
         
             
              elem = elem.toUpperCase();
         
     | 
| 
       103 
154 
     | 
    
         
             
            </script>
         
     | 
| 
       104 
155 
     | 
    
         
             
            EOF
         
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
      
 156 
     | 
    
         
            +
                    doc.to_html.should == expects.strip
         
     | 
| 
      
 157 
     | 
    
         
            +
                  end
         
     | 
| 
       106 
158 
     | 
    
         
             
                end
         
     | 
| 
       107 
159 
     | 
    
         
             
              end
         
     | 
| 
       108 
160 
     | 
    
         | 
| 
      
 161 
     | 
    
         
            +
              # todo
         
     | 
| 
       109 
162 
     | 
    
         
             
              context "given Wordpress datasets" do
         
     | 
| 
       110 
163 
     | 
    
         
             
                before :all do
         
     | 
| 
       111 
164 
     | 
    
         
             
                  @in = File.expand_path(File.join(__FILE__, "..", "..", "data", "in"))
         
     | 
| 
         @@ -135,39 +188,69 @@ EOF 
     | 
|
| 
       135 
188 
     | 
    
         
             
                end
         
     | 
| 
       136 
189 
     | 
    
         
             
              end
         
     | 
| 
       137 
190 
     | 
    
         | 
| 
       138 
     | 
    
         
            -
              context " 
     | 
| 
       139 
     | 
    
         
            -
                 
     | 
| 
      
 191 
     | 
    
         
            +
              context "given a p with em inside it" do
         
     | 
| 
      
 192 
     | 
    
         
            +
                let(:text) {<<-EOF
         
     | 
| 
       140 
193 
     | 
    
         
             
            <p>
         
     | 
| 
       141 
194 
     | 
    
         
             
              This is some <em>emphasized</em> text
         
     | 
| 
       142 
195 
     | 
    
         | 
| 
       143 
196 
     | 
    
         
             
              And here is <i>another</i> line
         
     | 
| 
       144 
197 
     | 
    
         
             
            </p>
         
     | 
| 
       145 
198 
     | 
    
         
             
            EOF
         
     | 
| 
      
 199 
     | 
    
         
            +
                }
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
      
 201 
     | 
    
         
            +
                let(:doc) { Wraptext::Parser.new(text) }
         
     | 
| 
       146 
202 
     | 
    
         | 
| 
       147 
     | 
    
         
            -
                 
     | 
| 
      
 203 
     | 
    
         
            +
                describe '#to_html' do
         
     | 
| 
      
 204 
     | 
    
         
            +
                  it 'preserves non block-level tags' do
         
     | 
| 
      
 205 
     | 
    
         
            +
                    expects = <<-EOF
         
     | 
| 
       148 
206 
     | 
    
         
             
            <p>This is some <em>emphasized</em> text</p>
         
     | 
| 
       149 
207 
     | 
    
         
             
            <p>And here is <i>another</i> line</p>
         
     | 
| 
       150 
208 
     | 
    
         
             
            EOF
         
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
      
 209 
     | 
    
         
            +
                    doc.to_html.should == expects.strip
         
     | 
| 
      
 210 
     | 
    
         
            +
                  end
         
     | 
| 
      
 211 
     | 
    
         
            +
                end
         
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
      
 213 
     | 
    
         
            +
                describe '#to_text' do
         
     | 
| 
      
 214 
     | 
    
         
            +
                  it 'removes block-level and non block-level tags' do
         
     | 
| 
      
 215 
     | 
    
         
            +
                    expects = <<-EOF
         
     | 
| 
      
 216 
     | 
    
         
            +
              This is some emphasized text
         
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
              And here is another line
         
     | 
| 
      
 219 
     | 
    
         
            +
            EOF
         
     | 
| 
      
 220 
     | 
    
         
            +
                    doc.to_text.should == expects.strip
         
     | 
| 
      
 221 
     | 
    
         
            +
                  end
         
     | 
| 
      
 222 
     | 
    
         
            +
                end
         
     | 
| 
       152 
223 
     | 
    
         
             
              end
         
     | 
| 
       153 
224 
     | 
    
         | 
| 
       154 
     | 
    
         
            -
              context " 
     | 
| 
       155 
     | 
    
         
            -
                 
     | 
| 
      
 225 
     | 
    
         
            +
              context "given an empty document" do
         
     | 
| 
      
 226 
     | 
    
         
            +
                it 'should not raise an error' do
         
     | 
| 
      
 227 
     | 
    
         
            +
                  expect { Wraptext::Parser.new("") }.to_not raise_error
         
     | 
| 
      
 228 
     | 
    
         
            +
                end
         
     | 
| 
       156 
229 
     | 
    
         
             
              end
         
     | 
| 
       157 
230 
     | 
    
         | 
| 
       158 
     | 
    
         
            -
              context " 
     | 
| 
       159 
     | 
    
         
            -
                let(: 
     | 
| 
      
 231 
     | 
    
         
            +
              context "given an article with two concurrent non-block tags" do
         
     | 
| 
      
 232 
     | 
    
         
            +
                let(:text) {<<-EOF
         
     | 
| 
       160 
233 
     | 
    
         
             
                  A "Get the Facts" button sends you to a <em>Washington Post</em> <a href="http://www.washingtonpost.com/wp-srv/special/politics/campaign-finance/" target="_blank">article</a> about campaign finance.
         
     | 
| 
       161 
234 
     | 
    
         
             
                EOF
         
     | 
| 
       162 
235 
     | 
    
         
             
                }
         
     | 
| 
       163 
236 
     | 
    
         | 
| 
       164 
     | 
    
         
            -
                 
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
      
 237 
     | 
    
         
            +
                let(:doc) { Wraptext::Parser.new(text) }
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
                describe '#to_html' do
         
     | 
| 
      
 240 
     | 
    
         
            +
                  it "should preserve spacing between non-block tags" do
         
     | 
| 
      
 241 
     | 
    
         
            +
                    doc.to_html.should match("</em> <a")
         
     | 
| 
      
 242 
     | 
    
         
            +
                  end
         
     | 
| 
      
 243 
     | 
    
         
            +
                end
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
                describe '#to_text' do
         
     | 
| 
      
 246 
     | 
    
         
            +
                  it "should preserve spacing between non-block tags" do
         
     | 
| 
      
 247 
     | 
    
         
            +
                    doc.to_text.should match("Post article")
         
     | 
| 
      
 248 
     | 
    
         
            +
                  end
         
     | 
| 
       166 
249 
     | 
    
         
             
                end
         
     | 
| 
       167 
250 
     | 
    
         
             
              end
         
     | 
| 
       168 
251 
     | 
    
         | 
| 
       169 
     | 
    
         
            -
               
     | 
| 
       170 
     | 
    
         
            -
                 
     | 
| 
      
 252 
     | 
    
         
            +
              context "given an article with leading script tags" do
         
     | 
| 
      
 253 
     | 
    
         
            +
                let(:text) {<<-EOF
         
     | 
| 
       171 
254 
     | 
    
         
             
            <script type='text/javascript' src='http://WTXF.images.worldnow.com/interface/js/WNVideo.js?rnd=543235;hostDomain=www.myfoxphilly.com;playerWidth=645;playerHeight=362;isShowIcon=true;clipId=8157027;flvUri=;partnerclipid=;adTag=Morning%2520Show;advertisingZone=;enableAds=true;landingPage=;islandingPageoverride=false;playerType=STANDARD_EMBEDDEDscript;controlsType=overlay'></script><a href="http://www.myfoxphilly.com" title="Philadelphia News, Weather and Sports from WTXF FOX 29">Philadelphia News, Weather and Sports from WTXF FOX 29</a>
         
     | 
| 
       172 
255 
     | 
    
         | 
| 
       173 
256 
     | 
    
         
             
            Viewers of <em>Good Day Philadelphia</em> got a surprise Wednesday morning when Mark Wahlberg stopped by to do the weather and traffic.
         
     | 
| 
         @@ -179,6 +262,20 @@ Wahlberg goofs amiably but he's a long way from topping Sacha Baron Cohen's loca 
     | 
|
| 
       179 
262 
     | 
    
         | 
| 
       180 
263 
     | 
    
         
             
            <iframe width="640" height="360" src="http://www.youtube.com/embed/KlXd9cooOhE" frameborder="0" allowfullscreen></iframe>
         
     | 
| 
       181 
264 
     | 
    
         
             
            EOF
         
     | 
| 
       182 
     | 
    
         
            -
                 
     | 
| 
      
 265 
     | 
    
         
            +
                }
         
     | 
| 
      
 266 
     | 
    
         
            +
             
     | 
| 
      
 267 
     | 
    
         
            +
                let(:doc) { Wraptext::Parser.new(text) }
         
     | 
| 
      
 268 
     | 
    
         
            +
             
     | 
| 
      
 269 
     | 
    
         
            +
                describe '#to_html' do
         
     | 
| 
      
 270 
     | 
    
         
            +
                  it 'should not strip leading script tags' do
         
     | 
| 
      
 271 
     | 
    
         
            +
                    doc.to_html.should match("<script")
         
     | 
| 
      
 272 
     | 
    
         
            +
                  end
         
     | 
| 
      
 273 
     | 
    
         
            +
                end
         
     | 
| 
      
 274 
     | 
    
         
            +
             
     | 
| 
      
 275 
     | 
    
         
            +
                describe '#to_text' do
         
     | 
| 
      
 276 
     | 
    
         
            +
                  it 'should strip leading script tags' do
         
     | 
| 
      
 277 
     | 
    
         
            +
                    doc.to_text.should_not match("<script")
         
     | 
| 
      
 278 
     | 
    
         
            +
                  end
         
     | 
| 
      
 279 
     | 
    
         
            +
                end
         
     | 
| 
       183 
280 
     | 
    
         
             
              end
         
     | 
| 
       184 
281 
     | 
    
         
             
            end
         
     | 
    
        data/wraptext.gemspec
    CHANGED
    
    | 
         @@ -14,9 +14,9 @@ Gem::Specification.new do |gem| 
     | 
|
| 
       14 
14 
     | 
    
         
             
              gem.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         
     | 
| 
       15 
15 
     | 
    
         
             
              gem.name          = "wraptext"
         
     | 
| 
       16 
16 
     | 
    
         
             
              gem.require_paths = ["lib"]
         
     | 
| 
       17 
     | 
    
         
            -
              gem.version       = "0.1. 
     | 
| 
      
 17 
     | 
    
         
            +
              gem.version       = "0.1.7"
         
     | 
| 
       18 
18 
     | 
    
         
             
              gem.signing_key = '/home/chris/.gemcert/gem-private_key.pem'
         
     | 
| 
       19 
     | 
    
         
            -
              gem.cert_chain  = ['/home/chris/.gemcert/gem-public_cert.pem']
         
     | 
| 
      
 19 
     | 
    
         
            +
              gem.cert_chain  = ['/home/chris/.gemcert/2014/gem-public_cert.pem']
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
              gem.add_dependency('nokogiri')
         
     | 
| 
       22 
22 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,60 +1,52 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: wraptext
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
       5 
     | 
    
         
            -
              version: 0.1.6
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.7
         
     | 
| 
       6 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
7 
     | 
    
         
             
            - Chris Heald
         
     | 
| 
       9 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
10 
     | 
    
         
             
            cert_chain:
         
     | 
| 
       12 
     | 
    
         
            -
            -  
     | 
| 
       13 
     | 
    
         
            -
               
     | 
| 
       14 
     | 
    
         
            -
               
     | 
| 
       15 
     | 
    
         
            -
               
     | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
       17 
     | 
    
         
            -
               
     | 
| 
       18 
     | 
    
         
            -
               
     | 
| 
       19 
     | 
    
         
            -
               
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
       21 
     | 
    
         
            -
               
     | 
| 
       22 
     | 
    
         
            -
               
     | 
| 
       23 
     | 
    
         
            -
               
     | 
| 
       24 
     | 
    
         
            -
               
     | 
| 
       25 
     | 
    
         
            -
               
     | 
| 
       26 
     | 
    
         
            -
               
     | 
| 
       27 
     | 
    
         
            -
               
     | 
| 
       28 
     | 
    
         
            -
               
     | 
| 
       29 
     | 
    
         
            -
               
     | 
| 
       30 
     | 
    
         
            -
               
     | 
| 
       31 
     | 
    
         
            -
               
     | 
| 
       32 
     | 
    
         
            -
               
     | 
| 
       33 
     | 
    
         
            -
               
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
              QU00YzU4WW8xdE5LCjViL0k5ODNPSmhrZVJMTVc0SENnNzduUzRZWWRlUzNT
         
     | 
| 
       36 
     | 
    
         
            -
              eFh4aTBnZEo5bWtyVUMzd3k2cTBENXlEUUYra0hLZGYKdWtHa0VueGxYN3lJ
         
     | 
| 
       37 
     | 
    
         
            -
              eWlUUmUxMEZ4RlRWQk5pUUhnZkhFZUx3U0dlY0VTSDFsZ0lJMmtrNUVBK0ZN
         
     | 
| 
       38 
     | 
    
         
            -
              SndjTEVUSgo5ZnM9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
         
     | 
| 
       39 
     | 
    
         
            -
            date: 2013-02-02 00:00:00.000000000 Z
         
     | 
| 
      
 11 
     | 
    
         
            +
            - |
         
     | 
| 
      
 12 
     | 
    
         
            +
              -----BEGIN CERTIFICATE-----
         
     | 
| 
      
 13 
     | 
    
         
            +
              MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA9MQ8wDQYDVQQDDAZjaGVh
         
     | 
| 
      
 14 
     | 
    
         
            +
              bGQxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2NvbTAe
         
     | 
| 
      
 15 
     | 
    
         
            +
              Fw0xNDAzMDEyMTE4MzJaFw0xNTAzMDEyMTE4MzJaMD0xDzANBgNVBAMMBmNoZWFs
         
     | 
| 
      
 16 
     | 
    
         
            +
              ZDEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29tMIIB
         
     | 
| 
      
 17 
     | 
    
         
            +
              IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwcnX2yl+rbjUztC4V+iUJgWv
         
     | 
| 
      
 18 
     | 
    
         
            +
              NPxqU4bQBaL+w00wVABWr04Hjg+cEkqiJ6A0kXxZIz5uXKhhvsaO50NvHfplVcUf
         
     | 
| 
      
 19 
     | 
    
         
            +
              BxQabIfCS79xdvexXN0or3F5saatGaGa4cj/0uUHjX7w+K5MpEVfbjJp0uAKp62B
         
     | 
| 
      
 20 
     | 
    
         
            +
              wUU2ilmn7EvZhEUPOMQi01t8z8OsOGc8kF2UtU1kGCxLV7eThWqu8CdXrux5E140
         
     | 
| 
      
 21 
     | 
    
         
            +
              7SnFnPlnXNeHqwZdOMZzQ9PiTQAPCKO3AY0aBFQeG3wlFPqkcEjOrtV1h7werUwz
         
     | 
| 
      
 22 
     | 
    
         
            +
              aNb4t5sAuu0f/9B646BOjiMgj1WeUlhgiAsaF5kVvLFNCxwS/xpcN3X01M2KdQID
         
     | 
| 
      
 23 
     | 
    
         
            +
              AQABo3MwcTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUtFVpwfEG
         
     | 
| 
      
 24 
     | 
    
         
            +
              78mBd2ulzsS+SlffdOcwGwYDVR0RBBQwEoEQY2hlYWxkQGdtYWlsLmNvbTAbBgNV
         
     | 
| 
      
 25 
     | 
    
         
            +
              HRIEFDASgRBjaGVhbGRAZ21haWwuY29tMA0GCSqGSIb3DQEBBQUAA4IBAQANcBIJ
         
     | 
| 
      
 26 
     | 
    
         
            +
              vIk27iNu4Ic6awNRy4Rd2YchzW4DaMhfpTXxtYWgAE502OdqUTFtmihd2PmnVRIP
         
     | 
| 
      
 27 
     | 
    
         
            +
              xdP5K2SpbCLuLKFCZ825qp8R02JSNMdgi2d4Btl0vHSO8O3lQ1ZAOM1BZPn2+Kbn
         
     | 
| 
      
 28 
     | 
    
         
            +
              KsiSURg3SnDXItcoedMsS+CQdNyBSdqvpkQ5gn22dN4BSwJg5ApwEYJ9tTuTpRXt
         
     | 
| 
      
 29 
     | 
    
         
            +
              1KCQFe5hamoenfoHO6uUXPEs24PUHnXl8QibWCLbt1FIBpTrJYNGiMHHnB7ip+zv
         
     | 
| 
      
 30 
     | 
    
         
            +
              E7PWS50D9moUJ6xWcemf0qKYC87qBFh0ng73awjG9uf+13lMslqJRMtek8C92cvh
         
     | 
| 
      
 31 
     | 
    
         
            +
              +R9zgQlbeNjy9O1i
         
     | 
| 
      
 32 
     | 
    
         
            +
              -----END CERTIFICATE-----
         
     | 
| 
      
 33 
     | 
    
         
            +
            date: 2014-08-05 00:00:00.000000000 Z
         
     | 
| 
       40 
34 
     | 
    
         
             
            dependencies:
         
     | 
| 
       41 
35 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
     | 
    
         
            -
               
     | 
| 
      
 36 
     | 
    
         
            +
              name: nokogiri
         
     | 
| 
       43 
37 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       44 
     | 
    
         
            -
                none: false
         
     | 
| 
       45 
38 
     | 
    
         
             
                requirements:
         
     | 
| 
       46 
     | 
    
         
            -
                - -  
     | 
| 
      
 39 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       47 
40 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       48 
41 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 42 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
       49 
43 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       50 
44 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
     | 
    
         
            -
                none: false
         
     | 
| 
       52 
45 
     | 
    
         
             
                requirements:
         
     | 
| 
       53 
     | 
    
         
            -
                - -  
     | 
| 
      
 46 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       54 
47 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       55 
48 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
            description: ! "\n    Performs Wordpress-style conversion of single and double newlines
         
     | 
| 
      
 49 
     | 
    
         
            +
            description: "\n    Performs Wordpress-style conversion of single and double newlines
         
     | 
| 
       58 
50 
     | 
    
         
             
              to <p> and <br /> tags. Produces well-formed HTML and intelligently ignores unbreakable\n
         
     | 
| 
       59 
51 
     | 
    
         
             
              \   sections like <script> and <pre> tags. Conveniently turns Wordpress post content
         
     | 
| 
       60 
52 
     | 
    
         
             
              into valid HTML.\n  "
         
     | 
| 
         @@ -89,27 +81,26 @@ files: 
     | 
|
| 
       89 
81 
     | 
    
         
             
            - wraptext.gemspec
         
     | 
| 
       90 
82 
     | 
    
         
             
            homepage: http://github.com/cheald/wraptext
         
     | 
| 
       91 
83 
     | 
    
         
             
            licenses: []
         
     | 
| 
      
 84 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
       92 
85 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       93 
86 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       94 
87 
     | 
    
         
             
            require_paths:
         
     | 
| 
       95 
88 
     | 
    
         
             
            - lib
         
     | 
| 
       96 
89 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       97 
     | 
    
         
            -
              none: false
         
     | 
| 
       98 
90 
     | 
    
         
             
              requirements:
         
     | 
| 
       99 
     | 
    
         
            -
              - -  
     | 
| 
      
 91 
     | 
    
         
            +
              - - '>='
         
     | 
| 
       100 
92 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       101 
93 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       102 
94 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       103 
     | 
    
         
            -
              none: false
         
     | 
| 
       104 
95 
     | 
    
         
             
              requirements:
         
     | 
| 
       105 
     | 
    
         
            -
              - -  
     | 
| 
      
 96 
     | 
    
         
            +
              - - '>='
         
     | 
| 
       106 
97 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       107 
98 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       108 
99 
     | 
    
         
             
            requirements: []
         
     | 
| 
       109 
100 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       110 
     | 
    
         
            -
            rubygems_version:  
     | 
| 
      
 101 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
       111 
102 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       112 
     | 
    
         
            -
            specification_version:  
     | 
| 
      
 103 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
       113 
104 
     | 
    
         
             
            summary: Wraps bare text nodes from an HTML document in <p> tags and splits text nodes
         
     | 
| 
       114 
105 
     | 
    
         
             
              on double newlines.
         
     | 
| 
       115 
106 
     | 
    
         
             
            test_files:
         
     | 
    
        metadata.gz.sig
    CHANGED
    
    | 
         @@ -1,2 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            Y 
     | 
| 
       2 
     | 
    
         
            -
            ��{��3<[�����*�s	�a�~��M�}����t�ʙ�*��:pO�
         
     | 
| 
      
 1 
     | 
    
         
            +
            +��~�Y����<��r�(=��!p�5#��T��h7RZI�%�?�#�Is�
         
     |