liveblog 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47ed6ce1c583163577780604dc5b4a84c33e7e86
4
- data.tar.gz: 2ce3b6d3f6e4526f4b9f7861ba05a1383148cd48
3
+ metadata.gz: c5e9005cd31c0e22ce0aecc425667a71c7c53913
4
+ data.tar.gz: b5e3467e36d490f34ec83245c6bfdb4d77b53a6b
5
5
  SHA512:
6
- metadata.gz: 1a92ca1c18ab779e3b7ec9052631b811d5322ecbc3a1d08f8cebf725f0a5d9e82deabb36a068925822fe0a9e8f21e27132d0a05e998d60964cd01a555a5c1f1d
7
- data.tar.gz: dd563e8754115d84fcb03c3c0033342b46b31125268390e9a96c55180e66fa48f31b09e21e7a0c69939dfafb3627efd8bd747d3d217a5eaefa5019a2db17f6e0
6
+ metadata.gz: 3faa4bbefbbe421e01e547161bda656ceff0ee64a01d84794e0c0b3e30b9b8f8f2b83754605e19ab69745ca63d15ccf5bed0cc532c5795cdb94079a2f4ef3cc0
7
+ data.tar.gz: 5f2aefc8a7e834fcf7750b7e18afd6bffa6eab60db74c5a55d4486fd02fe76518ae7f15683f2cc2e51afc3e3459800664974c181ab6fcbbe6075f43539352323
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/liveblog.css CHANGED
@@ -72,28 +72,33 @@ body { background-color: #c48f33;}
72
72
  color: #C332AF;
73
73
  }
74
74
 
