podgraph 0.0.1

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.
@@ -0,0 +1,320 @@
1
+ <?xml version="1.0" encoding="koi8-r" ?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=koi8-r" />
6
+ <meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
7
+ <title>Mixergy: Daniel Delaney (VendrTV)</title>
8
+ <style type="text/css">
9
+
10
+ /*
11
+ :Author: David Goodger (goodger@python.org)
12
+ :Id: $Id: html4css1.css 5196 2007-06-03 20:25:28Z wiemann $
13
+ :Copyright: This stylesheet has been placed in the public domain.
14
+
15
+ Default cascading style sheet for the HTML output of Docutils.
16
+
17
+ See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
18
+ customize this style sheet.
19
+ */
20
+
21
+ /* used to remove borders from tables and images */
22
+ .borderless, table.borderless td, table.borderless th {
23
+ border: 0 }
24
+
25
+ table.borderless td, table.borderless th {
26
+ /* Override padding for "table.docutils td" with "! important".
27
+ The right padding separates the table cells. */
28
+ padding: 0 0.5em 0 0 ! important }
29
+
30
+ .first {
31
+ /* Override more specific margin styles with "! important". */
32
+ margin-top: 0 ! important }
33
+
34
+ .last, .with-subtitle {
35
+ margin-bottom: 0 ! important }
36
+
37
+ .hidden {
38
+ display: none }
39
+
40
+ a.toc-backref {
41
+ text-decoration: none ;
42
+ color: black }
43
+
44
+ blockquote.epigraph {
45
+ margin: 2em 5em ; }
46
+
47
+ dl.docutils dd {
48
+ margin-bottom: 0.5em }
49
+
50
+ /* Uncomment (and remove this text!) to get bold-faced definition list terms
51
+ dl.docutils dt {
52
+ font-weight: bold }
53
+ */
54
+
55
+ div.abstract {
56
+ margin: 2em 5em }
57
+
58
+ div.abstract p.topic-title {
59
+ font-weight: bold ;
60
+ text-align: center }
61
+
62
+ div.admonition, div.attention, div.caution, div.danger, div.error,
63
+ div.hint, div.important, div.note, div.tip, div.warning {
64
+ margin: 2em ;
65
+ border: medium outset ;
66
+ padding: 1em }
67
+
68
+ div.admonition p.admonition-title, div.hint p.admonition-title,
69
+ div.important p.admonition-title, div.note p.admonition-title,
70
+ div.tip p.admonition-title {
71
+ font-weight: bold ;
72
+ font-family: sans-serif }
73
+
74
+ div.attention p.admonition-title, div.caution p.admonition-title,
75
+ div.danger p.admonition-title, div.error p.admonition-title,
76
+ div.warning p.admonition-title {
77
+ color: red ;
78
+ font-weight: bold ;
79
+ font-family: sans-serif }
80
+
81
+ /* Uncomment (and remove this text!) to get reduced vertical space in
82
+ compound paragraphs.
83
+ div.compound .compound-first, div.compound .compound-middle {
84
+ margin-bottom: 0.5em }
85
+
86
+ div.compound .compound-last, div.compound .compound-middle {
87
+ margin-top: 0.5em }
88
+ */
89
+
90
+ div.dedication {
91
+ margin: 2em 5em ;
92
+ text-align: center ;
93
+ font-style: italic }
94
+
95
+ div.dedication p.topic-title {
96
+ font-weight: bold ;
97
+ font-style: normal }
98
+
99
+ div.figure {
100
+ margin-left: 2em ;
101
+ margin-right: 2em }
102
+
103
+ div.footer, div.header {
104
+ clear: both;
105
+ font-size: smaller }
106
+
107
+ div.line-block {
108
+ display: block ;
109
+ margin-top: 1em ;
110
+ margin-bottom: 1em }
111
+
112
+ div.line-block div.line-block {
113
+ margin-top: 0 ;
114
+ margin-bottom: 0 ;
115
+ margin-left: 1.5em }
116
+
117
+ div.sidebar {
118
+ margin: 0 0 0.5em 1em ;
119
+ border: medium outset ;
120
+ padding: 1em ;
121
+ background-color: #ffffee ;
122
+ width: 40% ;
123
+ float: right ;
124
+ clear: right }
125
+
126
+ div.sidebar p.rubric {
127
+ font-family: sans-serif ;
128
+ font-size: medium }
129
+
130
+ div.system-messages {
131
+ margin: 5em }
132
+
133
+ div.system-messages h1 {
134
+ color: red }
135
+
136
+ div.system-message {
137
+ border: medium outset ;
138
+ padding: 1em }
139
+
140
+ div.system-message p.system-message-title {
141
+ color: red ;
142
+ font-weight: bold }
143
+
144
+ div.topic {
145
+ margin: 2em }
146
+
147
+ h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
148
+ h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
149
+ margin-top: 0.4em }
150
+
151
+ h1.title {
152
+ text-align: center }
153
+
154
+ h2.subtitle {
155
+ text-align: center }
156
+
157
+ hr.docutils {
158
+ width: 75% }
159
+
160
+ img.align-left {
161
+ clear: left }
162
+
163
+ img.align-right {
164
+ clear: right }
165
+
166
+ ol.simple, ul.simple {
167
+ margin-bottom: 1em }
168
+
169
+ ol.arabic {
170
+ list-style: decimal }
171
+
172
+ ol.loweralpha {
173
+ list-style: lower-alpha }
174
+
175
+ ol.upperalpha {
176
+ list-style: upper-alpha }
177
+
178
+ ol.lowerroman {
179
+ list-style: lower-roman }
180
+
181
+ ol.upperroman {
182
+ list-style: upper-roman }
183
+
184
+ p.attribution {
185
+ text-align: right ;
186
+ margin-left: 50% }
187
+
188
+ p.caption {
189
+ font-style: italic }
190
+
191
+ p.credits {
192
+ font-style: italic ;
193
+ font-size: smaller }
194
+
195
+ p.label {
196
+ white-space: nowrap }
197
+
198
+ p.rubric {
199
+ font-weight: bold ;
200
+ font-size: larger ;
201
+ color: maroon ;
202
+ text-align: center }
203
+
204
+ p.sidebar-title {
205
+ font-family: sans-serif ;
206
+ font-weight: bold ;
207
+ font-size: larger }
208
+
209
+ p.sidebar-subtitle {
210
+ font-family: sans-serif ;
211
+ font-weight: bold }
212
+
213
+ p.topic-title {
214
+ font-weight: bold }
215
+
216
+ pre.address {
217
+ margin-bottom: 0 ;
218
+ margin-top: 0 ;
219
+ font-family: serif ;
220
+ font-size: 100% }
221
+
222
+ pre.literal-block, pre.doctest-block {
223
+ margin-left: 2em ;
224
+ margin-right: 2em }
225
+
226
+ span.classifier {
227
+ font-family: sans-serif ;
228
+ font-style: oblique }
229
+
230
+ span.classifier-delimiter {
231
+ font-family: sans-serif ;
232
+ font-weight: bold }
233
+
234
+ span.interpreted {
235
+ font-family: sans-serif }
236
+
237
+ span.option {
238
+ white-space: nowrap }
239
+
240
+ span.pre {
241
+ white-space: pre }
242
+
243
+ span.problematic {
244
+ color: red }
245
+
246
+ span.section-subtitle {
247
+ /* font-size relative to parent (h1..h6 element) */
248
+ font-size: 80% }
249
+
250
+ table.citation {
251
+ border-left: solid 1px gray;
252
+ margin-left: 1px }
253
+
254
+ table.docinfo {
255
+ margin: 2em 4em }
256
+
257
+ table.docutils {
258
+ margin-top: 0.5em ;
259
+ margin-bottom: 0.5em }
260
+
261
+ table.footnote {
262
+ border-left: solid 1px black;
263
+ margin-left: 1px }
264
+
265
+ table.docutils td, table.docutils th,
266
+ table.docinfo td, table.docinfo th {
267
+ padding-left: 0.5em ;
268
+ padding-right: 0.5em ;
269
+ vertical-align: top }
270
+
271
+ table.docutils th.field-name, table.docinfo th.docinfo-name {
272
+ font-weight: bold ;
273
+ text-align: left ;
274
+ white-space: nowrap ;
275
+ padding-left: 0 }
276
+
277
+ h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
278
+ h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
279
+ font-size: 100% }
280
+
281
+ ul.auto-toc {
282
+ list-style-type: none }
283
+
284
+ </style>
285
+ </head>
286
+ <body>
287
+ <div class="document" id="mixergy-daniel-delaney-vendrtv">
288
+
289
+ <h1> ww</h1>
290
+ <p><a class="reference external" href="http://bit.ly/9pS1DZ">��������</a> is a completely mess. �����
291
+ ���������� ��� ����, ��� � ����� ��� �����. ������, ������ ��� �������
292
+ ��������� ��� �������������� �������--���� �������� ������ �������� so
293
+ called <em>������ ����� �����</em> � ������ ���� ������� ���������? ��, ������,
294
+ ����� ������ ����� ���������.</p>
295
+ <p>�� ��� ��� ������. �������� �������� ����� �� ��� ���:</p>
296
+ <ol class="arabic simple">
297
+ <li>������, ������� �� ������� ��������� ���� � ����, �������� �������
298
+ ������������ ������������� �����.</li>
299
+ <li>� ���� ��������� ����������� (�����-�� ������������� Fine Art degree)
300
+ �� �� ��� ����� �� ������ ������ � ������� (n<sup>2</sup>-n)/2, ����� ��
301
+ �� �� �������� ���� 7 ������� &quot;�������� ���&quot;. ��� �� �����, ���
302
+ ������ ��� ������ ���� overcommunication � ��������� �������� �� 3-�
303
+ �������.</li>
304
+ <li>������ ������� �� ������, � ��� ����� ������, content creators for
305
+ the web � ��������� �������� ���� ���, �������� ����� ��������� ���
306
+ ��������.</li>
307
+ <li>���� �� ������ &quot;��� ���� ���&quot;, � best content ever.</li>
308
+ <li>��������: ����� ����� ��� ����� ���� �� 37 Signals! �� ������ ��
309
+ �����. ������ �� �������� ��� 2 �����, �� ���� ���� ����� � ���
310
+ ������� ����� ��� � ����� ���������-������������ �� ���.</li>
311
+ <li>��� ����� (����� �������� ��������) ��� ���������� �������������� ���
312
+ ������� ������������ ��������� (��� ��� ��� ������ ������ &quot;I don't
313
+ know&quot;)--��� ������ ���������� �.3 � �.5 � ��� �������� ��������.</li>
314
+ </ol>
315
+ <p>���������, ��� ��� ��� � �� �����, ������ ������������ ������� ������
316
+ ����� �� ����� �., �������, � ��������, ���������� ���� �� ��� ����, ���
317
+ ��������� � ������.</p>
318
+ </div>
319
+ </body>
320
+ </html>
@@ -0,0 +1,3 @@
1
+ :to: alex@goliard
2
+ # :to: post@podgraph-test.posterous.com
3
+ :from: alexander.gromnitsky@gmail.com
Binary file
@@ -0,0 +1,5 @@
1
+ <html>
2
+ <body>
3
+ Nothing <i>interesting</i>.
4
+ </body>
5
+ </html>
data/test/related.html ADDED
@@ -0,0 +1,15 @@
1
+ <html>
2
+ <body>
3
+ <div>
4
+ <h1>The Test</h1>
5
+ <p> of the best</p>
6
+ of fucking <img src='blue.png'/> inline<br/>
7
+ <p>
8
+ <img
9
+ src='http://images.google.com/intl/en_ALL/images/logos/images_logo_lg.gif'/><div>
10
+ and <i>external<br/><img src='yellow.png'/></i> images.</div>
11
+ </p>
12
+ (hidden text)
13
+ </div>
14
+ </body>
15
+ </html>
data/test/simple.html ADDED
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <body>
3
+ <div>
4
+ <h1>Really, dude</h1>
5
+ <p>Here is nothing <i>interesting</i>.</p>
6
+ </div>
7
+ </body>
8
+ </html>
data/test/ts_mime.rb ADDED
@@ -0,0 +1,131 @@
1
+ require 'test/unit'
2
+ require 'digest/md5'
3
+
4
+ require_relative '../lib/podgraph/posterous'
5
+
6
+ class TestMime < Test::Unit::TestCase
7
+ def setup
8
+ @testdir = File.expand_path(File.dirname(__FILE__))
9
+ @to = 'alex@goliard'
10
+ @from = 'alexander.gromnitsky@gmail.com'
11
+ end
12
+
13
+ def test_broken_subject
14
+ e = assert_raise(RuntimeError) {
15
+ p = Podgraph::Posterous.new(@testdir+'/nosubject.html', @to,
16
+ @from, 'related')
17
+ }
18
+ assert_match(/cannot extract the subject/, e.message)
19
+ end
20
+
21
+ def test_missing_input_file
22
+ e = assert_raise(Errno::ENOENT) {
23
+ p = Podgraph::Posterous.new('something_completly_unreliable.html',
24
+ @to, @from, 'related')
25
+ }
26
+ assert_match(/no such file or directory/i, e.message)
27
+ end
28
+
29
+ def test_empty_input_file
30
+ e = assert_raise(RuntimeError) {
31
+ p = Podgraph::Posterous.new(@testdir+'/empty.html',
32
+ @to, @from, 'related')
33
+ }
34
+ assert_match(/cannot extract the subject/, e.message)
35
+ end
36
+
37
+ def test_invalid_input_file_01
38
+ e = assert_raise(RuntimeError) {
39
+ p = Podgraph::Posterous.new(@testdir+'/garbage_01.html',
40
+ @to, @from, 'related')
41
+ }
42
+ assert_match(/cannot extract the subject/, e.message)
43
+ end
44
+
45
+ def test_invalid_input_file_02
46
+ assert_raise(REXML::ParseException) {
47
+ p = Podgraph::Posterous.new(@testdir+'/garbage_02.html',
48
+ @to, @from, 'related')
49
+ }
50
+ end
51
+
52
+ def test_invalid_input_file_03
53
+ e = assert_raise(RuntimeError) {
54
+ p = Podgraph::Posterous.new(@testdir+'/garbage_03.html',
55
+ @to, @from, 'related')
56
+ }
57
+ assert_match(/body is empty or filled with nonsence/, e.message)
58
+ end
59
+
60
+ def test_invalid_input_file_04
61
+ e = assert_raise(RuntimeError) {
62
+ p = Podgraph::Posterous.new(@testdir+'/garbage_04.html',
63
+ @to, @from, 'related')
64
+ mail = p.generate()
65
+ }
66
+ assert_match(/cannot attach/, e.message)
67
+ end
68
+
69
+
70
+ # NOTE: run
71
+ #
72
+ # % ../bin/podgraph -S simple.html | grep -v -e ^Date: -e ^Message-ID: -e '^user-agent:'|md5
73
+ #
74
+ # to get a new hash for this test
75
+ def test_simple
76
+ p = Podgraph::Posterous.new(@testdir+'/simple.html', @to, @from, 'related')
77
+ mail = p.generate().to_s
78
+ mail.sub!(/^Date: .+$\n/, '')
79
+ mail.sub!(/^Message-ID: .+$\n/, '')
80
+ mail.sub!(/^user-agent: .+$\n/, '')
81
+ # p mail
82
+ # puts mail
83
+ assert_equal('ffaf6609a4544258e59dfde9f766820f',
84
+ Digest::MD5.hexdigest("#{mail}\n") ) # don't forget a newline!
85
+ end
86
+
87
+ def test_related
88
+ p = mail = nil
89
+ Dir.chdir(@testdir) do
90
+ p = Podgraph::Posterous.new(@testdir+'/related.html', @to, @from, 'related')
91
+ mail = p.generate()
92
+ end
93
+ assert_equal(mail.multipart?, true)
94
+ assert_equal(mail.parts.length, 3) # html and 2 images
95
+ # check for 2 images
96
+ assert_equal(p.o[:a_marks].key?('blue.png'), true)
97
+ assert_equal(p.o[:a_marks].key?('yellow.png'), true)
98
+
99
+ # html
100
+ assert_equal(mail.parts[0].content_type, "text/html; charset=UTF-8")
101
+ assert_not_equal(mail.parts[0].content_disposition, "inline")
102
+ assert_equal(mail.parts[1].content_disposition, "inline")
103
+ assert_equal(mail.parts[2].content_disposition, "inline")
104
+
105
+ # search in the html our inline images
106
+ mail.parts[1..-1].each {|i|
107
+ assert_match(Regexp.new("cid:#{i.content_id[1..-1]}"),
108
+ mail.parts[0].body.decoded)
109
+ }
110
+ end
111
+
112
+ def test_mixed
113
+ p = mail = nil
114
+ Dir.chdir(@testdir) do
115
+ p = Podgraph::Posterous.new('related.html', @to, @from, 'mixed')
116
+ mail = p.generate()
117
+ end
118
+ assert_equal(mail.multipart?, true)
119
+ assert_equal(mail.parts.length, 3) # html and 2 images
120
+ # check for 2 images
121
+ assert_equal(p.o[:attachment].include?('blue.png'), true)
122
+ assert_equal(p.o[:attachment].include?('yellow.png'), true)
123
+
124
+ # html
125
+ assert_equal(mail.parts[0].content_type, "text/html; charset=UTF-8")
126
+ assert_equal(mail.parts[0].content_disposition, "inline")
127
+ assert_not_equal(mail.parts[1].content_disposition, "inline")
128
+ assert_not_equal(mail.parts[2].content_disposition, "inline")
129
+ end
130
+
131
+ end
data/test/yellow.png ADDED
Binary file
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: podgraph
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Alexander Gromnitsky
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-10 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: mail
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 1
30
+ - 3
31
+ version: 2.1.3
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description:
35
+ email: alexander.gromnitsky@gmail.com
36
+ executables:
37
+ - podgraph
38
+ extensions: []
39
+
40
+ extra_rdoc_files: []
41
+
42
+ files:
43
+ - lib/podgraph/posterous.rb
44
+ - bin/podgraph
45
+ - LICENSE
46
+ - Rakefile
47
+ - README.rdoc
48
+ - TODO
49
+ - test/mechanical-turk/1.html
50
+ - test/mechanical-turk/2.html
51
+ - test/mechanical-turk/sun.jpg
52
+ - test/mechanical-turk/3.html
53
+ - test/mechanical-turk/config.yaml
54
+ - test/mechanical-turk/Baby-Bunnie.jpg
55
+ - test/nosubject.html
56
+ - test/ts_mime.rb
57
+ - test/empty.html
58
+ - test/related.html
59
+ - test/config.yaml
60
+ - test/blue.png
61
+ - test/garbage_01.html
62
+ - test/garbage_02.html
63
+ - test/simple.html
64
+ - test/garbage_03.html
65
+ - test/garbage_04.html
66
+ - test/yellow.png
67
+ has_rdoc: true
68
+ homepage:
69
+ licenses: []
70
+
71
+ post_install_message:
72
+ rdoc_options:
73
+ - -m
74
+ - Podgraph
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ segments:
82
+ - 1
83
+ - 9
84
+ version: "1.9"
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ segments:
90
+ - 0
91
+ version: "0"
92
+ requirements: []
93
+
94
+ rubyforge_project:
95
+ rubygems_version: 1.3.6
96
+ signing_key:
97
+ specification_version: 3
98
+ summary: Creates a MIME mail from a XHTML source and delivers it to Posterous.com.
99
+ test_files:
100
+ - test/ts_mime.rb