runeblog 0.3.19 → 0.3.20

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
  SHA256:
3
- metadata.gz: 2cfbb99881fa66be7a0bcdc30c24851bf8994f3586cd3e888f90da64266f5452
4
- data.tar.gz: 64040a6450cab790bb2a7db4552ac610a526ea1ccd6d94319ae64c6cc6e3728d
3
+ metadata.gz: 564da6b288bef18302dfeea653099fa7fe119d09f83a53d17203a36fc84c56fa
4
+ data.tar.gz: e58a5ef46811db88820a7c8436e59511bdc89e38145e5d8516dfa7ac8878dfae
5
5
  SHA512:
6
- metadata.gz: 3c3df66c1d14c3ccd732949fda5a2b6e9b65bcd5121b2a1de6a60b8d7a8a6c05e38bf4660da4b175268c6f7e9292b1941f5dd1985328ccc9d6180261b5a1b844
7
- data.tar.gz: 6d673eeaeca255e66db6442551b03dc17817bd2f889e6de3401fda42e47ab426620be21d1647f22382b779be17c739dc981bdde848bb65391bd3018132be2658
6
+ metadata.gz: d15663f8d0f14e58276cddb83f898cd08db8014d5939b1bab27b8328765545c55a619a4d034a3848956839db1f21765a6cfac4a681136a4c3ada5c0fb223121e
7
+ data.tar.gz: 2eb21595baf1cb03dceb7a6d039fa31a473ae54243b6768771a08c7b49de55897bdc391e22386d236bc7d7ee067184e0849645259adf73643ece3e1d9ae369e1
@@ -0,0 +1,209 @@
1
+ .highlight table td { padding: 5px; }
2
+ .highlight table pre { margin: 0; }
3
+ .highlight .cm {
4
+ color: #999988;
5
+ font-style: italic;
6
+ }
7
+ .highlight .cp {
8
+ color: #999999;
9
+ font-weight: bold;
10
+ }
11
+ .highlight .c1 {
12
+ color: #999988;
13
+ font-style: italic;
14
+ }
15
+ .highlight .cs {
16
+ color: #999999;
17
+ font-weight: bold;
18
+ font-style: italic;
19
+ }
20
+ .highlight .c, .highlight .ch, .highlight .cd, .highlight .cpf {
21
+ color: #999988;
22
+ font-style: italic;
23
+ }
24
+ .highlight .err {
25
+ color: #a61717;
26
+ background-color: #e3d2d2;
27
+ }
28
+ .highlight .gd {
29
+ color: #000000;
30
+ background-color: #ffdddd;
31
+ }
32
+ .highlight .ge {
33
+ color: #000000;
34
+ font-style: italic;
35
+ }
36
+ .highlight .gr {
37
+ color: #aa0000;
38
+ }
39
+ .highlight .gh {
40
+ color: #999999;
41
+ }
42
+ .highlight .gi {
43
+ color: #000000;
44
+ background-color: #ddffdd;
45
+ }
46
+ .highlight .go {
47
+ color: #888888;
48
+ }
49
+ .highlight .gp {
50
+ color: #555555;
51
+ }
52
+ .highlight .gs {
53
+ font-weight: bold;
54
+ }
55
+ .highlight .gu {
56
+ color: #aaaaaa;
57
+ }
58
+ .highlight .gt {
59
+ color: #aa0000;
60
+ }
61
+ .highlight .kc {
62
+ color: #000000;
63
+ font-weight: bold;
64
+ }
65
+ .highlight .kd {
66
+ color: #000000;
67
+ font-weight: bold;
68
+ }
69
+ .highlight .kn {
70
+ color: #000000;
71
+ font-weight: bold;
72
+ }
73
+ .highlight .kp {
74
+ color: #000000;
75
+ font-weight: bold;
76
+ }
77
+ .highlight .kr {
78
+ color: #000000;
79
+ font-weight: bold;
80
+ }
81
+ .highlight .kt {
82
+ color: #445588;
83
+ font-weight: bold;
84
+ }
85
+ .highlight .k, .highlight .kv {
86
+ color: #000000;
87
+ font-weight: bold;
88
+ }
89
+ .highlight .mf {
90
+ color: #009999;
91
+ }
92
+ .highlight .mh {
93
+ color: #009999;
94
+ }
95
+ .highlight .il {
96
+ color: #009999;
97
+ }
98
+ .highlight .mi {
99
+ color: #009999;
100
+ }
101
+ .highlight .mo {
102
+ color: #009999;
103
+ }
104
+ .highlight .m, .highlight .mb, .highlight .mx {
105
+ color: #009999;
106
+ }
107
+ .highlight .sb {
108
+ color: #d14;
109
+ }
110
+ .highlight .sc {
111
+ color: #d14;
112
+ }
113
+ .highlight .sd {
114
+ color: #d14;
115
+ }
116
+ .highlight .s2 {
117
+ color: #d14;
118
+ }
119
+ .highlight .se {
120
+ color: #d14;
121
+ }
122
+ .highlight .sh {
123
+ color: #d14;
124
+ }
125
+ .highlight .si {
126
+ color: #d14;
127
+ }
128
+ .highlight .sx {
129
+ color: #d14;
130
+ }
131
+ .highlight .sr {
132
+ color: #009926;
133
+ }
134
+ .highlight .s1 {
135
+ color: #d14;
136
+ }
137
+ .highlight .ss {
138
+ color: #990073;
139
+ }
140
+ .highlight .s, .highlight .sa, .highlight .dl {
141
+ color: #d14;
142
+ }
143
+ .highlight .na {
144
+ color: #008080;
145
+ }
146
+ .highlight .bp {
147
+ color: #999999;
148
+ }
149
+ .highlight .nb {
150
+ color: #0086B3;
151
+ }
152
+ .highlight .nc {
153
+ color: #445588;
154
+ font-weight: bold;
155
+ }
156
+ .highlight .no {
157
+ color: #008080;
158
+ }
159
+ .highlight .nd {
160
+ color: #3c5d5d;
161
+ font-weight: bold;
162
+ }
163
+ .highlight .ni {
164
+ color: #800080;
165
+ }
166
+ .highlight .ne {
167
+ color: #990000;
168
+ font-weight: bold;
169
+ }
170
+ .highlight .nf, .highlight .fm {
171
+ color: #990000;
172
+ font-weight: bold;
173
+ }
174
+ .highlight .nl {
175
+ color: #990000;
176
+ font-weight: bold;
177
+ }
178
+ .highlight .nn {
179
+ color: #555555;
180
+ }
181
+ .highlight .nt {
182
+ color: #000080;
183
+ }
184
+ .highlight .vc {
185
+ color: #008080;
186
+ }
187
+ .highlight .vg {
188
+ color: #008080;
189
+ }
190
+ .highlight .vi {
191
+ color: #008080;
192
+ }
193
+ .highlight .nv, .highlight .vm {
194
+ color: #008080;
195
+ }
196
+ .highlight .ow {
197
+ color: #000000;
198
+ font-weight: bold;
199
+ }
200
+ .highlight .o {
201
+ color: #000000;
202
+ font-weight: bold;
203
+ }
204
+ .highlight .w {
205
+ color: #bbbbbb;
206
+ }
207
+ .highlight {
208
+ background-color: #f8f8f8;
209
+ }.highlight { font-family: courier; white-space: pre }
@@ -10,10 +10,12 @@
10
10
 
