liveblog 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/liveblog.css +18 -10
- data/lib/liveblog.rb +44 -6
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d96398f0aa49154552843c326d16ce6efa8c913a
|
4
|
+
data.tar.gz: 5827683e8b4ca1996822dbddd0f060b0f2773b3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91f0358914a2986b6ba18a45b91d55102fdf89a8d0a9c0f07ef4b3a5e90949863f16814c7ceaffc5bd2b5c7c29359007f0658853f6528aea9a0855435399d932
|
7
|
+
data.tar.gz: 3f155f79a3d4d1301c5492ed4a82ac01a252bb807cc60907c6e5da0c36b9619e500575f301dd9de5969553b229c983c904fe26b94a9d52a2bd163a876502d8c6
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/liveblog.css
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
body {
|
1
|
+
body {
|
2
|
+
background-color: #c48f33;
|
3
|
+
max-width: 1000px;
|
4
|
+
}
|
2
5
|
|
3
6
|
|
4
7
|
header{
|
@@ -35,21 +38,21 @@ body { background-color: #c48f33;}
|
|
35
38
|
background-color: transparent;
|
36
39
|
color: #AFC332;
|
37
40
|
float: left;
|
38
|
-
margin: 1em
|
39
|
-
max-width:
|
41
|
+
margin: 1em 1em;
|
42
|
+
max-width: 560px;
|
40
43
|
}
|
41
44
|
|
42
45
|
#summary ul {
|
43
46
|
background-color: #D5A95D;
|
44
47
|
list-style-type: square;
|
45
|
-
margin:
|
48
|
+
margin: 0.9em; padding: 1.3em;
|
46
49
|
}
|
47
50
|
|
48
51
|
#summary ul li {
|
49
52
|
background-color: #D5A95D;
|
50
53
|
font-family: arial, verdana;
|
51
|
-
font-size: 1.
|
52
|
-
margin: 0.2em
|
54
|
+
font-size: 1.3em;
|
55
|
+
margin: 0.2em 1.4em; padding: 0.5em;
|
53
56
|
}
|
54
57
|
|
55
58
|
#summary ul li a {
|
@@ -120,7 +123,8 @@ section {
|
|
120
123
|
background-color: #E2C38D;
|
121
124
|
color: #4532C3;
|
122
125
|
font-size: 1.2em;
|
123
|
-
margin: 1.7em 0.7em 1.7em 1.7em; padding: 2.0em
|
126
|
+
margin: 1.7em 0.7em 1.7em 1.7em; padding: 2.0em 2.0em 2.0em 2.0em;
|
127
|
+
padding-bottom: 5em;
|
124
128
|
max-width: 500px
|
125
129
|
}
|
126
130
|
|
@@ -134,7 +138,8 @@ section {
|
|
134
138
|
section p {
|
135
139
|
background-color: #ee3;
|
136
140
|
background-color: transparent;
|
137
|
-
|
141
|
+
font-size: 1.1em;
|
142
|
+
margin: 0.4em 0.4em; padding: 0.6em 0.7em;
|
138
143
|
}
|
139
144
|
|
140
145
|
section a {
|
@@ -180,7 +185,7 @@ aside ul {
|
|
180
185
|
background-color: #e33;
|
181
186
|
|
182
187
|
font-family: helvetica, arial;
|
183
|
-
font-size: 2.
|
188
|
+
font-size: 2.0em;
|
184
189
|
font-weight: 900;
|
185
190
|
|
186
191
|
margin: 0.4em;
|
@@ -245,5 +250,8 @@ article>footer, aside ul li{
|
|
245
250
|
|
246
251
|
pre, output {
|
247
252
|
background-color: rgba(200,200,200,0.4);
|
248
|
-
font-size: 0.
|
253
|
+
font-size: 0.7em;
|
254
|
+
margin: 0.4em; padding: 0.6em;
|
255
|
+
overflow-x: scroll;
|
256
|
+
|
249
257
|
}
|
data/lib/liveblog.rb
CHANGED
@@ -39,12 +39,22 @@ class LiveBlog
|
|
39
39
|
|
40
40
|
def add_entry(raw_entry)
|
41
41
|
|
42
|
-
entry, hashtag = raw_entry.split(/\s*(?=#\w+$)/)
|
42
|
+
entry, hashtag = raw_entry.split(/\s*(?=#\w+$)/)
|
43
|
+
hashtag.downcase!
|
43
44
|
|
44
45
|
success, msg = case raw_entry
|
45
|
-
|
46
|
-
when
|
47
|
-
|
46
|
+
|
47
|
+
when /^#\s*\w.*#\w+$/ then
|
48
|
+
|
49
|
+
add_section raw_entry
|
50
|
+
|
51
|
+
when /#\w+$/ then
|
52
|
+
|
53
|
+
entry.gsub!(/\B!t\b/, time())
|
54
|
+
add_section_entry entry, hashtag
|
55
|
+
|
56
|
+
else
|
57
|
+
[false, 'no valid entry found']
|
48
58
|
end
|
49
59
|
|
50
60
|
return [false, msg] unless success
|
@@ -53,6 +63,7 @@ class LiveBlog
|
|
53
63
|
|
54
64
|
# we reserve 30 characters for the link
|
55
65
|
len = (140 - 30 - hashtag.length)
|
66
|
+
raw_entry.gsub!(/\B!t\b/,'')
|
56
67
|
entry = raw_entry.length > len ? "%s... %s" % [raw_entry.slice(0, len), hashtag] : raw_entry
|
57
68
|
message = "%s %s%s" % [entry, static_urlpath(), hashtag]
|
58
69
|
|
@@ -84,6 +95,28 @@ title: LiveBlog #{ordinalize(@d.day) + @d.strftime(" %B %Y")}
|
|
84
95
|
|
85
96
|
EOF
|
86
97
|
|
98
|
+
t = Time.now
|
99
|
+
# keyword substitions
|
100
|
+
# a !t becomes the Time.now.strftime("%-I:%M%P") #=> 4:27pm
|
101
|
+
s.gsub!(/\B\*started\s+<time>(\d+:\d+[ap]m)<\/time>\*\B\s*!tc/) do |x|
|
102
|
+
|
103
|
+
raw_start_time = $1
|
104
|
+
|
105
|
+
start_time = Time.parse raw_start_time
|
106
|
+
seconds = t - start_time
|
107
|
+
list = Subunit.new(units={minutes:60, hours:60}, seconds: seconds )\
|
108
|
+
.to_h.to_a
|
109
|
+
n = list.find {|_,v| v > 0 }
|
110
|
+
duration = list[list.index(n)..-2].map {|x|"%d %s" % x.reverse}\
|
111
|
+
.join(', ')
|
112
|
+
"*completed %s; duration: %s*" % [time(t), duration]
|
113
|
+
end
|
114
|
+
|
115
|
+
s.gsub!(/\B!ts\b/, "*started #{time(t)}*")
|
116
|
+
s.gsub!(/\B!tc\b/, "*completed #{time(t)}*")
|
117
|
+
s.gsub!(/\B!t\b/, time(t))
|
118
|
+
|
119
|
+
|
87
120
|
FileUtils.mkdir_p File.join(path())
|
88
121
|
|
89
122
|
@dx = Dynarex.new
|
@@ -154,7 +187,8 @@ EOF
|
|
154
187
|
tags = Rexle::Element.new('tags')
|
155
188
|
|
156
189
|
doc.root.xpath('records/section/x/text()').each do |x|
|
157
|
-
tags.add Rexle::Element.new('tag').add_text x.lines.first[/#(\w+)$/,1]
|
190
|
+
tags.add Rexle::Element.new('tag').add_text x.lines.first[/#(\w+)$/,1]\
|
191
|
+
.downcase
|
158
192
|
end
|
159
193
|
|
160
194
|
summary.add tags
|
@@ -209,6 +243,10 @@ EOF
|
|
209
243
|
xslt = Nokogiri::XSLT(xslt_buffer)
|
210
244
|
out = xslt.transform(Nokogiri::XML(doc.xml))
|
211
245
|
File.write File.join(path(d), 'index.html'), out
|
212
|
-
end
|
246
|
+
end
|
247
|
+
|
248
|
+
def time(t=Time.now)
|
249
|
+
t.strftime "<time>%-I:%M%P</time>"
|
250
|
+
end
|
213
251
|
|
214
252
|
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|