liveblog 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -2
- data.tar.gz.sig +3 -3
- data/lib/liveblog.rb +12 -6
- data/lib/liveblog.xsl +3 -6
- metadata +1 -1
- 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: b291f4858ae388eb1256b1eb2f69d027272be1ab
|
|
4
|
+
data.tar.gz: 5f84a39e1eedd8e52c6a0622af89e47e32ada3ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 02de2c4cdfd32c9461ec4c1d37fe7b072a42da374b86db5abe696e7ad7925fb79b58beef4c1c9bac0c8e0edb189b0917e54722cb6b175372e8c6a186e707c605
|
|
7
|
+
data.tar.gz: e7cfcbe89b5ebab652e646635600f53efaf30c41bbeee9f3eee27b179ef58d0b627575a0ad98eeebb0a24568b6e8db644413e6763a2cf13578ef51408f31ae90
|
checksums.yaml.gz.sig
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
�[�
|
|
2
|
-
|
|
1
|
+
n6F���0�����euE��`-K�*�JG��t��&�_�������*6"f�4��A����c���W�+��&����h�.�U��[���ϲ�1KK";�_�7��Ō�kn��Aw����}u�������� �cY�X�]K�Z��{�ݔB-"dC�u�x�� ��+:�2�i�w���
|
|
2
|
+
�%"�'� �dKX��)�&Nm�2'����Ҋ
|
data.tar.gz.sig
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
�
|
|
3
|
-
|
|
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[�����d�C(��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
|
|
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
|
|
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
|
-
|
|
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.
|
|
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
|
|
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
|
-
|
|
14
|
-
|
|
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
metadata.gz.sig
CHANGED
|
Binary file
|