11
11
  .seek global.lt3
12
12
 
13
+ .variables post metadata.txt
14
+
13
15
  . FIXME
14
16
  .head
15
- og:title $title
16
- description $teaser
17
+ og:title $post.title
18
+ description $post.teaser
17
19
  style blog.css
18
20
  .end
19
21
 
@@ -23,7 +25,8 @@ style blog.css
23
25
  <div class="recent-content">
24
26
  $.post_toolbar
25
27
  <table border=0 width=100%><tr>
26
- <td align=left valign=bottom><h2 class="recent-title">$title</h2></td>
28
+ <td align=left valign=bottom><h2 class="recent-title">$post.title</h2></td>
29
+ . FIXME - longdate is passed in from outside
27
30
  <td align=right valign=top><font size=-5><br></font>$longdate</td>
28
31
  </tr></table><hr>
29
32
  $.copy guts.html
@@ -31,6 +34,6 @@ style blog.css
31
34
  </section>
32
35
 
33
36
  <br>
34
- .post_trailer
37
+ .post_trailer $post.num
35
38
  </body>
36
39
  </html>
@@ -12,7 +12,7 @@ end
12
12
 
13
13
  make_exception(:NotImplemented, "Feature not yet implemented")
14
14
  make_exception(:CantOpen, "Can't open '%1'")
15
- make_exception(:CantDelete, "Can't open '%1'")
15
+ make_exception(:CantDelete, "Can't delete '%1'")
16
16
  make_exception(:InternalError, "Glitch: %1 got arg '%2'")
