livetext 0.8.24 → 0.8.25

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d67dcd5f1a55000e0be2a812706d86183f8a0c0
4
- data.tar.gz: 7e1c331915b404cc668bbd49b8a63f729c4f0bd7
3
+ metadata.gz: b361038930421fd67a403b32b0f2f5e511f6f35c
4
+ data.tar.gz: c6769d374d3b981ef89193c31dd75f7869810ecb
5
5
  SHA512:
6
- metadata.gz: 98b1eeb02376acb99b3d35f401a44a8c4c1f85427cca98007afb3fbc8ac498f9f5114c3a49846659a6b7e23290a243cf1b2da110ded69c40600a2b183c12b09c
7
- data.tar.gz: dc6470a660cc1798c4a64136b3957382090166e3c3d5058038e321c159a87ab38e5dad30829acbc1540611d8ebba4a2fa27ef92dc27660a0da0e45550a314b14
6
+ metadata.gz: 7a260fec5f64e897f2d7a09b162e8bf55ee76b6bb59982fa17f4724162746b2930224577c3a415ab6ee91e57586d360bf4c90bac3445c66c255a3f286c8adb62
7
+ data.tar.gz: 7503dd3e8c18a9e22b758c0d691e9d91a6861f6414bc6e67dba2d03f8de0e8188c132208ec6405cb282b19a3900258e3b74aa5fa837f069df2a54d28b8f52387
@@ -1,7 +1,54 @@
1
1
  require 'ostruct'
2
2
  require 'yaml'
3
3
 
4
+ require 'runeblog' # Now depends explicitly
5
+
6
+ class ::Livetext::Functions # do this differently??
7
+
8
+ def asset # FIXME this is baloney...
9
+ param = Livetext::Functions.param
10
+ puts "REACHED func_asset"
11
+ text, name = param.split("|")
12
+
13
+ # FIXME how should this work?
14
+ # url = find_asset(name)
15
+ url = name
16
+ "<a href='#{url}'>#{text}</a>"
17
+ end
18
+
19
+ end
20
+
21
+ ### find_asset
22
+
23
+ def find_asset(asset)
24
+ views = @config.views
25
+ views.each do |view|
26
+ vdir = @config.viewdir(view)
27
+ post_dir = "#{vdir}#{@meta.slug}/assets/"
28
+ path = post_dir + asset
29
+ STDERR.puts " Seeking #{path}"
30
+ return path if File.exist?(path)
31
+ end
32
+ views.each do |view|
33
+ dir = @config.viewdir(view) + "/assets/"
34
+ path = dir + asset
35
+ STDERR.puts " Seeking #{path}"
36
+ return path if File.exist?(path)
37
+ end
38
+ top = @root + "/assets/"
39
+ path = top + asset
40
+ STDERR.puts " Seeking #{path}"
41
+ return path if File.exist?(path)
42
+
43
+ return nil
44
+ end
45
+
46
+ #############
47
+
4
48
  def init_liveblog
49
+ @blog = RuneBlog.new
50
+ @config = @blog.read_config
51
+ @root = @config.root
5
52
  @teaser = ""
6
53
  @body = ""
7
54
  @body = ""
@@ -68,8 +115,9 @@ def list!
68
115
  end
69
116
 
70
117
  def asset
71
- @meta.assets ||= []
72
- @meta.assets += _args
118
+ @meta.assets ||= {}
119
+ list = _args
120
+ list.each {|asset| @meta.assets[asset] = find_asset(asset) }
73
121
  STDERR.puts red("\n [DEBUG] ") + "Asset(s): #{@meta.assets}"
74
122
  end
75
123
 
@@ -45,10 +45,13 @@ class FormatLine
45
45
  end
46
46
 
47
47
  def funcall(name, param)
48
- fobj = ::Livetext::Functions.new
49
- ::Livetext::Functions.param = param
50
- # STDERR.puts "Calling '#{name}' with '#{param}'"
51
- fobj.send(name)
48
+ if self.respond_to?("func_" + name.to_s)
49
+ self.send("func_" + name.to_s, param)
50
+ else
51
+ fobj = ::Livetext::Functions.new
52
+ ::Livetext::Functions.param = param
53
+ fobj.send(name)
54
+ end
52
55
  end
53
56
 
54
57
  def vsub
@@ -57,7 +60,6 @@ class FormatLine
57
60
  end
58
61
 
59
62
  def fcall
60
- # puts "Calling funcall: #@name(#@param)"
61
63
  @buffer << funcall(@fname, @param)
62
64
  @fname, @param = "", ""
63
65
  end
@@ -27,6 +27,11 @@ class Livetext::Functions # Functions will go here... user-def AND pre-def??
27
27
  "<a href='#{url}'>#{text}</a>"
28
28
  end
29
29
 
30
+ # def asset
31
+ # param = self.class.param
32
+ # # FIXME how should this work?
33
+ # end
34
+
30
35
  def yt
31
36
  param = self.class.param
32
37
  "https://www.youtube.com/watch?v=#{param}"
@@ -1,5 +1,5 @@
1
1
  class Livetext
2
- VERSION = "0.8.24"
2
+ VERSION = "0.8.25"
3
3
  end
4
4
 
5
5
  require 'fileutils'
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.24
4
+ version: 0.8.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-16 00:00:00.000000000 Z
11
+ date: 2017-05-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com
@@ -148,9 +148,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements: []
150
150
  rubyforge_project:
151
- rubygems_version: 2.4.2
151
+ rubygems_version: 2.2.2
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: A smart processor for text
155
155
  test_files: []
156
- has_rdoc: