liveblog 0.7.4 → 0.7.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5e9005cd31c0e22ce0aecc425667a71c7c53913
4
- data.tar.gz: b5e3467e36d490f34ec83245c6bfdb4d77b53a6b
3
+ metadata.gz: d96398f0aa49154552843c326d16ce6efa8c913a
4
+ data.tar.gz: 5827683e8b4ca1996822dbddd0f060b0f2773b3c
5
5
  SHA512:
6
- metadata.gz: 3faa4bbefbbe421e01e547161bda656ceff0ee64a01d84794e0c0b3e30b9b8f8f2b83754605e19ab69745ca63d15ccf5bed0cc532c5795cdb94079a2f4ef3cc0
7
- data.tar.gz: 5f2aefc8a7e834fcf7750b7e18afd6bffa6eab60db74c5a55d4486fd02fe76518ae7f15683f2cc2e51afc3e3459800664974c181ab6fcbbe6075f43539352323
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 { background-color: #c48f33;}
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 2em;
39
- max-width: 620px;
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: 1.4em; padding: 1.8em;
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.4em;
52
- margin: 0.2em 2em; padding: 0.8em;
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 4.6em;
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
- margin: 0.4em 0.4em; padding: 0.6em 1.5em;
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.6em;
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.6em;
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
- when /^#\s*\w.*#\w+$/ then add_section raw_entry
46
- when /#\w+$/ then add_section_entry entry, hashtag
47
- else [false, 'no valid entry found']
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: liveblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file