17
17
  make_exception(:CantCopy, "Can't copy %1 to %2")
18
18
 
@@ -24,6 +24,7 @@ module RuneBlog::Helpers
24
24
  dir = root/:views/view/:settings
25
25
  end
26
26
  file = dir/"features.txt"
27
+ # puts "-- in #{Dir.pwd} trying to read #{file}"
27
28
  pairs = read_pairs(file)
28
29
  enabled = {}
29
30
  pairs.each {|k,v| enabled[k] = (v == "1") }
@@ -55,6 +55,7 @@ end
55
55
  def post
56
56
  @meta = OpenStruct.new
57
57
  @meta.num = _args[0]
58
+ setvar("post.num", @meta.num.to_i)
58
59
  _out " <!-- Post number #{@meta.num} -->\n "
59
60
  end
60
61
 
@@ -87,21 +88,35 @@ def post_toolbar
87
88
  end
88
89
 
89
90
  def post_trailer
90
- perma = _var("publish.proto") + "://" + _var("publish.server") +
91
- "/" + _var("publish.path") + "/" + _var("post.aslug") +
92
- ".html"
93
- tags = _var("post.tags")
91
+ # Not called from *inside* a post, therefore no @meta --
92
+ # can/must call read_metadata
93
+ num = _var("post.num").to_i
94
+ puts "post_trailer: num = #{num}"
95
+ vp = _post_lookup(num)
96
+ puts "post_trailer: lookup = #{vp.num} #{vp.title}"
97
+ dir = @blog.root/:posts/vp.nslug
98
+ puts " -- dir = #{dir}"
99
+ meta = Dir.chdir(dir) { @blog.read_metadata }
100
+ nslug = @blog.make_slug(meta)
101
+ aslug = nslug[5..-1]
102
+ proto = _var("publish.proto")
103
+ server = _var("publish.server")
104
+ path = _var("publish.path")
105
+ perma = "#{proto}://#{server}/#{path}/#{aslug}.html"
106
+ tags = meta.tags
94
107
  taglist = tags.empty? ? "" : "Tags: #{tags}"
95
108
 
96
109
  reddit_txt = ""
97
110
  if @reddit_enabled
98
111
  vdir = @blog.root/:views/@blog.view
99
- nslug = "#{_var("post.num")}-#{_var("post.aslug")}"
100
- date = _var("post.date")
112
+ date = meta.date
101
113
  rid_file = vdir/:posts/nslug/"reddit.id"
102
- rid = File.exist?(rid_file) ? File.read(rid_file).chomp : nil
103
- if rid.nil?
104
- title = _var("title")
114
+ if File.exist?(rid_file)
115
+ puts " reading #{rid_file}"
116
+ rid = File.read(rid_file).chomp
117
+ else
118
+ puts " creating #{rid_file}"
119
+ title = meta.title
105
120
  rid = _reddit_post_url(vdir, date, title, perma)
106
121
  dump(rid, rid_file)
107
122
  end
@@ -112,6 +127,7 @@ def post_trailer
112
127
  HTML
113
128
  # damned syntax highlighting </>
114
129
  end
130
+ print "Pause... "; getch
115
131
  _out <<~HTML
116
132
  #{reddit_txt}
117
133
  <hr>
