livetext 0.8.62 → 0.8.63

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/livetext.rb +1 -1
  3. data/plugin/liveblog.rb +63 -25
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abf7c5c4536e07d15550a42bed3ea8058cc1f62581940b2031536a02c57deeeb
4
- data.tar.gz: 3295dc6e4e8aba61683123be3fc1f19dd536d247b95dca10d24097f585bde415
3
+ metadata.gz: 1ecefd7b98d49f5249cdc6c824c06723cd2aadcabc1fcdf9fa0e26b6278605af
4
+ data.tar.gz: af7eabe2aa02501c29af2c756c443316eb751627c388ad4f19a1d8f9507e30c2
5
5
  SHA512:
6
- metadata.gz: 4070908d526c8fab9902657715a064f4b4afc8e6a5f74b0442dae654db809f34f470a88333b7262f8e8184c9598675a99b41a9fa954e362db187726bbe436270
7
- data.tar.gz: 20fc4b7d364412496f716531e937e9409a79d26a86a355207bb3caff0b1c5514ae22365e0ebb4f59e1d32aaab25907f14ea7b55aa52e61283f9fbf5941c452d2
6
+ metadata.gz: 16b6d95f524c33fb45c3247421e31377888b346dde63702663aff3b5f1bcbae62e9214bf4e7f0281bf82073b82bff2ad8343185920da17651a659cf091cd9b74
7
+ data.tar.gz: e2d59f0f673fb6280fac1d6d41e0888192ee74a480c0b5e860d19ea5366582b18f5ddd834e6aef4e9a6f3a98a0e682a01c38dce567d084ba5e82619805b4b510
data/lib/livetext.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Livetext
2
- VERSION = "0.8.62"
2
+ VERSION = "0.8.63"
3
3
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
4
4
  end
5
5
 
data/plugin/liveblog.rb CHANGED
@@ -5,9 +5,10 @@ require 'date'
5
5
  require 'runeblog' # Now depends explicitly
6
6
 
7
7
  def quote
8
- _puts "<blockquote>"
9
- _puts _body
10
- _puts "</blockquote>"
8
+ _passthru "<blockquote>"
9
+ _passthru _body
10
+ _passthru "</blockquote>"
11
+ _optional_blank_line
11
12
  end
12
13
 
13
14
  class ::Livetext::Functions # do this differently??
@@ -31,6 +32,26 @@ class ::Livetext::Functions # do this differently??
31
32
 
32
33
  end
33
34
 
35
+ ### inset
36
+
37
+ def inset
38
+ lines = _body
39
+ box = []
40
+ lines.each do |line|
41
+ if line[0] == "|"
42
+ line[0] = ' '
43
+ box << line
44
+ end
45
+ _passthru(line)
46
+ end
47
+ lr = _args.first
48
+ _passthru "<div style='float:#{lr}; width: 25%; padding:8px; padding-right:12px; font-family:verdana'>"
49
+ _passthru '<b><i>'
50
+ _passthru box.join("<br>")
51
+ _passthru_noline '</i></b></div>'
52
+ _optional_blank_line
53
+ end
54
+
34
55
  ### copy_asset
35
56
 
36
57
  def copy_asset(asset)
@@ -67,10 +88,18 @@ def _passthru(line, context = nil)
67
88
  @body << "<p>" if line.empty? && ! @_nopara
68
89
  end
69
90
 
91
+ def _passthru_noline(line, context = nil)
92
+ return if line.nil?
93
+ line = _formatting(line, context)
94
+ @body << line
95
+ @body << "<p>" if line.empty? && ! @_nopara
96
+ end
97
+
70
98
  def title
71
99
  title = @_data.chomp
72
100
  @meta.title = title
73
101
  @body << "<h1>#{title}</h1>"
102
+ _optional_blank_line
74
103
  end
75
104
 
76
105
  def pubdate
@@ -81,6 +110,7 @@ def pubdate
81
110
  y, m, d = y.to_i, m.to_i, d.to_i
82
111
  @meta.date = ::Date.new(y, m, d)
83
112
  @meta.pubdate = "%04d-%02d-%02d" % [y, m, d]
113
+ _optional_blank_line
84
114
  end
