runeblog 0.1.59 → 0.1.61

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: a9609df6651bdbbca80999137759619281518ebb4d77d08d177c8d1bff9c1b22
4
- data.tar.gz: fa0f3619b0d306fb7df03e8015056aea57e547ebcd94dd022154cd7caa252f18
3
+ metadata.gz: 7453b5f695da487a1597153fc5d1d50f6587f1af6034ffc9b0d8e11d8fdcea18
4
+ data.tar.gz: 0d96a8a534c8835a486c2e58685d98696919483c880221ef6e0333b39a7b868a
5
5
  SHA512:
6
- metadata.gz: 7a378779a948cc365d0c42982f7aea41b0d08effb2699447411cd8ccb234b738e5af27a2341eaf177cac9193c21b141ef8aed4a27efc84e5aa1e6f3091256073
7
- data.tar.gz: 352e5c1c504d476c5919d73b6df4fd22f9bf62f6c81888f0d13d54084401aaa3d26032c7bf8d15da21c3d8c7f8b81d55446fd3128f1cf9681e03c0597d72fda4
6
+ metadata.gz: 786b5590bbfea02bc77382d06f6ccf4ed465da0140b96d09cecd1e9297fded5d9a7b82013b235f64c7be3f13d125c9582ad92d0f5a4448bf7917310f1a93a923
7
+ data.tar.gz: ad8870b822206825c0a175003f5772f114724401931d64d18b3f3a3bfeae135f60fc12793525d605d40010be2ed3e32b163cd8a3dafa8516a8e87bab010ea32d
data/README.lt3 CHANGED
@@ -12,6 +12,8 @@ It's based on Livetext (highly extensible Ruby-based markup)
12
12
  It has the concept of multiple "views" for a blog
13
13
  .end
14
14
 
15
+ The multiple views are in effect multiple blogs managed with the same backend.
16
+
15
17
  .h2 What is Livetext?
16
18
 
17
19
  Livetext is a markup format that is a throwback to the old, old days of text
@@ -36,11 +38,15 @@ _All the views will be managed the same way in the same place, and they will all
36
38
  Any post can easily be included in a single view, in more than one, or in all of them.
37
39
  Each view can have its own look and feel, and it can be linked/published separately from the others.
38
40
  Each view can be hosted in a different location and/or a different server and domain
41
+ Any post can be in more than one view
39
42
  .end
40
43
 
41
44
  .h2 The `blog environment
42
45
 
43
46
  There is a command-line tool called `blog which is a REPL (read-eval-print loop).
47
+ Note that this tool is a curses-based environment (mainly so it can display menus
48
+ and such to the user).
49
+
44
50
  The help message looks like this:
45
51
 
46
52
  .mono
@@ -49,7 +55,7 @@ The help message looks like this:
49
55
  h, help This message
50
56
  q, quit Exit the program
51
57
 
52
- change view _view Change current view
58
+ change view _view Change current view
53
59
  new view Create a new view
54
60
  list views List all views available
55
61
  lsv Same as: list views
@@ -62,16 +68,39 @@ The help message looks like this:
62
68
  rm _id Remove a post
63
69
  edit _id Edit a post
64
70
 
65
- open Look at current (local) view in browser
66
- open remote Look at current (deployed) view in browser
71
+ preview Look at current (local) view in browser
72
+ browse Look at current (deployed) view in browser
67
73
 
68
- relink Regenerate index for all views
69
- rebuild Regenerate all posts and relink
74
+ relink Regenerate index for all views (MAY CHANGE)
75
+ rebuild Regenerate all posts and relink (MAY CHANGE)
70
76
  deploy Deploy (current view)
71
77
  .end
72
78
 