75
- .arrow {
75
+ .arrow, .deadarrow {
76
76
  background-color: #444;
77
77
  background-color: transparent;
78
78
  font-size: 3em;
79
79
  }
80
- .arrow:first-child {
81
- background-color: transparent;
80
+ .arrow:first-child {
81
+ background-color: transparent;
82
82
 
83
- }
84
- .arrow:last-child {
85
- background-color: transparent;
86
- float: right;
87
- }
83
+ }
84
+ .arrow:last-child, .deadarrow:last-child {
85
+ background-color: transparent;
86
+ float: right;
87
+ }
88
88
 
89
- .arrow:link {
90
- background-color: transparent;
91
- color: rgba(100,200,100, 0.3);
92
- }
93
- .arrow:hover {
94
- background-color: transparent;
95
- color: rgba(255,255,255, 0.8)
96
- }
89
+ .arrow:link {
90
+ background-color: transparent;
91
+ color: rgba(100,200,100, 0.6);
92
+ }
93
+
94
+ .deadarrow:link {
95
+ background-color: transparent;
96
+ color: rgba(100,200,100, 0.2);
97
+ }
98
+ .arrow:hover {
99
+ background-color: transparent;
100
+ color: rgba(255,255,255, 0.8)
101
+ }
97
102
 
98
103
 
99
104
 
@@ -237,3 +242,8 @@ article>footer, aside ul li{
237
242
  padding: 0em 0.5em 0 0;
238
243
  margin: 0em;
239
244
  }
245
+
246
+ pre, output {
247
+ background-color: rgba(200,200,200,0.4);
248
+ font-size: 0.6em;
249
+ }
data/lib/liveblog.rb CHANGED
@@ -31,6 +31,7 @@ class LiveBlog
31
31
  else
32
32
 
33
33
  new_file()
34
+ link_today()
34
35
 
35
36
  end
36
37
 
@@ -53,20 +54,25 @@ class LiveBlog
53
54
  # we reserve 30 characters for the link
54
55
  len = (140 - 30 - hashtag.length)
55
56
  entry = raw_entry.length > len ? "%s... %s" % [raw_entry.slice(0, len), hashtag] : raw_entry
56
- [true, "%s %s%s" % [entry, static_urlpath(), hashtag]]
57
+ message = "%s %s%s" % [entry, static_urlpath(), hashtag]
58
+
59
+ [true, message]
57
60
  end
58
61
 
59
- # Use with yesterday's liveblog; Ideally suited for running from a cron job
62
+ # Use with yesterday's liveblog;
60
63
  #
61
64
  def link_today()
62
65
 
63
66
  newfilepath = File.join(path(@d-1), 'formatted.xml')
64
- FileUtils.cp File.join(path(@d-1), 'index.xml'), newfilepath
65
-
67
+
68
+ return unless File.exists? newfilepath
69
+
66
70
  doc = Rexle.new File.read(newfilepath)
67
71
  doc.root.element('summary/next_day').text = static_urlpath()
68
72
  File.write newfilepath, doc.xml(pretty: true)
69
73
 
74
+ render_html doc, @d-1
75
+
70
76
  end
71
77
 
72
78
  def new_file(s=nil)
@@ -95,7 +101,7 @@ EOF
95
101
 
96
102
  def add_section_entry(raw_entry, hashtag)
97
103
 
98
- rec = @dx.all.find {|section| section.x.lstrip.lines.first =~ /#{hashtag}/}
104
+ rec = @dx.all.find {|section| section.x.lstrip.lines.first =~ /#{hashtag}/i}
99
105
 
100
106
  return [false, 'rec not found'] unless rec
101
107
 
@@ -138,7 +144,7 @@ EOF
138
144
 
139
145
  summary = doc.root.element('summary')
140
146
 
141
- add summary, 'edit_url', "%s/%sindex.txt" % [@edit_url, urlpath()]
147
+ add summary, 'edit_url', "%s/%s" % [@edit_url, urlpath()]
142
148
  add summary, 'date', @d.strftime("%d-%b-%Y").upcase
143
149
  add summary, 'css_url', @css_url
144
150
  add summary, 'published', Time.now.strftime("%d-%m-%Y %H:%M")
@@ -176,17 +182,12 @@ EOF
176
182
 
177
183
  File.write newfilepath, doc.xml(pretty: true)
178
184
 
179
- lib = File.exists?('liveblog.xsl') ? '.' : File.dirname(__FILE__)
180
- xslt_buffer = File.read(File.join(lib,'liveblog.xsl'))
181
-
182
- xslt = Nokogiri::XSLT(xslt_buffer)
183
- out = xslt.transform(Nokogiri::XML(doc.xml))
184
- File.write File.join(path(), 'index.html'), out
185
+ render_html doc
185
186
 
186
187
  # save the related CSS file locally if the file doesn't already exist
187
188
  if not File.exists? 'liveblog.css' then
188
189
  FileUtils.cp File.join(File.dirname(__FILE__), 'liveblog.css'),\
189
- 'liveblog.css' if not File.exists? 'liveblog.css'
190
+ 'liveblog.css'
190
191
  end
191
192
 
192
193
  end
@@ -199,5 +200,15 @@ EOF
199
200
  def add(summary, name, s)
200
201
  summary.add Rexle::Element.new(name).add_text s
201
202
  end
203
+
204
+ def render_html(doc, d=@d)
205
+
206
+ lib = File.exists?('liveblog.xsl') ? '.' : File.dirname(__FILE__)
207
+ xslt_buffer = File.read(File.join(lib,'liveblog.xsl'))
208
+
209
+ xslt = Nokogiri::XSLT(xslt_buffer)
210
+ out = xslt.transform(Nokogiri::XML(doc.xml))
211
+ File.write File.join(path(d), 'index.html'), out
212
+ end
202
213
 
203
214
  end
data/lib/liveblog.xsl CHANGED
@@ -36,7 +36,21 @@
36
36
  <aside>
37
37
  <ul>
38
38
  <li><xsl:value-of select='summary/date'/></li>
39
- <li><a href='{summary/prev_day}' class='arrow'>&#8592;</a><a href='{summary/next_day}' class='arrow'>&#8594;</a></li>
39
+ <li>
40
+ <a href='{summary/prev_day}' class='arrow'>&#8592;</a>
41
+ <xsl:element name="a">
42
+ <xsl:choose>
43
+ <xsl:when test="summary/next_day != ''">
44
+ <xsl:attribute name="class">arrow</xsl:attribute>
45
+ </xsl:when>
46
+ <xsl:otherwise>
47
+ <xsl:attribute name="class">deadarrow</xsl:attribute>
48
+ </xsl:otherwise>
49
+ </xsl:choose>
50
+ <xsl:attribute name="href"><xsl:value-of select="summary/next_day"/></xsl:attribute>
51
+ &#8594;
52
+ </xsl:element>
53
+ </li>
40
54
  <li>
41
55
  <a href="{summary/edit_url}" rel="nofollow">edit</a>
42
56
  </li>
@@ -62,6 +76,8 @@
62
76
  </dd>
63
77
  <dt>Source:</dt>
64
78
  <dd><a href="index.txt">index.txt</a></dd>
79
+ <dt>XML:</dt>
80
+ <dd><a href="formatted.xml">formatted.xml</a></dd>
65
81
  <dt>Published:</dt><dd><xsl:value-of select="summary/published"/></dd>
66
82
  </dl>
67
83
  </footer>
@@ -70,4 +86,4 @@
70
86
  </body>
71
87
  </html>
72
88
  </xsl:template>
73
- </xsl:stylesheet>
89
+ </xsl:stylesheet>
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.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  WoOSxvsTN7qoA8F0W4mkDpf+HhHxBOLTPykcHMIlx2gILLnNraaZ1rJlZAqWABGj
32
32
  v8lGgeeqqjd5QA==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-03-17 00:00:00.000000000 Z
34
+ date: 2015-03-20 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex
metadata.gz.sig CHANGED
Binary file