dang 1.0.0 → 2.0.0

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,231 @@
1
+ !!!
2
+ <html[dir=ltr][lang=en-US]
3
+
4
+ <head
5
+ <meta[charset=UTF-8] />
6
+ <title The Internet Home Site of Shane Becker title>
7
+ <script[src=/javascripts/html5shiv.js?1293826648] script>
8
+ <script[src=/javascripts/jquery.js?1293826648] script>
9
+ <script[src=/javascripts/paging_keys.js?1293826648] script>
10
+ <link[href=/stylesheets/reset.css?1293826648][media=screen][rel=stylesheet] />
11
+ <link[href=/stylesheets/application.css?1293826648][media=screen][rel=stylesheet] />
12
+ <link[href=/feed][rel=alternate][title=I Am Shane Becker][type=application/atom+xml] />
13
+ <link#short_url[href=http://sbb.me][rel=shorturl][type=text/html] />
14
+ <meta[name=csrf-param][content=authenticity_token] />
15
+ <meta[name=csrf-token][content=wPLyoaxee/y1v+3RUGYzcZqH1fbU526Nf7qYYoJakaY=] />
16
+
17
+ <style
18
+ body {
19
+ background: red;
20
+ }
21
+
22
+ p:after {
23
+ content: "style>";
24
+ }
25
+ style>
26
+ head>
27
+
28
+ <body
29
+ <header.site
30
+ <h1 I Am Shane Becker h1>
31
+ header>
32
+
33
+ <h2#callout <a[href=/products/your-slides-suck] NEW <strong $15 Screencast strong> Your Slides Suck a> h2>
34
+
35
+ <ol.hfeed
36
+
37
+ <: ["thing one", "thing two", "dinosaur"].each do |item| :>
38
+ <li <| item |> to show non/printing ruby li>
39
+ <: end :>
40
+
41
+ <li
42
+ <article#status_1191.hentry.status
43
+ <header
44
+ <h1.entry-title.entry-content
45
+ Growing is Forever :
46
+ <a.link[rel=external][href=http://t.co/qc3LDIN] http://t.co/qc3LDIN a>
47
+ /cc
48
+ <a.at_username[rel=external][href=http://twitter.com/tjnelsonjr] @tjnelsonjr a>
49
+ h1>
50
+ header>
51
+
52
+ <footer
53
+ <h1.vcard
54
+ <a.email[href=mailto:veganstraightedge@gmail.com] <span.fn.author Shane Becker span> a>
55
+ <span.verb published span>
56
+ <span.preposition this span>
57
+ <span.object-type status span>
58
+ <span.preposition on span>
59
+
60
+ <time[datetime=2011-02-06T06:02][pubdate]
61
+ <a.bookmark[href=/statuses/2011/2/5/4][rel=bookmark]
62
+ February, 06, 2011
63
+ <span.preposition at span>
64
+ 06:38:40
65
+ a>
66
+ time>
67
+ h1> <! .vcard !>
68
+
69
+ <table.urls
70
+ <tr
71
+ <th <label.short_url[for=short_url_status_1191] Short URL label> th>
72
+ <th <label.long_url[for=long_url_status_1191] Long URL label> th>
73
+ tr>
74
+ <tr
75
+ <td <input#short_url_status_1191.short_url[name=name_url][type=url][value=http://sbb.me/s4AA4] /> td>
76
+ <td <input#long_url_status_1191.long_url[name=long_url][type=url][value=http://iamshane.com/statuses/2011/2/5/4] /> td>
77
+ tr>
78
+ table> <! .urls !>
79
+
80
+ <h3.redistribution
81
+ Also published at
82
+ <a[href=http://twitter.com/veganstraightedge/statuses/34138891636178944][rel=me] http://twitter.com/veganstraightedge/statuses/34138891636178944 a>
83
+ h3> <! .redistribution !>
84
+ footer> <! footer !>
85
+ article> <! article !>
86
+ li> <! li !>
87
+
88
+ <li
89
+ <article#status_800.hentry.status
90
+ <header
91
+ <h1.entry-title.entry-content
92
+ <a.at_username[rel=external][href=http://twitter.com/gilesgoatboy] @gilesgoatboy a>
93
+ Oh shit. You're right. It was the jigga man. My bad.
94
+ h1>
95
+ header>
96
+
97
+ <footer
98
+ <h1.vcard
99
+ <a.email[href=mailto:veganstraightedge@gmail.com] <span.fn.author Shane Becker span> a>
100
+ <span.verb published span>
101
+ <span.preposition this span>
102
+ <span.object-type status span>
103
+ <span.preposition on span>
104
+
105
+ <time[datetime=2011-02-06T04:02][pubdate]
106
+ <a.bookmark[href=/statuses/2011/2/5/3][rel=bookmark]
107
+ February, 06, 2011
108
+ <span.preposition at span>
109
+ 04:18:28
110
+ a>
111
+ time>
112
+ h1> <! .vcard !>
113
+
114
+ <table.urls
115
+ <tr
116
+ <th <label.short_url[for=short_url_status_800] Short URL label> th>
117
+ <th <label.long_url[for=long_url_status_800] Long URL label> th>
118
+ tr>
119
+ <tr
120
+ <td <input#short_url_status_800.short_url[name=name_url][type=url][value="http://sbb.me/s4AA3] /> td>
121
+ <td <input#long_url_status_800.long_url[name=long_url][type=url][value="http://iamshane.com/statuses/2011/2/5/3] /> td>
122
+ tr>
123
+ table> <! .urls !>
124
+
125
+ <h3.redistribution
126
+ Also published at
127
+ <a[href=http://twitter.com/veganstraightedge/statuses/34103607427076098][rel=me] http://twitter.com/veganstraightedge/statuses/34103607427076098 a>
128
+ h3> <! .redistribution !>
129
+ footer> <! footer !>
130
+ article> <! article !>
131
+ li> <! li !>
132
+
133
+ ol> <! ol.hfeed !>
134
+
135
+ <div.pagination
136
+ <span.previous_page.disabled &#8592; Previous span>
137
+ <em 1 em>
138
+ <a[href=/page/2][rel=next] 2 a>
139
+ <a[href=/page/3] 3 a>
140
+ <a[href=/page/4] 4 a>
141
+ <a[href=/page/5] 5 a>
142
+ <a[href=/page/6] 6 a>
143
+ <a[href=/page/7] 7 a>
144
+ <a[href=/page/8] 8 a>
145
+ <a[href=/page/9] 9 a>
146
+ <span.gap &hellip; span>
147
+ <a[href=/page/415] 415 a>
148
+ <a[href=/page/416] 416 a>
149
+ <a.next_page[href=/page/2][rel=next] Next &#8594; a>
150
+ div> <! .pagination !>
151
+
152
+ <footer#bottom.site
153
+ <h1 A Bit More About Me&hellip; /h1>
154
+ <p
155
+ My name is <span.fn <span.given-name Shane span> <span.family-name Becker span> span>.
156
+ I live in <span.adr <span.locality Los Angeles span>, <span.region CA span> span>.
157
+ I make websites for fun and for profit.
158
+ I&rsquo;m still vegan, still straightedge. I&rsquo;m an anarchist and an atheist.
159
+ My <a[href=http://flickr.com/photos/veganstraightedge/tags/civ][rel=me] dog a> is
160
+ <a[href=http://twitter.com/civthedog][rel=me] Civ a>.
161
+ p>
162
+
163
+ <h2
164
+ I&rsquo;ve made some things (sometimes along side
165
+ <a[href=http://eliduke.com][rel=friend] Eli Duke a> and
166
+ <a[href=http://iambookis.com][rel=friend] Bookis Smuin a>).
167
+ h2>
168
+ <ul
169
+ <li <a[href=http://zinedistro.org][rel=me] Zine Distro a> li>
170
+ <li <a[href=http://listyourlist.com][rel=me] ListYourList a> li>
171
+ <li <a[href=http://theresistancearmy.com][rel=me] The Resistance Army a> li>
172
+ <li <a[href=http://foodsquatting.com][rel=me] Food Squatting a> li>
173
+ <li <a[href=http://thegreatamericanaroadtrip.com][rel=me] The Great Americana Road Trip a> li>
174
+ <li <a[href=http://iamshanebecker.com][rel=me] My Resume a> li>
175
+ ul>
176
+
177
+ <h2 I have profiles on other websites. h2>
178
+ <ul
179
+ <li <a[href=http://twitter.com/veganstraightedge][rel=me] Twitter a> li>
180
+ <li <a[href=http://flickr.com/veganstraightedge][rel=me] Flickr a> li>
181
+ <li <a[href=http://facebook.com/veganstraightedge][rel=me] Facebook a> li>
182
+ <li <a[href=http://vimeo.com/veganstraightedg][rel=me] Vimeo a> li>
183
+ <li <a[href=http://youtube.com/user/veganstraightedge][rel=me] YouTube a> li>
184
+ <li <a[href=http://dribbble.com/players/veganstraightedge][rel=me] Dribble a> li>
185
+ <li <a[href=http://foursquare.com/user/veganstraightedge][rel=me] FourSquare a> li>
186
+ <li <a[href=http://gowalla.com/users/seanbonner][rel=me] Gowalla a> li>
187
+ <li <a[href=http://last.fm/user/vegansxe][rel=me] Last.FM a> li>
188
+ <li <a[href=http://listyourlist.com/veganstraightedge][rel=me] ListYourList a> li>
189
+ <li <a[href=http://github.com/veganstraightedge][rel=me] GitHub a> li>
190
+ <li <a[href=http://www.google.com/profiles/veganstraightedge][rel=me] Google Profile a> li>
191
+ <li <a[href=http://del.icio.us/veganstraightedge][rel=me] Delicious a> li>
192
+ <li <a[href=http://del.icio.us/shaners][rel=me] Delicious a> li>
193
+ <li <a[href=http://pinboard.in/u:veganstraightedge][rel=me] Pinboard a> li>
194
+ ul>
195
+
196
+ <p#contact
197
+ You can contact me by email (<a.email[href=mailto:veganstraightedge@gmail.com] veganstraightedge@gmail.com a>)
198
+ or by phone (<span.tel 801-898-9481 span>). Please, no spam.
199
+ You can <a[href=http://h2vx.com/vcf/iamshane.com] download my vCard a> for your address book.
200
+ All content on this site (unless created by someone else) is licensed under
201
+ <a[href=http://creativecommons.org/licenses/by/2.0/deed.en][rel=license] Creative Commons Attribution License a>
202
+ which means you can republish whatever you want as long as you attribute me and link back to the original page.
203
+ p>
204
+
205
+ <p#no_comments
206
+ A quick note about comments on posts. The short and long of it is, I&rsquo;m over comments.
207
+ They&rsquo;re a lot of work for very little benefit. In migrating my blog posts to this version of my site,
208
+ I threw out most of the comments which were total trash or meaningless drivel.
209
+ I&rsquo;ve made a few exceptions where I felt like they added some value.
210
+ Comments are off and are staying off. If you&rsquo;ve got something to say to me that&rsquo;s private,
211
+ <a[href=mailto:veganstraightedge@gmail.com] email me a>. If you want to say it in the public, a>
212
+ <a[href=http://twitter.com/home?status=@veganstraightedge%20-] write it on Twitter a>
213
+ or your own blog (they&rsquo;re
214
+ <a[href=http://wordpress.com] free a> and <a[href=http://tumblr.com] easy a>).
215
+ p>
216
+ footer> <! footer !>
217
+
218
+ <script
219
+ var _gaq = _gaq || [];
220
+ _gaq.push(['_setAccount', 'UA-193482-20']);
221
+ _gaq.push(['_trackPageview']);
222
+
223
+ (function() {
224
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
225
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
226
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
227
+ })();
228
+ script>
229
+
230
+ body> <! body !>
231
+ html> <! html !>
@@ -0,0 +1,27 @@
1
+ require "spectory/helper"
2
+
3
+ # filters
4
+ # <:markdown
5
+ # # This is a h1 heading
6
+ # ## h2
7
+ # *bold text*
8
+ # * a
9
+ # * of
10
+ # * items
11
+ # markdown:>
12
+
13
+ # <:raw <!--[if (gt IE 9)|!(IE)]><!--> raw:><html.no-js[lang=en]<:raw <!--<![endif]--> raw:>
14
+
15
+ describe "filters" do
16
+ it "can parse simple bodies" do
17
+ Dang.it('<:raw food raw:>').must_equal 'food'
18
+ end
19
+
20
+ it "farms out to raw a filter" do
21
+ Dang.it('<:raw <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" dir="ltr" class="no-js"> <!--<![endif]--> raw:>').must_equal '<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" dir="ltr" class="no-js"> <!--<![endif]-->'
22
+ end
23
+
24
+ it "farms out to 2 raw filters with Dang in between" do
25
+ Dang.it('<:raw <!--[if (gt IE 9)|!(IE)]><!--> raw:> <html.no-js[lang=en][dir=ltr] <:raw <!--<![endif]--> raw:> html>').must_equal "<!--[if (gt IE 9)|!(IE)]><!--> <html class='no-js' lang='en' dir='ltr'><!--<![endif]--></html>"
26
+ end
27
+ end
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'minitest'
3
+ require 'minitest/autorun'
4
+ require 'minitest/pride'
5
+ require File.expand_path("../../lib/dang", __FILE__)
@@ -0,0 +1,11 @@
1
+ require "spectory/helper"
2
+
3
+ describe "sanity" do
4
+ before do
5
+ @sanity = true
6
+ end
7
+
8
+ it "should be sane" do
9
+ @sanity.must_equal true
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ require "spectory/helper"
2
+
3
+ describe "script tags" do
4
+ it "treats script tag special" do
5
+ dang = "
6
+ <script
7
+ var _gaq = _gaq || [];
8
+ _gaq.push(['_setAccount', 'UA-193482-20']);
9
+ _gaq.push(['_trackPageview']);
10
+
11
+ (function() {
12
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
13
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
14
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
15
+ })();
16
+ script>"
17
+
18
+ html = "<script>
19
+ var _gaq = _gaq || [];
20
+ _gaq.push(['_setAccount', 'UA-193482-20']);
21
+ _gaq.push(['_trackPageview']);
22
+
23
+ (function() {
24
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
25
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
26
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
27
+ })();
28
+ </script>"
29
+
30
+ Dang.it(dang).must_equal html
31
+ end
32
+ end
@@ -0,0 +1,26 @@
1
+ require "spectory/helper"
2
+
3
+ describe "selectors" do
4
+ it "transforms Dang tag#id into HTML tag with an id attribute" do
5
+ Dang.it("<div#awesome lorem and or ipsum div>").must_equal "<div id='awesome'>lorem and or ipsum</div>"
6
+ end
7
+
8
+ it "transforms Dang self closing tag with multiple attributes to HTML" do
9
+ Dang.it("<link[href=http://sbb.me][rel=shorturl][type=text/html] />").must_equal "<link href='http://sbb.me' rel='shorturl' type='text/html' />"
10
+ end
11
+ it "transforms Dang self closing tag with an ID and multiple attributes to HTML" do
12
+ Dang.it("<link#short_url[href=http://sbb.me][rel=shorturl][type=text/html] />").must_equal "<link id='short_url' href='http://sbb.me' rel='shorturl' type='text/html' />"
13
+ end
14
+
15
+ it "transforms Dang tag.class into HTML tag with a class" do
16
+ Dang.it("<i.pants party i>").must_equal "<i class='pants'>party</i>"
17
+ end
18
+
19
+ it "transforms Dang tag#id.class into HTML tag with an id and a class" do
20
+ Dang.it("<s#pants.party woo hoo s>").must_equal "<s class='party' id='pants'>woo hoo</s>"
21
+ end
22
+
23
+ it "should merge shorthand and longhand classes" do
24
+ Dang.it("<html#foo.bar[class=snap crackle pop mitch] things html>").must_equal "<html class='bar snap crackle pop mitch' id='foo'>things</html>"
25
+ end
26
+ end
@@ -0,0 +1,29 @@
1
+ require "spectory/helper"
2
+
3
+ describe "style tags" do
4
+ it "treats style tags special" do
5
+ dang = "
6
+ <style
7
+ body {
8
+ background: red;
9
+ }
10
+
11
+ p:after {
12
+ content: '}';
13
+ }
14
+ style>
15
+ "
16
+
17
+ html = "<style>
18
+ body {
19
+ background: red;
20
+ }
21
+
22
+ p:after {
23
+ content: '}';
24
+ }
25
+ </style>"
26
+
27
+ Dang.it(dang).must_equal html
28
+ end
29
+ end
@@ -0,0 +1,71 @@
1
+ require "spectory/helper"
2
+
3
+ describe "tags" do
4
+ it "transforms Dang tag to HTML tag with no content" do
5
+ Dang.it("<b b>").must_equal "<b></b>"
6
+ end
7
+
8
+ it "transforms Dang tag to HTML tag" do
9
+ Dang.it("<b BOLD b>").must_equal "<b>BOLD</b>"
10
+ end
11
+
12
+ it "transforms Dang self closing tag to self closing HTML tag" do
13
+ Dang.it("<img[src=foo.png] />").must_equal "<img src='foo.png' />"
14
+ end
15
+
16
+ it "transforms Dang self closing tag with multiple attributes to HTML" do
17
+ Dang.it("<img[src=foo.png][alt=rock] />").must_equal "<img src='foo.png' alt='rock' />"
18
+ end
19
+
20
+ it "transforms Dang self closing tag with no attributes to HTML" do
21
+ Dang.it("<img />").must_equal "<img />"
22
+ end
23
+
24
+ it "transforms Dang self closing tag with an ID to HTML" do
25
+ Dang.it("<img#id />").must_equal "<img id='id' />"
26
+ end
27
+
28
+ it "transforms Dang empty script tag to HTML" do
29
+ Dang.it("<script[src=/javascripts/jquery.js?1293826648] script>").must_equal "<script src='/javascripts/jquery.js?1293826648'></script>"
30
+ end
31
+
32
+ it "transforms Dang tags with an attribute and an explicit closer" do
33
+ Dang.it("<a[href=/] Home a>").must_equal "<a href='/'>Home</a>"
34
+ end
35
+
36
+ it "transforms Dang tags nested inline to inline nested HTML tags" do
37
+ Dang.it("<h1 <a[href=/] Home a> h1>").must_equal "<h1><a href='/'>Home</a></h1>"
38
+ end
39
+
40
+ it "transforms Dang tags nested inline to inline nested HTML tags wrapped in text" do
41
+ Dang.it("<h1 STUFF <a[href=/] Home a> MORE STUFF h1>").must_equal "<h1>STUFF <a href='/'>Home</a> MORE STUFF</h1>"
42
+ end
43
+
44
+ it "transforms Dang tags nested multiline to multiline nested HTML tags" do
45
+ dang = "
46
+ <header
47
+ <hgroup
48
+ <h1 Dang Lang h1>
49
+ <h2 It's the angle of the dangle h2>
50
+ hgroup>
51
+ header>"
52
+
53
+ html =
54
+ "<header>
55
+ <hgroup>
56
+ <h1>Dang Lang</h1>
57
+ <h2>It's the angle of the dangle</h2>
58
+ </hgroup>
59
+ </header>"
60
+
61
+ Dang.it(dang).must_equal html
62
+ end
63
+
64
+ it "transforms sibling root tags" do
65
+ Dang.it("<b BOLD b><i ME i>").must_equal "<b>BOLD</b><i>ME</i>"
66
+ end
67
+
68
+ it "transforms sibling root tags with significant whitespace" do
69
+ Dang.it("<b BOLD b> <i ME i>").must_equal "<b>BOLD</b> <i>ME</i>"
70
+ end
71
+ end
@@ -0,0 +1,12 @@
1
+ require "spectory/helper"
2
+
3
+ # TODO experimental
4
+ # for v2
5
+
6
+ # describe "array classes" do
7
+ # it "joins an array of items into space separate attribute values" do
8
+ # classes = %w(snap crackle pop)
9
+ # Dang.it("<body#mitch[class={ classes }]").must_equal "<body id='mitch' class='snap crackle pop'>"
10
+ # Dang.it("<body#mitch[class={ %w(a b c) }]").must_equal "<body id='mitch' class='a b c'>"
11
+ # end
12
+ # end