73
- .h2 More later...
79
+ .h2 Getting started
80
+
81
+ But when you first run the REPL, it checks for an existing blog under the `.blog
82
+ directory. If it doesn't find one, it asks whether you want to create a new blog.
83
+ If you enter `y for yes, it creates a sort of "skeleton" with a single view
84
+ called ``test_view.
85
+
86
+ The next thing you should do is to create at least one view of your own. Use the
87
+ `[new view] command for this.
88
+
89
+ (new view)
90
+
91
+ (new post)
92
+
93
+ (preview)
94
+
95
+ (publishing one-time setup - server, ssh keys, etc.)
96
+
97
+ (publish)
98
+
99
+ (browse)
100
+
101
+ (and so on...)
74
102
 
75
103
  *[To be continued]
76
104
 
105
+ .h2 More later...
77
106
 
data/lib/liveblog.rb CHANGED
@@ -11,34 +11,14 @@ def quote
11
11
  _optional_blank_line
12
12
  end
13
13
 
14
- class ::Livetext::Functions # do this differently??
15
-
16
- def asset # FIXME this is baloney...
17
- raise "meh"
18
- param = ::Livetext::Functions.param
19
- context = ::Livetext::Functions.context
20
- main = context.eval("@main") rescue "NO MAIN?"
21
- @meta = main.instance_eval("@main.instance_eval { @meta }")
22
- @config = main.instance_eval("@main.instance_eval { @config }")
23
- @root = @config.root
24
-
25
- text, name = param.split("|")
26
-
27
- # FIXME how should this work?
28
- view = @blog.view
29
- url = find_asset(name)
30
- "<a href='#{url}'>#{text}</a>"
31
- end
32
-
33
- end
34
-
35
14
  def categories # does nothing right now
36
15
  end
37
16
 
38
17
 
39
- # Move elsewhere later
18
+ # Move elsewhere later!
40
19
 
41
20
  def h1; _out "<h1>#{@_data}</h1>"; end
21
+
42
22
  def h2; _out "<h2>#{@_data}</h2>"; end
43
23
  def h3; _out "<h3>#{@_data}</h3>"; end
44
24
  def h4; _out "<h4>#{@_data}</h4>"; end
@@ -91,13 +71,13 @@ end
91
71
  #############
92
72
 
93
73
  def init_liveblog # FIXME - a lot of this logic sucks
94
- @blog, num = Livetext.parameters
74
+ @blog, num, @live = Livetext.parameters # live is Livetext instance
95
75
  @meta = OpenStruct.new
96
76
  @meta.num = num
97
77
  @root = @blog.root rescue nil
98
78
  @view = @blog.view.name rescue nil
99
79
  @vdir = @blog.view.dir rescue nil
100
- @body = ""
80
+ # @body = ""
101
81
  end
102
82
 
103
83
  def _errout(*args)
@@ -105,24 +85,23 @@ def _errout(*args)
105
85
  end
106
86
 
107
87
  def _passthru(line, context = nil)
108
- $which = 2
109
88
  return if line.nil?
110
89
  line = _formatting(line, context)
111
- @body << line + "\n"
112
- @body << "<p>" if line.empty? && ! @_nopara
90
+ @live.body << line + "\n"
91
+ @live.body << "<p>" if line.empty? && ! @_nopara
113
92
  end
114
93
 
115
94
  def _passthru_noline(line, context = nil)
116
95
  return if line.nil?
117
96
  line = _formatting(line, context)
118
- @body << line
119
- @body << "<p>" if line.empty? && ! @_nopara
97
+ @live.body << line
98
+ @live.body << "<p>" if line.empty? && ! @_nopara
120
99
  end
121
100
 
122
101
  def title
123
102
  title = @_data.chomp
124
103
  @meta.title = title
125
- @body << "<h1>#{title}</h1>"
104
+ @live.body << "<h1>#{title}</h1>"
126
105
  _optional_blank_line
127
106
  end
128
107
 
@@ -140,9 +119,8 @@ end
140
119
  def image # primitive so far
141
120
  _debug "img: huh? <img src=#{_args.first}></img>"
142
121
  fname = _args.first
143
- puts "image fname = #{fname}"
144
122
  path = "../assets/#{fname}"
145
- @body << "<img src=#{path}></img>"
123
+ @live.body << "<img src=#{path}></img>"
146
124
  _optional_blank_line
147
125
  end
148
126
 
@@ -169,25 +147,25 @@ end
169
147
  # end
170
148
 
171
149
  def list
172
- @body << "<ul>"
173
- _body {|line| @body << "<li>#{line}</li>" }
174
- @body << "</ul>"
150
+ @live.body << "<ul>"
151
+ _body {|line| @live.body << "<li>#{line}</li>" }
152
+ @live.body << "</ul>"
175
153
  _optional_blank_line
176
154
  end
177
155
 
178
156
  def list!
179
- @body << "<ul>"
157
+ @live.body << "<ul>"
180
158
  lines = _body.each # {|line| @body << "<li>#{line}</li>" }
181
159
  loop do
182
160
  line = lines.next
183
161
  line = _formatting(line)
184
162
  if line[0] == " "
185
- @body << line
163
+ @live.body << line
186
164
  else
187
- @body << "<li>#{line}</li>"
165
+ @live.body << "<li>#{line}</li>"
188
166
  end
189
167
  end
190
- @body << "</ul>"
168
+ @live.body << "</ul>"
191
169
  _optional_blank_line
192
170
  end
193
171
 
@@ -213,7 +191,7 @@ def write_post(meta)
213
191
  Dir.chdir(@postdir)
214
192
  meta.views = meta.views.join(" ")
215
193
  meta.tags = meta.tags.join(" ") rescue ""
216
- File.write("body.txt", @body) # Actually HTML...
194
+ File.write("body.txt", @live.body) # Actually HTML...
217
195
  File.write("teaser.txt", meta.teaser)
218
196
 
219
197
  fields = [:num, :title, :date, :pubdate, :views, :tags]
@@ -230,13 +208,13 @@ end
230
208
 
231
209
  def teaser
232
210
  @meta.teaser = _body_text
233
- @body << @meta.teaser + "\n"
211
+ @live.body << @meta.teaser + "\n"
234
212
  # FIXME
235
213
  end
236
214
 
237
215
  def finalize
238
216
  if @blog.nil?
239
- return @body
217
+ return @live.body
240
218
  end
241
219
  @slug = @blog.make_slug(@meta)
242
220
  @postdir = @blog.view.dir + "/#@slug"
data/lib/post.rb CHANGED
@@ -124,8 +124,8 @@ class RuneBlog::Post
124
124
  debug "=== build"
125
125
  views = @meta.views
126
126
  text = File.read(@draft)
127
- Livetext.parameters = [@blog, @meta.num]
128
127
  livetext = Livetext.new(STDOUT)
128
+ Livetext.parameters = [@blog, @meta.num, livetext]
129
129
  meta = livetext.process_text(text)
130
130
  raise LivetextError(@draft) if meta.nil?
131
131
 
data/lib/runeblog.rb CHANGED
@@ -141,21 +141,16 @@ class RuneBlog
141
141
  dump("", "tagpool")
142
142
  view = RuneBlog::View.new(arg)
143
143
  self.view = view
144
- Livetext.parameters = [RuneBlog.blog, 0]
145
- devnull = File.new("/dev/null", "w")
146
- live = Livetext.new(devnull)
144
+ live = Livetext.new(nil)
145
+ Livetext.parameters = [RuneBlog.blog, 0, live]
147
146
  meta = live.transform(x::BlogTemplate)
148
- puts x::BlogTemplate
149
- puts
150
- puts meta
151
- puts
152
- puts "---"
153
147
  dump(meta, "templates/blogview.lt3")
154
148
  # dump(x::BlogHeader, "templates/blog_header.html")
155
149
  # dump(x::BlogTrailer, "templates/blog_trailer.html")
156
150
  dump("Initial creation", "last_published")
157
151
  Dir.chdir(up)
158
152
  @views << view
153
+ @views
159
154
  end
160
155
 
161
156
  def delete_view(name, force = false)
@@ -231,8 +226,8 @@ puts "---"
231
226
  path = @root + "/src/#{file}"
232
227
  raise FileNotFound(path) unless File.exist?(path)
233
228
  num = file.to_i # e.g. 0098-this-is-a-title
234
- Livetext.parameters = [self, num]
235
229
  live = Livetext.new # (STDOUT) # (nil)
230
+ Livetext.parameters = [self, num, live]
236
231
  text = File.read(path)
237
232
  live.process_text(text)
238
233
  rescue => err
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.1.59"
3
+ VERSION = "0.1.61"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
data/runeblog.gemspec CHANGED
@@ -20,7 +20,7 @@ spec = Gem::Specification.new do |s|
20
20
  s.authors = ["Hal Fulton"]
21
21
  s.email = 'rubyhacker@gmail.com'
22
22
  s.executables << "blog"
23
- s.add_runtime_dependency 'livetext', '~> 0.8', '>= 0.8.69'
23
+ s.add_runtime_dependency 'livetext', '~> 0.8', '>= 0.8.72'
24
24
  s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.16'
25
25
 
26
26
  # Files...
data/test/make_blog.rb CHANGED
@@ -1,4 +1,4 @@
1
- $LOAD_PATH << "./li"
1
+ $LOAD_PATH << "./lib"
2
2
 
3
3
  major, minor = RUBY_VERSION.split(".").values_at(0,1)
4
4
  ver = major.to_i*10 + minor.to_i
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runeblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.59
4
+ version: 0.1.61
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-04-14 00:00:00.000000000 Z
11
+ date: 2019-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '0.8'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.8.69
22
+ version: 0.8.72
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '0.8'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.8.69
32
+ version: 0.8.72
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rubytext
35
35
  requirement: !ruby/object:Gem::Requirement