livetext 0.9.01 → 0.9.02

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
  SHA256:
3
- metadata.gz: 9b5dbf29a35e17c163982a4c2d5355949a72be58c662e75cf1f1d59bef1894dd
4
- data.tar.gz: 882f20c410919dc4aa5f5d4e4277cdff88dca8efce5b1d0d96d1228767dd80c3
3
+ metadata.gz: d9e45d3b0ea8fb06374c84d7e830ca7537fc553decbdbe034171dd7f9395671a
4
+ data.tar.gz: 1943173d9090705f70b447e4a283d73cb9bbd86c7458a6e744431c79e3ccea21
5
5
  SHA512:
6
- metadata.gz: 58671323ec46267e898c2999e86fc3f5e1379eae4adca5df0adf7be90d0d8b35a9aefaa9f4bf778f67963624fa764ba8087349500e5c4c280c90297c9fc07789
7
- data.tar.gz: 3ddfa97b6ef5a86c311baf9df53851bf39f01780fbec54a34de64bd9b4970aa8e055b77147891927e1ed378b87a050a414d11a51d942010ba0d774a99714e3bb
6
+ metadata.gz: 78452f768fe1a334af4f7b2f5ac437bcda06d27a7e4ae3bf360ad92db61632a0bdb67c1a8e5fcf7ba8f18e4c3941181c084fb2a88b0ece4eae7b3eb31e4bddb6
7
+ data.tar.gz: 4fca6756c94dcceb8a7f5224d71aca40e3a47cea1bfc1d660e62409ed532b1bed1123528615e32ca01715f0a6a8d2e7efb07b9a22ed2c7f2c0362829c7b2639f
@@ -195,6 +195,7 @@ class FormatLine
195
195
  end
196
196
 
197
197
  def add_token(kind, token = @token)
198
+ return if token.nil?
198
199
  @tokenlist << [kind, token] unless token.empty?
199
200
  @token = Null.dup
200
201
  end
@@ -352,6 +353,8 @@ class FormatLine
352
353
  grab # ZZZ
353
354
  loop do
354
355
  case
356
+ when curr.nil?
357
+ return str
355
358
  when curr == Escape
356
359
  str << escaped
357
360
  next
@@ -1,5 +1,5 @@
1
1
  class Livetext
2
- VERSION = "0.9.01"
2
+ VERSION = "0.9.02"
3
3
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
4
4
  end
5
5
 
@@ -205,6 +205,7 @@ EOS
205
205
  else
206
206
  lines = _body
207
207
  end
208
+ lines.map! {|x| x.sub(/# .*/, "").strip } # strip comments
208
209
  lines.each do |line|
209
210
  next if line.strip.empty?
210
211
  var, val = line.split(" ", 2)
@@ -68,15 +68,14 @@ module Livetext::UserAPI
68
68
  end
69
69
 
70
70
  def _body(raw=false)
71
- lines = [] # @save_location = @sources.last
71
+ lines = []
72
72
  end_found = false
73
73
  loop do
74
74
  @line = nextline
75
75
  break if @line.nil?
76
76
  @line.chomp!
77
- end_found = _end?(@line)
78
- break if end_found
79
- next if _comment?(@line) # FIXME Will cause problem with $. ?
77
+ break if _end?(@line)
78
+ next if _comment?(@line)
80
79
  @line = _format(@line) unless raw
81
80
  lines << @line
82
81
  end
@@ -91,13 +90,11 @@ module Livetext::UserAPI
91
90
  str = "Fake error? 'Expecting .end, found end of file'\n"
92
91
  str << err.inspect + "\n"
93
92
  str << err.backtrace.map {|x| " " + x }.join("\n")
94
- STDERR.puts str
95
- exit
96
- # _error!(str)
93
+ _error!(str)
97
94
  end
98
95
 
99
96
  def _body_text(raw=false)
100
- _body(Livetext::Sigil).join("\n")
97
+ _body.join("\n")
101
98
  end
102
99
 
103
100
  def _raw_body!
@@ -6,6 +6,7 @@ def epub!
6
6
  @cover = @_args[2]
7
7
  if ::File.directory?(src)
8
8
  files = ::Dir["#{src}/*"].grep /\.html$/
9
+ files = files.sort # why is this necessary now?
9
10
  cmd = "cat #{files.join(' ')} >TEMP.html"
10
11
  system(cmd)
11
12
  else
@@ -17,7 +18,8 @@ def epub!
17
18
  cmd << "--cover #@cover " if @cover
18
19
  system(cmd)
19
20
 
20
- str = `links -dump TEMP.html | wc -w`
21
+ system("links -dump TEMP.html >/tmp/links.out")
22
+ str = `wc -w /tmp/links.out`
21
23
  nw = str.split[0]
22
24
  puts "Approx words: #{nw}"
23
25
  ::FileUtils.rm("TEMP.html")
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.9.01
4
+ version: 0.9.02
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-12-31 00:00:00.000000000 Z
11
+ date: 2020-01-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com