liveblog 0.6.0 → 0.7.3
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 +105 -70
- data/lib/liveblog.rb +61 -25
- data/lib/liveblog.xsl +1 -0
- metadata +26 -6
- 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: 47ed6ce1c583163577780604dc5b4a84c33e7e86
|
4
|
+
data.tar.gz: 2ce3b6d3f6e4526f4b9f7861ba05a1383148cd48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a92ca1c18ab779e3b7ec9052631b811d5322ecbc3a1d08f8cebf725f0a5d9e82deabb36a068925822fe0a9e8f21e27132d0a05e998d60964cd01a555a5c1f1d
|
7
|
+
data.tar.gz: dd563e8754115d84fcb03c3c0033342b46b31125268390e9a96c55180e66fa48f31b09e21e7a0c69939dfafb3627efd8bd747d3d217a5eaefa5019a2db17f6e0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/liveblog.css
CHANGED
@@ -39,41 +39,73 @@ body { background-color: #c48f33;}
|
|
39
39
|
max-width: 620px;
|
40
40
|
}
|
41
41
|
|
42
|
-
#summary ul {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
42
|
+
#summary ul {
|
43
|
+
background-color: #D5A95D;
|
44
|
+
list-style-type: square;
|
45
|
+
margin: 1.4em; padding: 1.8em;
|
46
|
+
}
|
47
47
|
|
48
|
-
#summary ul li {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
}
|
48
|
+
#summary ul li {
|
49
|
+
background-color: #D5A95D;
|
50
|
+
font-family: arial, verdana;
|
51
|
+
font-size: 1.4em;
|
52
|
+
margin: 0.2em 2em; padding: 0.8em;
|
53
|
+
}
|
54
|
+
|
55
|
+
#summary ul li a {
|
56
|
+
background-color: transparent;
|
57
|
+
color: #8E32C3;
|
58
|
+
text-decoration: none;
|
59
|
+
padding: 0.4em;
|
60
|
+
}
|
61
|
+
|
62
|
+
#summary ul li a:link {
|
63
|
+
background-color: transparent;
|
64
|
+
}
|
65
|
+
|
66
|
+
#summary ul li a:visited {
|
67
|
+
background-color: rgba(100,100,100,0.1);
|
68
|
+
}
|
69
|
+
|
70
|
+
#summary ul li a:hover {
|
71
|
+
background-color: transparent;
|
72
|
+
color: #C332AF;
|
73
|
+
}
|
54
74
|
|
55
|
-
|
75
|
+
.arrow {
|
76
|
+
background-color: #444;
|
56
77
|
background-color: transparent;
|
57
|
-
|
58
|
-
text-decoration: none;
|
59
|
-
padding: 0.4em;
|
78
|
+
font-size: 3em;
|
60
79
|
}
|
61
|
-
|
80
|
+
.arrow:first-child {
|
62
81
|
background-color: transparent;
|
63
|
-
}
|
64
82
|
|
65
|
-
|
66
|
-
|
83
|
+
}
|
84
|
+
.arrow:last-child {
|
85
|
+
background-color: transparent;
|
86
|
+
float: right;
|
67
87
|
}
|
68
88
|
|
69
|
-
|
89
|
+
.arrow:link {
|
90
|
+
background-color: transparent;
|
91
|
+
color: rgba(100,200,100, 0.3);
|
92
|
+
}
|
93
|
+
.arrow:hover {
|
70
94
|
background-color: transparent;
|
71
|
-
color:
|
95
|
+
color: rgba(255,255,255, 0.8)
|
72
96
|
}
|
73
97
|
|
98
|
+
|
99
|
+
|
74
100
|
article {
|
75
101
|
background-color: #AFC332;
|
76
102
|
}
|
103
|
+
|
104
|
+
article strong{
|
105
|
+
background-color: transparent;
|
106
|
+
font-size: 1.27em;
|
107
|
+
padding: 0.1em 0.1em;
|
108
|
+
}
|
77
109
|
details ol li {
|
78
110
|
background-color: #AFC332;
|
79
111
|
background-color: transparent;
|
@@ -87,38 +119,39 @@ section {
|
|
87
119
|
max-width: 500px
|
88
120
|
}
|
89
121
|
|
90
|
-
section h1 {
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
}
|
122
|
+
section h1 {
|
123
|
+
background-color: #D5A95D;
|
124
|
+
/*color: #C34532;*/
|
125
|
+
margin: 0.4em 0em 1.2em 0em;
|
126
|
+
padding: 1em 1.5em;
|
127
|
+
}
|
96
128
|
|
97
|
-
section p {
|
129
|
+
section p {
|
130
|
+
background-color: #ee3;
|
131
|
+
background-color: transparent;
|
132
|
+
margin: 0.4em 0.4em; padding: 0.6em 1.5em;
|
133
|
+
}
|
98
134
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
background-color: transparent;
|
105
|
-
color: #8E32C3;
|
106
|
-
text-decoration: none;
|
107
|
-
}
|
108
|
-
section a:link {
|
109
|
-
background-color: transparent;
|
110
|
-
color: #911;
|
111
|
-
}
|
135
|
+
section a {
|
136
|
+
background-color: transparent;
|
137
|
+
color: #8E32C3;
|
138
|
+
text-decoration: none;
|
139
|
+
}
|
112
140
|
|
113
|
-
section a:
|
114
|
-
|
115
|
-
|
116
|
-
}
|
141
|
+
section a:link {
|
142
|
+
background-color: transparent;
|
143
|
+
color: #911;
|
144
|
+
}
|
117
145
|
|
118
|
-
section a:
|
119
|
-
|
120
|
-
|
121
|
-
}
|
146
|
+
section a:hover {
|
147
|
+
background-color: transparent;
|
148
|
+
color: #C33267;
|
149
|
+
}
|
150
|
+
|
151
|
+
section a:active {
|
152
|
+
background-color: #ddd;
|
153
|
+
color: #C33267;
|
154
|
+
}
|
122
155
|
|
123
156
|
|
124
157
|
|
@@ -137,30 +170,32 @@ aside ul {
|
|
137
170
|
padding: 0.6em 0.9em;
|
138
171
|
}
|
139
172
|
|
140
|
-
aside ul li {
|
141
|
-
|
142
|
-
|
143
|
-
font-family: helvetica, arial;
|
144
|
-
font-size: 2.6em;
|
145
|
-
font-weight: 900;
|
173
|
+
aside ul li {
|
174
|
+
background-color: transparent;
|
175
|
+
background-color: #e33;
|
146
176
|
|
147
|
-
|
148
|
-
|
149
|
-
|
177
|
+
font-family: helvetica, arial;
|
178
|
+
font-size: 2.6em;
|
179
|
+
font-weight: 900;
|
150
180
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
}
|
181
|
+
margin: 0.4em;
|
182
|
+
padding: 0.9em;
|
183
|
+
text-align: center;
|
184
|
+
}
|
156
185
|
|
157
|
-
aside ul li a
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
}
|
186
|
+
aside ul li a{
|
187
|
+
background-color: transparent;
|
188
|
+
color: #eee;
|
189
|
+
text-decoration: none;
|
190
|
+
}
|
191
|
+
|
192
|
+
aside ul li a:hover {
|
193
|
+
background-color: rgba(100, 100, 100, 0.5);
|
194
|
+
color: #eee;
|
195
|
+
text-decoration: none;
|
196
|
+
}
|
162
197
|
|
163
|
-
article>footer{
|
198
|
+
article>footer, aside ul li{
|
164
199
|
background-color: rgba(255,255,255,0.2);
|
165
200
|
}
|
166
201
|
|
@@ -201,4 +236,4 @@ article>footer{
|
|
201
236
|
float: left;
|
202
237
|
padding: 0em 0.5em 0 0;
|
203
238
|
margin: 0em;
|
204
|
-
}
|
239
|
+
}
|
data/lib/liveblog.rb
CHANGED
@@ -6,19 +6,33 @@ require 'time'
|
|
6
6
|
require 'dynarex'
|
7
7
|
require 'fileutils'
|
8
8
|
require 'martile'
|
9
|
+
require 'simple-config'
|
9
10
|
|
10
11
|
class LiveBlog
|
11
12
|
|
12
|
-
def initialize(
|
13
|
-
|
13
|
+
def initialize(config: nil)
|
14
|
+
|
15
|
+
|
16
|
+
config ||= 'liveblog.conf'
|
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]}
|
14
19
|
|
15
|
-
Dir.chdir liveblogfilepath
|
16
20
|
|
17
|
-
|
18
|
-
|
21
|
+
Dir.chdir dir
|
22
|
+
|
23
|
+
@d = Date.today
|
19
24
|
dxfile = File.join(path(), 'index.xml')
|
20
25
|
|
21
|
-
File.exists?
|
26
|
+
if File.exists? dxfile then
|
27
|
+
|
28
|
+
@dx = Dynarex.new(dxfile)
|
29
|
+
@d = Date.parse @dx.title
|
30
|
+
|
31
|
+
else
|
32
|
+
|
33
|
+
new_file()
|
34
|
+
|
35
|
+
end
|
22
36
|
|
23
37
|
end
|
24
38
|
|
@@ -39,22 +53,32 @@ class LiveBlog
|
|
39
53
|
# we reserve 30 characters for the link
|
40
54
|
len = (140 - 30 - hashtag.length)
|
41
55
|
entry = raw_entry.length > len ? "%s... %s" % [raw_entry.slice(0, len), hashtag] : raw_entry
|
42
|
-
[true, "%s %s
|
43
|
-
end
|
56
|
+
[true, "%s %s%s" % [entry, static_urlpath(), hashtag]]
|
57
|
+
end
|
58
|
+
|
59
|
+
# Use with yesterday's liveblog; Ideally suited for running from a cron job
|
60
|
+
#
|
61
|
+
def link_today()
|
62
|
+
|
63
|
+
newfilepath = File.join(path(@d-1), 'formatted.xml')
|
64
|
+
FileUtils.cp File.join(path(@d-1), 'index.xml'), newfilepath
|
65
|
+
|
66
|
+
doc = Rexle.new File.read(newfilepath)
|
67
|
+
doc.root.element('summary/next_day').text = static_urlpath()
|
68
|
+
File.write newfilepath, doc.xml(pretty: true)
|
69
|
+
|
70
|
+
end
|
44
71
|
|
45
72
|
def new_file(s=nil)
|
46
73
|
|
47
74
|
s ||= <<EOF
|
48
|
-
<?dynarex schema="sections[title
|
49
|
-
title: LiveBlog #{ordinalize(@
|
50
|
-
edit_url: #{@edit_url}
|
51
|
-
date: #{Date.today}
|
52
|
-
css_url: #{@css_url}
|
75
|
+
<?dynarex schema="sections[title]/section(x)" order='descending'?>
|
76
|
+
title: LiveBlog #{ordinalize(@d.day) + @d.strftime(" %B %Y")}
|
53
77
|
--#
|
54
78
|
|
55
79
|
EOF
|
56
80
|
|
57
|
-
FileUtils.mkdir_p path()
|
81
|
+
FileUtils.mkdir_p File.join(path())
|
58
82
|
|
59
83
|
@dx = Dynarex.new
|
60
84
|
@dx.import s
|
@@ -86,12 +110,19 @@ EOF
|
|
86
110
|
end
|
87
111
|
|
88
112
|
|
89
|
-
def path
|
90
|
-
|
91
|
-
|
92
|
-
|
113
|
+
def path(d=@d)
|
114
|
+
[d.year.to_s, Date::MONTHNAMES[d.month].downcase[0..2], d.day.to_s]
|
115
|
+
end
|
116
|
+
|
117
|
+
def urlpath(d=@d)
|
118
|
+
path(d).join('/') + '/'
|
119
|
+
end
|
120
|
+
|
121
|
+
def static_urlpath(d=@d)
|
122
|
+
@urlbase.sub(/[^\/]$/,'\0/') + urlpath(d)
|
93
123
|
end
|
94
124
|
|
125
|
+
|
95
126
|
def save()
|
96
127
|
|
97
128
|
@dx.save File.join(path(), 'index.xml')
|
@@ -102,15 +133,17 @@ EOF
|
|
102
133
|
def save_html()
|
103
134
|
|
104
135
|
newfilepath = File.join(path(), 'formatted.xml')
|
105
|
-
FileUtils.cp File.join(path(), 'index.xml'), newfilepath
|
106
|
-
|
136
|
+
FileUtils.cp File.join(path(), 'index.xml'), newfilepath
|
107
137
|
doc = Rexle.new File.read(newfilepath)
|
108
138
|
|
109
139
|
summary = doc.root.element('summary')
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
140
|
+
|
141
|
+
add summary, 'edit_url', "%s/%sindex.txt" % [@edit_url, urlpath()]
|
142
|
+
add summary, 'date', @d.strftime("%d-%b-%Y").upcase
|
143
|
+
add summary, 'css_url', @css_url
|
144
|
+
add summary, 'published', Time.now.strftime("%d-%m-%Y %H:%M")
|
145
|
+
add summary, 'prev_day', static_urlpath(@d-1)
|
146
|
+
add summary, 'next_day', @d == Date.today ? '' : static_urlpath(@d+1)
|
114
147
|
|
115
148
|
tags = Rexle::Element.new('tags')
|
116
149
|
|
@@ -120,7 +153,6 @@ EOF
|
|
120
153
|
|
121
154
|
summary.add tags
|
122
155
|
|
123
|
-
|
124
156
|
doc.root.xpath('records/section/x') do |x|
|
125
157
|
|
126
158
|
s = "=%s\n%s\n=" % [x.text.lines.first[/#\w+$/], x.text.unescape]
|
@@ -163,5 +195,9 @@ EOF
|
|
163
195
|
n.to_s + ( (10...20).include?(n) ? 'th' :
|
164
196
|
%w{ th st nd rd th th th th th th }[n % 10] )
|
165
197
|
end
|
198
|
+
|
199
|
+
def add(summary, name, s)
|
200
|
+
summary.add Rexle::Element.new(name).add_text s
|
201
|
+
end
|
166
202
|
|
167
203
|
end
|
data/lib/liveblog.xsl
CHANGED
@@ -36,6 +36,7 @@
|
|
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'>←</a><a href='{summary/next_day}' class='arrow'>→</a></li>
|
39
40
|
<li>
|
40
41
|
<a href="{summary/edit_url}" rel="nofollow">edit</a>
|
41
42
|
</li>
|
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.
|
4
|
+
version: 0.7.3
|
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-
|
34
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dynarex
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
version: '1.5'
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.5.
|
45
|
+
version: 1.5.8
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
version: '1.5'
|
53
53
|
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.5.
|
55
|
+
version: 1.5.8
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: martile
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,6 +73,26 @@ dependencies:
|
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.5.2
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: simple-config
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.3'
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 0.3.0
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0.3'
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.3.0
|
76
96
|
description:
|
77
97
|
email: james@r0bertson.co.uk
|
78
98
|
executables: []
|
@@ -94,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
114
|
requirements:
|
95
115
|
- - ">="
|
96
116
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
117
|
+
version: 2.1.2
|
98
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
119
|
requirements:
|
100
120
|
- - ">="
|
@@ -102,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
122
|
version: '0'
|
103
123
|
requirements: []
|
104
124
|
rubyforge_project:
|
105
|
-
rubygems_version: 2.
|
125
|
+
rubygems_version: 2.4.6
|
106
126
|
signing_key:
|
107
127
|
specification_version: 4
|
108
128
|
summary: Uses the Dynarex gem to create a daily live blog. Convenient for grouping
|
metadata.gz.sig
CHANGED
Binary file
|