85
115
 
86
116
  def image # primitive so far
@@ -88,22 +118,26 @@ def image # primitive so far
88
118
  fname = _args.first
89
119
  path = "../assets/#{fname}"
90
120
  @body << "<img src=#{path}></img>"
121
+ _optional_blank_line
91
122
  end
92
123
 
93
124
  def tags
94
125
  _debug "args = #{_args}"
95
126
  @meta.tags = _args.dup || []
127
+ _optional_blank_line
96
128
  end
97
129
 
98
130
  def views
99
131
  _debug "data = #{_args}"
100
132
  @meta.views = _args.dup # + ["main"]
133
+ _optional_blank_line
101
134
  end
102
135
 
103
136
  def pin
104
137
  _debug "data = #{_args}"
105
138
  # verify only already-specified views?
106
139
  @meta.pinned = _args.dup
140
+ _optional_blank_line
107
141
  end
108
142
 
109
143
  # def liveblog_version
@@ -113,6 +147,7 @@ def list
113
147
  @body << "<ul>"
114
148
  _body {|line| @body << "<li>#{line}</li>" }
115
149
  @body << "</ul>"
150
+ _optional_blank_line
116
151
  end
117
152
 
118
153
  def list!
@@ -128,6 +163,7 @@ def list!
128
163
  end
129
164
  end
130
165
  @body << "</ul>"
166
+ _optional_blank_line
131
167
  end
132
168
 
133
169
  def asset
@@ -136,34 +172,36 @@ def asset
136
172
  # For now: copies, doesn't keep record
137
173
  # Later: Add to file and uniq; use in publishing
138
174
  list.each {|asset| copy_asset(asset) }
175
+ _optional_blank_line
139
176
  end
140
177
 
141
178
  def assets
142
179
  @meta.assets ||= []
143
180
  @meta.assets += _body
144
- end
145
-
146
- def write_post(meta)
147
- save = Dir.pwd
148
- @postdir.gsub!(/\/\//, "/") # FIXME unneeded?
149
- Dir.mkdir(@postdir) unless Dir.exist?(@postdir) # FIXME remember assets!
150
- Dir.chdir(@postdir)
151
- meta.views = meta.views.join(" ")
152
- meta.tags = meta.tags.join(" ") rescue ""
153
- File.write("body.txt", @body) # Actually HTML...
154
- File.write("teaser.txt", meta.teaser)
155
-
156
- fields = [:num, :title, :date, :pubdate, :views, :tags]
157
-
158
- fname2 = "metadata.txt"
159
- f2 = File.open(fname2, "w") do |f2|
160
- fields.each {|fld| f2.puts "#{fld}: #{meta.send(fld)}" }
161
- end
162
- Dir.chdir(save)
163
- rescue => err
164
- puts "err = #{err}"
165
- puts err.backtrace.join("\n")
181
+ _optional_blank_line
182
+ end
183
+
184
+ def write_post(meta)
185
+ save = Dir.pwd
186
+ @postdir.gsub!(/\/\//, "/") # FIXME unneeded?
187
+ Dir.mkdir(@postdir) unless Dir.exist?(@postdir) # FIXME remember assets!
188
+ Dir.chdir(@postdir)
189
+ meta.views = meta.views.join(" ")
190
+ meta.tags = meta.tags.join(" ") rescue ""
191
+ File.write("body.txt", @body) # Actually HTML...
192
+ File.write("teaser.txt", meta.teaser)
193
+
194
+ fields = [:num, :title, :date, :pubdate, :views, :tags]
195
+
196
+ fname2 = "metadata.txt"
197
+ f2 = File.open(fname2, "w") do |f2|
198
+ fields.each {|fld| f2.puts "#{fld}: #{meta.send(fld)}" }
166
199
  end
200
+ Dir.chdir(save)
201
+ rescue => err
202
+ puts "err = #{err}"
203
+ puts err.backtrace.join("\n")
204
+ end
167
205
 
168
206
  def teaser
169
207
  @meta.teaser = _body_text
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livetext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.62
4
+ version: 0.8.63
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-12 00:00:00.000000000 Z
11
+ date: 2019-03-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com