piano 0.7.1 → 0.7.2
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.
- data/README.rdoc +11 -0
- data/lib/piano.rb +8 -0
- data/lib/piano/version.rb +1 -1
- data/sample/index.haml +1 -1
- metadata +9 -9
data/README.rdoc
CHANGED
@@ -97,6 +97,8 @@ Remember that the server folder will be the working directory when the script is
|
|
97
97
|
|
98
98
|
=== Convenience helpers
|
99
99
|
|
100
|
+
==== <tt>style</tt> and <tt>script</tt>
|
101
|
+
|
100
102
|
Piano features two convenience helpers to include stylesheets and javascripts: <tt>style("style.css")</tt> and <tt>script("app.js")</tt>.
|
101
103
|
|
102
104
|
You can use them in your haml templates like this:
|
@@ -108,9 +110,17 @@ You can use them in your haml templates like this:
|
|
108
110
|
= style "style.css"
|
109
111
|
= script "app.js"
|
110
112
|
|
113
|
+
==== <tt>extract</tt>
|
114
|
+
|
111
115
|
Another helper you may find useful is <tt>extract("source_text/html", word_count = 80)</tt>. Returns an extract of the first <tt>word_count</tt> words (default is 80), html tags stripped, and closed by <tt>"..."</tt> . It does nothing is the text is less than <tt>word_count</tt> words in length.
|
112
116
|
|
113
117
|
%p= extract content, 25
|
118
|
+
|
119
|
+
==== <tt>unicode_entities</tt>
|
120
|
+
|
121
|
+
Useful for hashing email addresses (and hiding them from crawlers. Returns the htmlentities in unicode for each letter of the argument string. For example:
|
122
|
+
|
123
|
+
%p= unicode_entities "sample@address.com"
|
114
124
|
|
115
125
|
Code is poetry.
|
116
126
|
|
@@ -133,6 +143,7 @@ Etags cause client side caching. This should not be a problem since the hash cha
|
|
133
143
|
* Folder paths and sinatra default arguments configurable.
|
134
144
|
* Condition for disabling default Piano routes
|
135
145
|
* Further documentation of Piano helpers
|
146
|
+
* Custom error when there's no data
|
136
147
|
* More helpers for semantic data handling.
|
137
148
|
* Deploy of sample with command line <tt>--sample</tt> argument.
|
138
149
|
* Setup to production enviroment option (why not?!)
|
data/lib/piano.rb
CHANGED
@@ -85,6 +85,14 @@ class Piano < Sinatra::Base
|
|
85
85
|
return text if words.length <= length
|
86
86
|
words[0..(length-1)].join(" ") + "..."
|
87
87
|
end
|
88
|
+
|
89
|
+
def unicode_entities(string)
|
90
|
+
encodings = ""
|
91
|
+
string.codepoints do |c|
|
92
|
+
encodings += "&##{c};"
|
93
|
+
end
|
94
|
+
encodings
|
95
|
+
end
|
88
96
|
end
|
89
97
|
|
90
98
|
def self.play!
|
data/lib/piano/version.rb
CHANGED
data/sample/index.haml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: piano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sinatra
|
17
|
-
requirement: &
|
17
|
+
requirement: &20782944 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 1.2.6
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *20782944
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: haml
|
28
|
-
requirement: &
|
28
|
+
requirement: &20782644 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 3.1.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *20782644
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: sass
|
39
|
-
requirement: &
|
39
|
+
requirement: &20782368 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 3.1.1
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *20782368
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: coffee-script
|
50
|
-
requirement: &
|
50
|
+
requirement: &20782092 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
version: 2.2.0
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *20782092
|
59
59
|
description: Out-of-the-box sinatra server for web site sketching using haml + sass
|
60
60
|
+ coffee-script
|
61
61
|
email:
|