liveblog 1.2.0 → 1.2.1
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 +2 -2
- data.tar.gz.sig +0 -0
- data/lib/liveblog.rb +42 -8
- metadata +2 -2
- 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: 3029f6644f23406e0156b91ae824ee9746741978
|
4
|
+
data.tar.gz: 676335b6951e0543ec1309fb86c92f569bc94283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02b916db6d70cb73ba141e091681b93ffc443223ebeebdc39422d2c32eff36451034e4aaecbd3145b7acd4a2871f4f2f34177c5b1307fe31a9578119d53aa573
|
7
|
+
data.tar.gz: b6937f0fec40ec6e649fef264ec2cb0662111d3585492a6184bb58a163f8eb7e3a9078f3990ed8282d26906d8d6a4280aab7aa5c6ac7087bc16f7f74c9c9c1f0
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
�����bY+�q��
|
2
|
+
`���%}.;���~�+�k��DF���фO�UHp��]eL^�WgHX�{�b#��O��lS�K!�h4aF?�)�`��j�qH[�"�O6����Kp��5d�Hv#� C�#}c�@���C�*vJ��~�%.u1
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/liveblog.rb
CHANGED
@@ -183,7 +183,8 @@ EOF
|
|
183
183
|
FileUtils.mkdir_p File.join(path())
|
184
184
|
|
185
185
|
@dx = Dynarex.new
|
186
|
-
|
186
|
+
|
187
|
+
@dx.import(s) {|x| sanitise x }
|
187
188
|
|
188
189
|
@dx.xpath('records/section').each do |rec|
|
189
190
|
|
@@ -213,15 +214,15 @@ EOF
|
|
213
214
|
|
214
215
|
end
|
215
216
|
|
216
|
-
def update_entry(
|
217
|
+
def update_entry(raw_entry)
|
217
218
|
|
218
|
-
hashtag =
|
219
|
+
hashtag = raw_entry.lines.first[/#(\w+)$/,1]
|
219
220
|
|
220
221
|
record_found = find_hashtag hashtag
|
221
222
|
|
222
223
|
if record_found then
|
223
224
|
|
224
|
-
record_found.x = entry
|
225
|
+
record_found.x = sanitise entry
|
225
226
|
save()
|
226
227
|
|
227
228
|
@plugins.each do |x|
|
@@ -247,11 +248,12 @@ EOF
|
|
247
248
|
rec = @dx.find hashtag
|
248
249
|
|
249
250
|
return [false, 'rec not found'] unless rec
|
250
|
-
|
251
|
-
|
251
|
+
|
252
|
+
entry = sanitise raw_entry.chomp
|
253
|
+
rec.x += "\n\n" + entry + "\n"
|
252
254
|
|
253
255
|
@plugins.each do |x|
|
254
|
-
|
256
|
+
|
255
257
|
if x.respond_to? :on_new_section_entry then
|
256
258
|
x.on_new_section_entry(raw_entry, hashtag)
|
257
259
|
end
|
@@ -281,6 +283,28 @@ EOF
|
|
281
283
|
|
282
284
|
[true, 'section added']
|
283
285
|
end
|
286
|
+
|
287
|
+
# used by the sanitise method
|
288
|
+
#
|
289
|
+
def code2indent(s2)
|
290
|
+
|
291
|
+
# find the beginning
|
292
|
+
x1 = s2 =~ /^```/
|
293
|
+
return s2 unless x1
|
294
|
+
|
295
|
+
# find the end
|
296
|
+
x2 = s2[x1+3..-1] =~ /^```/
|
297
|
+
return s2 unless x2
|
298
|
+
|
299
|
+
codeblock = s2[x1+3..x1+x2+2]
|
300
|
+
|
301
|
+
s3 = s2[0..x1-1] + codeblock.lines.map{|x| x.prepend(' ' * 4)}.join + \
|
302
|
+
"\n" + s2[x1+x2+6..-1]
|
303
|
+
|
304
|
+
return code2indent(s3)
|
305
|
+
|
306
|
+
end
|
307
|
+
|
284
308
|
|
285
309
|
def new_config()
|
286
310
|
|
@@ -319,6 +343,16 @@ EOF
|
|
319
343
|
def static_urlpath(d=@d)
|
320
344
|
@urlbase.sub(/[^\/]$/,'\0/') + urlpath(d)
|
321
345
|
end
|
346
|
+
|
347
|
+
def sanitise(raw_s)
|
348
|
+
|
349
|
+
# Transform any code encapsulated within 3 backticks to the
|
350
|
+
# 4 spaces indented style. This prevents Ruby comments being
|
351
|
+
# wrongfully identified as a sectionx heading.
|
352
|
+
|
353
|
+
code2indent(raw_s)
|
354
|
+
|
355
|
+
end
|
322
356
|
|
323
357
|
def save_html()
|
324
358
|
|
@@ -550,4 +584,4 @@ EOF
|
|
550
584
|
nil
|
551
585
|
end
|
552
586
|
end
|
553
|
-
end
|
587
|
+
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: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
5s8qc8N6iJi3jGcarS1hVkhlWGshAZx1T0n/Q27m1S0GoVUebJYFJxqaZqL5FO/v
|
32
32
|
NonZ4ByUi+SaTg==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-06-
|
34
|
+
date: 2016-06-11 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: dxsectionx
|
metadata.gz.sig
CHANGED
Binary file
|