@@ -32,8 +32,9 @@ Menu.top_config = {
32
32
  " HEAD info" => edit("#{std}/blog/head.lt3"),
33
33
  " Layout " => edit("#{std}/blog/index.lt3"),
34
34
  " Recent-posts entry" => edit("#{std}/blog/post_entry.lt3"),
35
- " Banner: Description" => edit("#{std}/blog/banner.lt3"),
36
- " Text portion" => edit("#{std}/banner/top.lt3"),
35
+ " Banner: Description" => edit("#{std}/banner/banner.lt3"),
36
+ " Navbar" => edit("#{std}/navbar/navbar.lt3"),
37
+ # " Text portion" => edit("#{std}/banner/top.lt3"),
37
38
  "Generator for a post" => edit("#{std}/post/generate.lt3"),
38
39
  " HEAD info for post" => edit("#{std}/post/head.lt3"),
39
40
  " Content for post" => edit("#{std}/post/index.lt3"),
@@ -0,0 +1,73 @@
1
+ require 'rubytext'
2
+
3
+ RubyText.start
4
+
5
+ # IdeaL A special sub-environment for creating a post
6
+ #
7
+ # 1. Display: view, post number, date
8
+ # 2. Menu?
9
+ # 3. - Edit/enter title
10
+ # 4. - Edit teaser
11
+ # 5. - Add views
12
+ # 6. - Add tags
13
+ # 7. - Import assets
14
+ # 8. - Save
15
+ # 9. - Quit
16
+ # Edit body after save/quit
17
+
18
+ def enter_title
19
+ STDSCR.puts __method__
20
+ r = STDSCR.rows / 2 - 3
21
+ @win = RubyText.window(1, 30, r: r, c: 30, border: false, bg: White, fg: Black)
22
+ @win.home
23
+ str = @win.gets
24
+ STDSCR.puts str.inspect
25
+ [__method__, 0]
26
+ end
27
+
28
+ def edit_teaser
29
+ STDSCR.puts __method__
30
+ [__method__, 1]
31
+ end
32
+
33
+ def add_views
34
+ STDSCR.puts __method__
35
+ [__method__, 2]
36
+ end
37
+
38
+ def add_tags
39
+ STDSCR.puts __method__
40
+ [__method__, 3]
41
+ end
42
+
43
+ def import_assets
44
+ STDSCR.puts __method__
45
+ [__method__, 4]
46
+ end
47
+
48
+ def save_post
49
+ STDSCR.puts __method__
50
+ [__method__, 5]
51
+ end
52
+
53
+ def quit_post
54
+ STDSCR.puts __method__
55
+ [__method__, 6]
56
+ end
57
+
58
+ items = {
59
+ "Enter title" => proc { enter_title },
60
+ "Edit teaser" => proc { edit_teaser },
61
+ "Add views" => proc { add_views },
62
+ "Add tags" => proc { add_tags },
63
+ "Import assets" => proc { import_assets },
64
+ "Save" => proc { save_post },
65
+ "Quit" => proc { quit_post }
66
+ }
67
+
68
+ curr = 0
69
+ loop do
70
+ str, curr = STDSCR.menu(c: 10, items: items, curr: curr, sticky: true)
71
+ break if curr.nil?
72
+ STDSCR.puts "str = #{str} curr = #{curr}"
73
+ end
@@ -213,6 +213,7 @@ module RuneBlog::REPL
213
213
  content = postdir/"/guts.html"
214
214
  next if fresh?(orig, content)
215
215
 
216
+ # puts "Calling generate_post(#{orig})"
216
217
  @blog.generate_post(orig) # rebuild post
217
218
  Dir.chdir(postdir) do
218
219
  meta = @blog.read_metadata
@@ -227,9 +228,9 @@ module RuneBlog::REPL
227
228
  debug "Starting cmd_rebuild..."
228
229
  puts
229
230
  regen_posts
230
- puts " Generating view"
231
+ puts " Generating view..."
231
232
  @blog.generate_view(@blog.view)
232
- puts " Generating index"
233
+ puts " Generating index..."
233
234
  @blog.generate_index(@blog.view)
234
235
  puts " ...finished!"
235
236
  rescue => err
@@ -256,6 +257,22 @@ module RuneBlog::REPL
256
257
  end
257
258
 
258
259
  def cmd_new_view(arg)
260
+ view_name = ask!(" Filename: ")
261
+ @blog.create_view(view_name) # call change_view??
262
+ title = ask!(" View title: ")
263
+ subtitle = ask!(" Subtitle : ")
264
+ domain = ask!(" Domain : ")
265
+
266
+ vfile = "#{@blog.root}/views/#{view_name}/settings/view.txt"
267
+ hash = {/VIEW_NAME/ => view_name,
268
+ /VIEW_TITLE/ => title,
269
+ /VIEW_SUBTITLE/ => subtitle,
270
+ /VIEW_DOMAIN/ => domain}
271
+ @blog.complete_file(vfile, nil, hash)
272
+ @blog.change_view(view_name)
273
+ end
274
+
275
+ def cmd_new_view_ORIG(arg)
259
276
  if arg.nil?
260
277
  arg = ask(fx("\nFilename: ", :bold))
261
278
  puts
@@ -320,6 +337,7 @@ module RuneBlog::REPL
320
337
  v = fx(v, :bold) if v == @blog.view.name
321
338
  # FIXME: next 3 lines are crufty as hell
322
339
  lines = File.readlines(@blog.root/"views/#{v}/settings/view.txt")
340
+ lines.map!(&:chomp)
323
341
  lines = lines.select {|x| x =~ /^title / && x !~ /VIEW_/ }
324
342
  title = lines.first.split(" ", 2)[1]
325
343
  print " ", ('%15s' % v)
@@ -49,6 +49,7 @@ class RuneBlog
49
49
  ConfigFile = "config"
50
50
  Themes = RuneBlog::Path/"../themes"
51
51
 
52
+ include Helpers
52
53
  include ErrorChecks
53
54
 
54
55
  class << self
@@ -60,10 +61,10 @@ class RuneBlog
60
61
  attr_reader :views, :sequence
61
62
  attr_accessor :root, :editor, :features
62
63
  attr_accessor :view # overridden
64
+ attr_accessor :post
63
65
 
64
66
  attr_accessor :post_views, :post_tags, :dirty_views
65
67
 
66
- include Helpers
67
68
 
68
69
  class Default
69
70
 
@@ -216,6 +217,7 @@ class RuneBlog
216
217
  meta = read_pairs!("metadata.txt")
217
218
  meta.views = meta.views.split
218
219
  meta.tags = meta.tags.split
220
+ RuneBlog.blog.post = meta
219
221
  meta
220
222
  end
221
223
 
@@ -296,6 +298,7 @@ class RuneBlog
296
298
  _set_publisher
297
299
  when String
298
300
  new_view = str2view(arg)
301
+ # puts "new_view = #{new_view} (#{new_view.class})"
299
302
  check_error(NoSuchView, arg) { new_view.nil? }
300
303
  @view = new_view
301
304
  read_features(@view)
@@ -530,7 +533,8 @@ class RuneBlog
530
533
  # puts [draft, meta.views].inspect
531
534
  list << draft if meta.views.include?(self.view.to_s)
532
535
  end
533
- list.sort
536
+ # list.sort
537
+ curr_drafts
534
538
  end
535
539
 
536
540
  def all_drafts
@@ -622,10 +626,11 @@ class RuneBlog
622
626
  title = meta.title
623
627
  tags = meta.tags
624
628
  # FIXME simplify
625
- addvar(hash, "post.num" => pnum, "post.aslug" => aslug,
626
- "post.date" => date, title: title.chomp,
627
- "post.tags" => tags.join(" "), teaser: excerpt.chomp,
628
- longdate: longdate)
629
+ addvar(hash, "post.num" => pnum, "post.aslug" => aslug,
630
+ "post.date" => date, title: title.chomp,
631
+ teaser: excerpt.chomp, longdate: longdate,
632
+ "post.nslug" => pnum + "-" + aslug,
633
+ "post.tags" => tags.join(" "))
629
634
  end
630
635
  hash
631
636
  rescue => err
@@ -668,6 +673,9 @@ class RuneBlog
668
673
  dst: "guts.html", mix: "liveblog"
669
674
  hash = _post_metadata(draft, pdraft)
670
675
  vposts = @root/:views/view_name/:posts # Step 2...
676
+ puts "-- hpost:"
677
+ hash.each_pair {|k,v| puts " #{k}: #{v}" if k.is_a? Symbol }
678
+ puts
671
679
  copy!(pdraft, vposts) # ??
672
680
  copy(pdraft/"guts.html", @theme/:post) # Step 3...
673
681
  preprocess cwd: @theme/:post, src: "generate.lt3", # Step 4...
@@ -1,7 +1,7 @@
1
1
  if !defined?(RuneBlog::Path)
2
2
 
3
3
  class RuneBlog
4
- VERSION = "0.3.19"
4
+ VERSION = "0.3.20"
5
5
 
6
6
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
7
7
  Path = File.dirname(path)
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.3.19
4
+ version: 0.3.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-14 00:00:00.000000000 Z
11
+ date: 2020-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -137,6 +137,7 @@ files:
137
137
  - empty_view/themes/standard/etc/blog.css.lt3
138
138
  - empty_view/themes/standard/etc/externals.lt3
139
139
  - empty_view/themes/standard/etc/favicon.ico
140
+ - empty_view/themes/standard/etc/github.css
140
141
  - empty_view/themes/standard/etc/misc.js
141
142
  - empty_view/themes/standard/post/generate.lt3
142
143
  - empty_view/themes/standard/post/head.lt3
@@ -150,6 +151,7 @@ files:
150
151
  - lib/logging.rb
151
152
  - lib/lowlevel.rb
152
153
  - lib/menus.rb
154
+ - lib/newpost.rb
153
155
  - lib/pathmagic.rb
154
156
  - lib/post.rb
155
157
  - lib/processing.rb