liveblog 0.4.1 → 0.4.2

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: 5afbb5af5239ae78124596c00158a5c81d6dcb43
4
- data.tar.gz: 66f86ba416a0d0e669b98fba87bc56a8a871f591
3
+ metadata.gz: b291f4858ae388eb1256b1eb2f69d027272be1ab
4
+ data.tar.gz: 5f84a39e1eedd8e52c6a0622af89e47e32ada3ff
5
5
  SHA512:
6
- metadata.gz: a687a57d24753358e984c68436fe812e3b17a04e054af90e6724756ca430b18d9078c49ca71cec0caf280d614917dcf12c3df2f392cd84d2a3c3aa1d218a0ba9
7
- data.tar.gz: 0e26b0551567985dfa1dd1f5c05b042aa0f314a2cb4e9ffb18e019758bbf4ce3773e585a4a033f5fa245ccd4882d8ea14bbbfb70ea7aa539db0b1b6abbc99b2d
6
+ metadata.gz: 02de2c4cdfd32c9461ec4c1d37fe7b072a42da374b86db5abe696e7ad7925fb79b58beef4c1c9bac0c8e0edb189b0917e54722cb6b175372e8c6a186e707c605
7
+ data.tar.gz: e7cfcbe89b5ebab652e646635600f53efaf30c41bbeee9f3eee27b179ef58d0b627575a0ad98eeebb0a24568b6e8db644413e6763a2cf13578ef51408f31ae90
checksums.yaml.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- �[�L04j�������ŗ[
2
- ��k����;�GVI,�Mikt�=z����gZ3sgZ
1
+ n6F���0�����euE��`-K�*�JG��t��&�_�������*6"f4��A����c���W�+��&����h�.�U��[���ϲ�1KK";�_7��Ō�kn��Aw����}u�������� �cY�X�]K�Z��{�ݔB-"dC�u�x�� ��+:�2�i�w���
2
+ �%"' dKX��)�&Nm2 '����Ҋ
data.tar.gz.sig CHANGED
@@ -1,3 +1,3 @@
1
- ,��"4z��Pϐ�
2
- 'L٬�Q�O�k!&��*���p]�Ӡ
3
- ���IF����*;C7E���,iQ��*�'GO��|�w���iwKX ��?�W��9����\�Q6WU��a��)��䲼�γ�����oRk�뷬M#�K��ke���8)�?{_wXڦJbh����#簅�?����A�`5�s0f
1
+ +�eC�I`]� =�H��:A�0�Z:���k/Y�ރA)P�5�X'���}܌P�i����zx�87�kk�x�f�v�vY
2
+ Ht��lb�@�
3
+ P�[��l��[ieע�q��?Ԅ��n��|-�k�w���,��0AE9R��BT�[B����a��v�c��҄��!*m��3��Fo[P1o2���|�;kTD�x��F�5��e[�����dC(��5
data/lib/liveblog.rb CHANGED
@@ -23,18 +23,22 @@ class LiveBlog
23
23
 
24
24
  def add_entry(raw_entry)
25
25
 
26
- hashtag = raw_entry[/#\w+$/]
26
+ entry, hashtag = raw_entry.split(/\s*(?=#\w+$)/)
27
27
 
28
28
  success, msg = case raw_entry
29
29
  when /^#\s*\w.*#\w+$/ then add_section raw_entry
30
- when /#\w+$/ then add_section_entry raw_entry, hashtag
30
+ when /#\w+$/ then add_section_entry entry, hashtag
31
31
  else [false, 'no valid entry found']
32
32
  end
33
33
 
34
34
  return [false, msg] unless success
35
35
 
36
36
  save()
37
- [true, "%s %s/%s/index.html%s" % [raw_entry, @urlbase, path(), hashtag]]
37
+
38
+ # we reserve 30 characters for the link
39
+ len = (140 - 30 - hashtag.length)
40
+ entry = raw_entry.length > len ? "%s... %s" % [raw_entry.slice(0, len), hashtag] : raw_entry
41
+ [true, "%s %s/%s/%s" % [entry, @urlbase, path(), hashtag]]
38
42
  end
39
43
 
40
44
 
@@ -47,7 +51,7 @@ class LiveBlog
47
51
 
48
52
  return [false, 'rec not found'] unless rec
49
53
 
50
- rec.x += "\n\n" + raw_entry.rstrip
54
+ rec.x += "\n\n" + raw_entry.chomp + "\n"
51
55
  [true, 'entry added to section ' + hashtag]
52
56
  end
53
57
 
@@ -107,6 +111,7 @@ EOF
107
111
 
108
112
  h1 = doc2.root.element('h1')
109
113
  details = Rexle::Element.new('details')
114
+ details.attributes[:open] = 'open'
110
115
  summary = Rexle::Element.new('summary')
111
116
  summary.add h1
112
117
 
@@ -118,8 +123,9 @@ EOF
118
123
 
119
124
  File.write newfilepath, doc.xml(pretty: true)
120
125
 
121
- lib = File.dirname(__FILE__)
122
- xslt_buffer = File.read File.join(lib,'liveblog.xsl')
126
+ lib = File.exists?('liveblog.xsl') ? '.' : File.dirname(__FILE__)
127
+ xslt_buffer = File.read(File.join(lib,'liveblog.xsl'))
128
+
123
129
  xslt = Nokogiri::XSLT(xslt_buffer)
124
130
  out = xslt.transform(Nokogiri::XML(doc.xml))
125
131
  File.write File.join(path(), 'index.html'), out
data/lib/liveblog.xsl CHANGED
@@ -9,13 +9,10 @@
9
9
  <title><xsl:value-of select='summary/title'/></title>
10
10
  </head>
11
11
  <body>
12
- <xsl:for-each select="records/section">
13
- <xsl:text>
14
- </xsl:text>
15
- <xsl:copy-of select='section'/>
12
+ <xsl:for-each select="records/section/section">
13
+
14
+ <xsl:copy-of select='.'/>
16
15
 
17
- <xsl:text>
18
- </xsl:text>
19
16
  </xsl:for-each>
20
17
  </body>
21
18
  </html>
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.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file