liveblog 0.7.5 → 0.8.1

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: d96398f0aa49154552843c326d16ce6efa8c913a
4
- data.tar.gz: 5827683e8b4ca1996822dbddd0f060b0f2773b3c
3
+ metadata.gz: 358e69b707fae031126bb00f028d7d82fe313859
4
+ data.tar.gz: 014819ed04a17097ef30ecd318a9a9e75b62f7be
5
5
  SHA512:
6
- metadata.gz: 91f0358914a2986b6ba18a45b91d55102fdf89a8d0a9c0f07ef4b3a5e90949863f16814c7ceaffc5bd2b5c7c29359007f0658853f6528aea9a0855435399d932
7
- data.tar.gz: 3f155f79a3d4d1301c5492ed4a82ac01a252bb807cc60907c6e5da0c36b9619e500575f301dd9de5969553b229c983c904fe26b94a9d52a2bd163a876502d8c6
6
+ metadata.gz: 71ff00459b818b4648070eb08ef86614cc9a02afbc6002a934673e54bfd8e2a3f975c184d20aab03dda0016f16e2d903fd1cc091f0677e8bbb143f6743880c0d
7
+ data.tar.gz: 178137083c31ef0fbf33ca8538aa52c3b73a067529cce11f9e8234526344eccd59ee83512c1b5416a94da91618c151e745126c08b7c248388a9bc1f9b2de96e2
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -34,6 +34,13 @@ body {
34
34
  header>nav>ul>li>a:focus {background-color: #161; color: #fff;}
35
35
  header>nav>ul>li>a:active {background-color: rgba(200,200,200,0.4); color: #5a5;}
36
36
 
37
+ #wrap > p {
38
+ background-color: rgba(50,50,50,0.2);
39
+ color: #fff;
40
+ font-size: 1.2em;
41
+ padding: 2em 4em;
42
+ }
43
+
37
44
  #summary {
38
45
  background-color: transparent;
39
46
  color: #AFC332;
@@ -150,12 +157,12 @@ section {
150
157
 
151
158
  section a:link {
152
159
  background-color: transparent;
153
- color: #911;
160
+ color: #917;
154
161
  }
155
162
 
156
163
  section a:hover {
157
164
  background-color: transparent;
158
- color: #C33267;
165
+ color: #815;
159
166
  }
160
167
 
161
168
  section a:active {
@@ -163,7 +170,22 @@ section {
163
170
  color: #C33267;
164
171
  }
165
172
 
173
+ section a~span {
174
+ background-color: transparent;
175
+ color: #444;
176
+ font-size: 0.8em;
177
+ margin-left: 0;
178
+ padding: 0.2em;
179
+ }
166
180
 
181
+ time {
182
+ background-color: transparent;
183
+ background-color: rgba(150,170,150,0.15);
184
+ color: #348;
185
+ font-family: courier;
186
+ font-size: 0.9em;
187
+ padding: 0.1em 0.3em;
188
+ }
167
189
 
168
190
  aside {
169
191
  background-color: #eee;
@@ -15,7 +15,8 @@ class LiveBlog
15
15
 
16
16
  config ||= 'liveblog.conf'
17
17
  h = SimpleConfig.new(config).to_h
18
- dir, @urlbase, @edit_url, @css_url = %i(dir urlbase edit_url css_url).map{|x| h[x]}
18
+ dir, @urlbase, @edit_url, @css_url, @xsl_path, @xsl_url, @bannertext = \
19
+ %i(dir urlbase edit_url css_url xsl_path xsl_url bannertext).map{|x| h[x]}
19
20
 
20
21
 
21
22
  Dir.chdir dir
@@ -50,7 +51,7 @@ class LiveBlog
50
51
 
51
52
  when /#\w+$/ then
52
53
 
53
- entry.gsub!(/\B!t\b/, time())
54
+ entry.gsub!(/(?:^|\s)!t\b/, time())
54
55
  add_section_entry entry, hashtag
55
56
 
56
57
  else
@@ -63,7 +64,7 @@ class LiveBlog
63
64
 
64
65
  # we reserve 30 characters for the link
65
66
  len = (140 - 30 - hashtag.length)
66
- raw_entry.gsub!(/\B!t\b/,'')
67
+ raw_entry.gsub!(/(?:^|\s)!t\b/,'')
67
68
  entry = raw_entry.length > len ? "%s... %s" % [raw_entry.slice(0, len), hashtag] : raw_entry
68
69
  message = "%s %s%s" % [entry, static_urlpath(), hashtag]
69
70
 
@@ -114,7 +115,7 @@ EOF
114
115
 
115
116
  s.gsub!(/\B!ts\b/, "*started #{time(t)}*")
116
117
  s.gsub!(/\B!tc\b/, "*completed #{time(t)}*")
117
- s.gsub!(/\B!t\b/, time(t))
118
+ s.gsub!(/(?:^|\s)!t\b/, time(t))
118
119
 
119
120
 
120
121
  FileUtils.mkdir_p File.join(path())
@@ -157,7 +158,7 @@ EOF
157
158
  path(d).join('/') + '/'
158
159
  end
159
160
 
160
- def static_urlpath(d=@d)
161
+ def static_urlpath(d=@d)
161
162
  @urlbase.sub(/[^\/]$/,'\0/') + urlpath(d)
162
163
  end
163
164
 
@@ -179,10 +180,12 @@ EOF
179
180
 
180
181
  add summary, 'edit_url', "%s/%s" % [@edit_url, urlpath()]
181
182
  add summary, 'date', @d.strftime("%d-%b-%Y").upcase
183
+ add summary, 'day', Date::DAYNAMES[@d.cwday]
182
184
  add summary, 'css_url', @css_url
183
185
  add summary, 'published', Time.now.strftime("%d-%m-%Y %H:%M")
184
186
  add summary, 'prev_day', static_urlpath(@d-1)
185
187
  add summary, 'next_day', @d == Date.today ? '' : static_urlpath(@d+1)
188
+ add summary, 'bannertext', @bannertext
186
189
 
187
190
  tags = Rexle::Element.new('tags')
188
191
 
@@ -192,11 +195,13 @@ EOF
192
195
  end
193
196
 
194
197
  summary.add tags
198
+
199
+ domain = @urlbase[/https?:\/\/([^\/]+)/,1].split('.')[-2..-1].join('.')
195
200
 
196
201
  doc.root.xpath('records/section/x') do |x|
197
202
 
198
203
  s = "=%s\n%s\n=" % [x.text.lines.first[/#\w+$/], x.text.unescape]
199
- html = Martile.new(s).to_html
204
+ html = Martile.new(s, ignore_domainlabel: domain).to_html
200
205
 
201
206
  e = x.parent
202
207
  x.delete
@@ -213,7 +218,12 @@ EOF
213
218
  doc2.root.add details
214
219
  e.add doc2.root
215
220
  end
216
-
221
+
222
+ doc.instructions << [
223
+ 'xml-stylesheet',
224
+ "title='XSL_formatting' type='text/xsl' href='#{@xsl_url}'"
225
+ ]
226
+
217
227
  File.write newfilepath, doc.xml(pretty: true)
218
228
 
219
229
  render_html doc
@@ -236,9 +246,14 @@ EOF
236
246
  end
237
247
 
238
248
  def render_html(doc, d=@d)
239
-
240
- lib = File.exists?('liveblog.xsl') ? '.' : File.dirname(__FILE__)
241
- xslt_buffer = File.read(File.join(lib,'liveblog.xsl'))
249
+
250
+ xslt_buffer = if @xsl_path then
251
+ buffer, _ = RXFHelper.read @xsl_path
252
+ buffer
253
+ else
254
+ lib = File.exists?('liveblog.xsl') ? '.' : File.dirname(__FILE__)
255
+ File.read(File.join(lib,'liveblog.xsl'))
256
+ end
242
257
 
243
258
  xslt = Nokogiri::XSLT(xslt_buffer)
244
259
  out = xslt.transform(Nokogiri::XML(doc.xml))
@@ -1,4 +1,4 @@
1
- <?xml version="1.0" encoding="utf-8"?>
1
+ xml version="1.0" encoding="utf-8"?>
2
2
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
3
  <xsl:output method="html" encoding="utf-8" indent="yes" />
4
4
 
@@ -10,7 +10,7 @@
10
10
  <link rel='stylesheet' type='text/css' href='{summary/css_url}' media='screen, projection, tv, print'/>
11
11
  </head>
12
12
  <body>
13
-
13
+ <div id="wrap">
14
14
  <header>
15
15
  <nav>
16
16
  <ul>
@@ -24,6 +24,9 @@
24
24
  </nav>
25
25
  </header>
26
26
 
27
+ <xsl:if test='summary/bannertext'>
28
+ <p><xsl:value-of select='summary/bannertext'/></p>
29
+ </xsl:if>
27
30
 
28
31
  <div id='summary'>
29
32
  <ul>
@@ -35,7 +38,12 @@
35
38
  </div>
36
39
  <aside>
37
40
  <ul>
38
- <li><xsl:value-of select='summary/date'/></li>
41
+ <li>
42
+ <xsl:value-of select='summary/date'/>
43
+ </li>
44
+ <li>
45
+ <xsl:value-of select='summary/day'/>
46
+ </li>
39
47
  <li>
40
48
  <a href='{summary/prev_day}' class='arrow'>&#8592;</a>
41
49
  <xsl:element name="a">
@@ -82,7 +90,7 @@
82
90
  </dl>
83
91
  </footer>
84
92
  </article>
85
-
93
+ </div>
86
94
  </body>
87
95
  </html>
88
96
  </xsl:template>
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.5
4
+ version: 0.8.1
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-20 00:00:00.000000000 Z
34
+ date: 2015-03-21 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex
@@ -93,6 +93,26 @@ dependencies:
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: 0.3.0
96
+ - !ruby/object:Gem::Dependency
97
+ name: subunit
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.2'
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 0.2.4
106
+ type: :runtime
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '0.2'
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: 0.2.4
96
116
  description:
97
117
  email: james@r0bertson.co.uk
98
118
  executables: []
metadata.gz.sig CHANGED
Binary file