runeblog 0.3.07 → 0.3.08

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: c9c40711649cc90ed5892d256311a01c9841655a1945cc2dcfcc9bd8dd0e77e5
4
- data.tar.gz: ff3b53cdf4d0f6d7136e31cef2aca74a4843d836d45518909baa082f134ec089
3
+ metadata.gz: b757eafd85e4ea485fee79a8bee301835900810d1692b9f9ef840c486668ca85
4
+ data.tar.gz: 8542cbb10ada3de44d5f261876409e818fe4dc07a75bf7848488f6566168e8e0
5
5
  SHA512:
6
- metadata.gz: 667ae25acb4c5230f9674fc067bbfca36b18562f8bf9f740f066e39621ae3eff9a952309eb28b3ed754c8f4c4acc0cc7a25054db1f7999844c8f49ac6621cb9c
7
- data.tar.gz: cda360ef27a9733285d4aa0c50f402cd00c385f30f49f40d0fd1d61fc1046aec84dc2b0d8f6bb9e4db018c8f4266eb7381c1e9171ff5096166a7054fda98e8ea
6
+ metadata.gz: d587dfae5d4649dfc85495f27785b365a07bc37e4a8b5c99eefa5a240b608ef741f8c7be60719fc4a13d2aea5e8d8a5a3ea460d1ff55e04590d77e3850016683
7
+ data.tar.gz: 97f657d2a11ad08aa1dd244c1465b3c3530a8bbd842657325231dc8a46b5719f8987c5b4177f06153372f815eb7c193e40b82fba32ca8027a9226667fa530905
data/bin/blog CHANGED
@@ -153,7 +153,8 @@ ver = major.to_i*10 + minor.to_i
153
153
  unless ver >= 24
154
154
  RubyText.stop
155
155
  sleep 0.2
156
- abort "Needs Ruby 2.4 or greater"
156
+ puts "Needs Ruby 2.4 or greater"
157
+ exit
157
158
  end
158
159
 
159
160
  include RuneBlog::Helpers # for try_read_config
@@ -23,6 +23,7 @@ style blog.css
23
23
 
24
24
  <section class="post">
25
25
  <div class="recent-content">
26
+ $.post_toolbar
26
27
  <table border=0 width=100%><tr>
27
28
  <td align=left valign=bottom><h2 class="recent-title">$title</h2></td>
28
29
  <td align=right valign=top><font size=-5><br></font>$longdate</td>
@@ -32,7 +33,6 @@ style blog.css
32
33
  </section>
33
34
 
34
35
  <br>
35
- <hr>
36
36
  .post_trailer
37
37
  </body>
38
38
  </html>
@@ -1,3 +1,4 @@
1
+ .nopara # FIXME later
1
2
  .mixin liveblog
2
3
 
3
4
  <html>
@@ -27,7 +28,7 @@ Don't be stupid. I just told you I was a rabbit.
27
28
  .end
28
29
 
29
30
  .faq Why do you answer a question with a question?
30
- *Do I in fact answer a question with a question?
31
+ *Do I in fact answer a question with a question?
31
32
  .end
32
33
 
33
34
  .faq Are you serious?
@@ -39,9 +39,8 @@ module RuneBlog::Helpers
39
39
  puts "dir = #{Dir.pwd}"
40
40
  end
41
41
 
42
- def copy_data(tag, dest)
42
+ def copy_data(dest)
43
43
  data = RuneBlog::Path + "/../data" # files kept inside gem
44
- # FIXME tag no longer used
45
44
  files = %w[ROOT VIEW EDITOR universal.lt3 global.lt3 features.txt]
46
45
  files.each {|file| copy(data + "/" + file, dest) unless File.exist?(dest/file) }
47
46
  end
@@ -21,6 +21,18 @@ def init_liveblog # FIXME - a lot of this logic sucks
21
21
  @vdir = @blog.view.dir rescue "NONAME"
22
22
  @version = RuneBlog::VERSION
23
23
  @theme = @vdir/:themes/:standard
24
+
25
+ @reddit_comments = ""
26
+ @reddit_enabled = @blog.features["reddit"]
27
+ if @reddit_enabled
28
+ @reddit_comments = <<~HTML
29
+ <a href="#reddit_comments">
30
+ <img src="assets/reddit-logo.png"
31
+ width=24 height=24
32
+ alt="Scroll to reddit comments"></img>
33
+ </a>
34
+ HTML
35
+ end
24
36
  rescue
25
37
  raise "Only works inside a blog repo"
26
38
  end
@@ -52,11 +64,11 @@ end
52
64
  str.length > 0
53
65
  end
54
66
 
55
- def _reddit_post_url(vdir, title, url)
67
+ def _reddit_post_url(vdir, date, title, url)
56
68
  _got_python?
57
69
  tmpfile = "/tmp/reddit-post-url.txt"
58
70
  File.open(tmpfile, "w") do |tmp|
59
- tmp.puts "[Post] " + title
71
+ tmp.puts "[#{date}] #{title}"
60
72
  tmp.puts url
61
73
  end
62
74
  rid = nil
@@ -65,6 +77,13 @@ end
65
77
  rid # returns reddit id
66
78
  end
67
79
 
80
+ def post_toolbar
81
+ back = %[<a style="text-decoration: none" href="javascript:history.go(-1)">[Back]</a>]
82
+ _out <<~HTML
83
+ <div align='right'>#{back} #@reddit_comments</div>
84
+ HTML
85
+ end
86
+
68
87
  def post_trailer
69
88
  perma = _var("publish.proto") + "://" + _var("publish.server") +
70
89
  "/" + _var("publish.path") + "/" + _var("post.aslug") +
@@ -72,31 +91,32 @@ def post_trailer
72
91
  tags = _var("post.tags")
73
92
  taglist = tags.empty? ? "" : "Tags: #{tags}"
74
93
 
75
- reddit_enabled = @blog.features["reddit"]
76
94
  reddit_txt = ""
77
- if reddit_enabled
95
+ if @reddit_enabled
78
96
  vdir = @blog.root/:views/@blog.view
79
97
  nslug = "#{_var("post.num")}-#{_var("post.aslug")}"
98
+ date = _var("post.date")
80
99
  rid_file = vdir/:posts/nslug/"reddit.id"
81
100
  rid = File.exist?(rid_file) ? File.read(rid_file).chomp : nil
82
101
  if rid.nil?
83
102
  title = _var("title")
84
- rid = _reddit_post_url(vdir, title, perma)
103
+ rid = _reddit_post_url(vdir, date, title, perma)
85
104
  dump(rid, rid_file)
86
105
  end
87
106
  reddit_txt = <<~HTML
88
- <hr>
107
+ <a name='reddit_comments'>
89
108
  <script src='https://redditjs.com/post.js'
90
109
  data-url="#{rid}" data-width=800 ></script>
91
110
  HTML
92
111
  # damned syntax highlighting </>
93
112
  end
94
113
  _out <<~HTML
114
+ #{reddit_txt}
115
+ <hr>
95
116
  <table width=100%><tr>
96
117
  <td width=10%><a style="text-decoration: none" href="javascript:history.go(-1)">[Back]</a></td>
97
118
  <td width=10%><a style="text-decoration: none" href="#{perma}"> [permalink] </a></td>
98
119
  <td width=80% align=right><font size=-3>#{taglist}</font></td></tr></table>
99
- #{reddit_txt}
100
120
  HTML
101
121
  end
102
122
 
@@ -105,7 +125,7 @@ def faq
105
125
  _out "<br>" if @faq_count == 0
106
126
  @faq_count += 1
107
127
  ques = _data.chomp
108
- ans = _body_text
128
+ ans = _body.join("\n")
109
129
  id = "faq#@faq_count"
110
130
  _out %[&nbsp;<a data-toggle="collapse" href="##{id}" role="button" aria-expanded="false" aria-controls="collapseExample"><font size=+3>&#8964;</font></a>]
111
131
  _out %[&nbsp;<b>#{ques}</b>]
@@ -12,6 +12,10 @@
12
12
  File.write(name, obj)
13
13
  end
14
14
 
15
+ def timelog(line, file)
16
+ File.open(file, "a") {|f| f.puts "#{Time.now} #{line}" }
17
+ end
18
+
15
19
  def system!(str, show: false)
16
20
  log!(enter: __method__, args: [str], level: 2)
17
21
  STDERR.puts str if show
@@ -38,14 +38,22 @@ class RuneBlog::Publishing
38
38
  url = "#@proto://#@server/#@path" # /#{vname}"
39
39
  end
40
40
 
41
+ def check_new_posts
42
+ # How do we know??
43
+ # If it's newly published:
44
+ # autopost on reddit (if enabled and not already)
45
+ # " " twitter (if enabled and not already)
46
+ # " " facebook (if enabled and not already)
47
+ end
48
+
41
49
  def publish
42
50
  log!(enter: __method__, level: 1)
43
51
  dir = @docroot/@path
44
52
  view_name = @blog.view.name
45
- viewpath = dir # /view_name
46
- # FIXME rsync doesn't work
53
+ viewpath = dir
47
54
  cmd = "rsync -r -z #{@blog.root}/views/#{@blog.view}/remote/ #@user@#@server:#{viewpath}/"
48
55
  system!(cmd)
56
+ check_new_posts
49
57
  dump("#{@blog.view} at #{Time.now}", "#{@blog.view.dir}/last_published")
50
58
  true
51
59
  end
@@ -41,24 +41,25 @@ module RuneBlog::REPL
41
41
  end
42
42
 
43
43
  def cmd_config
44
- hash = {"Global configuration" => "global.lt3",
45
- " View-specific variables" => "../../settings/view.txt",
46
- " Recent posts" => "../../settings/recent.txt",
47
- " Publishing vars" => "../../settings/publish.txt",
48
- " Config for reddit" => "../../config/reddit/credentials.txt",
49
- " Config for Facebook" => "../../config/facebook/credentials.txt",
50
- " Config for Twitter" => "../../config/twitter/credentials.txt",
51
- "View generator" => "blog/generate.lt3",
52
- " Banner: Description" => "blog/banner.lt3",
53
- " Banner: Text portion" => "banner/top.lt3",
54
- " HEAD info for view" => "blog/head.lt3",
55
- " User-edited detail for view" => "blog/index.lt3",
56
- " Generator for recent-posts entry" => "blog/post_entry.lt3",
57
- "Generator for a post" => "post/generate.lt3",
58
- " HEAD info for post" => "post/head.lt3",
59
- " Content for post" => "post/index.lt3",
60
- "Global CSS" => "etc/blog.css.lt3",
61
- "External JS/CSS (Bootstrap, etc.)" => "/etc/externals.lt3"
44
+ hash = {"Variables (general)" => "global.lt3",
45
+ " View-specific" => "../../settings/view.txt",
46
+ " Recent posts" => "../../settings/recent.txt",
47
+ " Publishing" => "../../settings/publish.txt",
48
+ "Configuration: enable/disable" => "../../settings/features.txt",
49
+ " Reddit" => "../../config/reddit/credentials.txt",
50
+ " Facebook" => "../../config/facebook/credentials.txt",
51
+ " Twitter" => "../../config/twitter/credentials.txt",
52
+ "View: generator" => "blog/generate.lt3",
53
+ " HEAD info" => "blog/head.lt3",
54
+ " Layout " => "blog/index.lt3",
55
+ " Recent-posts entry" => "blog/post_entry.lt3",
56
+ " Banner: Description" => "blog/banner.lt3",
57
+ " Text portion" => "banner/top.lt3",
58
+ "Generator for a post" => "post/generate.lt3",
59
+ " HEAD info for post" => "post/head.lt3",
60
+ " Content for post" => "post/index.lt3",
61
+ "Global CSS" => "etc/blog.css.lt3",
62
+ "External JS/CSS (Bootstrap, etc.)" => "/etc/externals.lt3"
62
63
  }
63
64
 
64
65
  dir = @blog.view.dir/"themes/standard/"
@@ -209,12 +210,13 @@ module RuneBlog::REPL
209
210
 
210
211
  def regen_posts
211
212
  drafts = @blog.drafts # current view
213
+ puts " Regenerating posts..." unless drafts.empty?
212
214
  drafts.each do |draft|
213
215
  orig = @blog.root/:drafts/draft
214
216
  html = @blog.root/:posts/draft
215
217
  html.sub!(/.lt3$/, "/guts.html")
216
218
  next if fresh?(orig, html)
217
- puts " Regenerating #{draft}"
219
+ puts " #{draft}"
218
220
  @blog.generate_post(orig) # rebuild post
219
221
  end
220
222
  puts
@@ -224,8 +226,11 @@ module RuneBlog::REPL
224
226
  debug "Starting cmd_rebuild..."
225
227
  puts
226
228
  regen_posts
229
+ puts " Generating view"
227
230
  @blog.generate_view(@blog.view)
231
+ puts " Generating index"
228
232
  @blog.generate_index(@blog.view)
233
+ puts " ...finished!"
229
234
  rescue => err
230
235
  _tmp_error(err)
231
236
  end
@@ -87,9 +87,9 @@ class RuneBlog
87
87
  new_sequence
88
88
  end
89
89
  unless File.exist?(repo_root/"data/VIEW")
90
- copy_data(:config, repo_root/:data)
90
+ copy_data(repo_root/:data)
91
91
  end
92
- copy_data(:extra, repo_root/:config)
92
+ # copy_data(:extra, repo_root/:config)
93
93
  write_repo_config(root: repo_root)
94
94
  @blog = self.new
95
95
  @blog
@@ -494,13 +494,14 @@ class RuneBlog
494
494
  log!(enter: __method__, level: 3)
495
495
  dir = self.view.dir/:posts
496
496
  posts = Dir.entries(dir).grep(/^\d{4}/)
497
- posts
497
+ posts.sort
498
498
  end
499
499
 
500
500
  def drafts
501
501
  log!(enter: __method__, level: 3)
502
502
  dir = @root/:drafts
503
503
  drafts = Dir.entries(dir).grep(/^\d{4}.*/)
504
+ drafts.sort
504
505
  end
505
506
 
506
507
  def change_view(view)
@@ -589,6 +590,9 @@ class RuneBlog
589
590
  .heredoc post.aslug
590
591
  #{aslug}
591
592
  .end
593
+ .heredoc post.date
594
+ #{date}
595
+ .end
592
596
  .heredoc title
593
597
  #{title.chomp}
594
598
  .end
@@ -653,10 +657,11 @@ class RuneBlog
653
657
  copy(pdraft/"guts.html", @theme/:post)
654
658
  copy(pdraft/"vars.lt3", @theme/:post)
655
659
  # Step 4...
656
- # FIXME dependencies?
657
660
  preprocess cwd: @theme/:post, src: "generate.lt3", force: true,
658
- dst: remote/ahtml, copy: @theme/:post,
661
+ dst: remote/ahtml, # copy: @theme/:post,
659
662
  call: ".nopara" # , debug: true
663
+ FileUtils.rm_f(remote/"published")
664
+ timelog("Generated", remote/"history")
660
665
  copy_widget_html(view_name)
661
666
  rescue => err
662
667
  _tmp_error(err)
@@ -664,7 +669,7 @@ class RuneBlog
664
669
 
665
670
  def _check_view?(view)
666
671
  flag = self.view?(view)
667
- puts " Warning: '#{view}' is not a view" unless flag
672
+ puts " Warning: '#{view}' is not a view" unless flag
668
673
  flag
669
674
  end
670
675
 
@@ -672,6 +677,9 @@ class RuneBlog
672
677
  log!(enter: __method__, args: [draft], level: 1)
673
678
  views = _get_views(draft)
674
679
  views.each {|view| _handle_post(draft, view) }
680
+ # For current view:
681
+ slug = File.basename(draft).sub(/.lt3$/, "")
682
+ postdir = self.view.dir/"remote/post/"/slug
675
683
  rescue => err
676
684
  _tmp_error(err)
677
685
  end
@@ -3,7 +3,7 @@ if !defined?(RuneBlog::Path)
3
3
  # if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
4
4
 
5
5
  class RuneBlog
6
- VERSION = "0.3.07"
6
+ VERSION = "0.3.08"
7
7
 
8
8
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
9
9
  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.07
4
+ version: 0.3.08
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-01-02 00:00:00.000000000 Z
11
+ date: 2020-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -89,6 +89,7 @@ files:
89
89
  - data/global.lt3
90
90
  - data/universal.lt3
91
91
  - empty_view/assets/austin-pano.jpg
92
+ - empty_view/assets/reddit-logo.png
92
93
  - empty_view/assets/sky2.jpg
93
94
  - empty_view/config/exper/2svg.lt3
94
95
  - empty_view/config/exper/gen_svg.rb
@@ -103,7 +104,6 @@ files:
103
104
  - empty_view/config/reddit/notes.txt
104
105
  - empty_view/config/reddit/reddit_post_url.py
105
106
  - empty_view/config/reddit/redpost.rb
106
- - empty_view/config/reddit/the-graffiti-wall.html
107
107
  - empty_view/config/twitter/credentials.txt
108
108
  - empty_view/config/twitter/tw.html
109
109
  - empty_view/config/twitter/tw.js
@@ -1,91 +0,0 @@
1
-
2
- <html>
3
- <!-- Generated from /Users/Hal/Dropbox/files/runeblog/.blogs/views/around_austin/themes/standard/global.lt3 on 2019-12-19; editing not recommended. -->
4
-
5
-
6
-
7
-
8
- <meta charset="utf-8">
9
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
10
- <title>
11
- Around Austin | The view from downtown...
12
- </title>
13
- <meta name="generator" content="Runeblog v 0.2.91">
14
- <meta property="og:title" content="The graffiti wall ">
15
- <meta property="og:locale" content="en_US">
16
- <meta property="description" content="RIP, Hope Gallery">
17
- <meta property="og:description" content="The view from downtown...">
18
- <link rel="canonical" href="http://SITE">
19
- <meta property="og:url" content="http://SITE">
20
- <meta property="og:site_name" content="Around Austin">
21
- <link type="application/atom+xml" rel="alternate" href="http://SITE/feed.xml" title="Around Austin">
22
- <link rel="shortcut icon" type="image/x-icon" href="etc/favicon.ico">
23
- <link rel="apple-touch-icon" href="etc/favicon.ico">
24
- <link rel="stylesheet" href="etc/blog.css">
25
- <body>
26
-
27
- <section class="post">
28
- <div class="recent-content">
29
- <table border=0 width=100%><tr>
30
- <td align=left valign=bottom><h2 class="recent-title">The graffiti wall</h2></td>
31
- <td align=right valign=top><font size=-5><br></font>December 2, 2019</td>
32
- </tr></table><hr>
33
- <!-- Post number 3 -->
34
-
35
-
36
- RIP, Hope Gallery
37
-
38
-
39
- <div class='mydrop'>I</div>
40
- <div style="padding-top: 1px">t's been a while since I was there. They say it was torn down
41
- while I wasn't looking. Never tagged anything there, of course, nor
42
- anywhere else. Spraypainting public places isn't my thing, but in this
43
- case I condoned it because it was sort of there for that purpose.
44
-
45
- <p>
46
- This fake entry is a long one so as to demonstrate both drop-caps
47
- (above) and an inset quote. Blah blah blah. Lorem ipsum dolor and
48
- a partridge in a pear tree.
49
-
50
- <p>
51
- </p>
52
- Wherever you go, there you are. Last night I saw upon the stair
53
- a little man who was not there. He wasn't there again today; I
54
- wish, I wish he'd go away. As far as we know, our computer has
55
- <div style='float:left; width: 20%; padding:8px; padding-right:12px'><b><i> On a clean disk, you can seek forever.</i></b></div>
56
- never had an undetected error.
57
- On a clean disk, you can seek forever.
58
- And never let it be denied that
59
- pobbles are happier without their toes. And may your snark never
60
- be a boojum. How do you know you aren't dreaming right now? When
61
- you see a butterfly, think of Chuang Tzu.
62
- <p>
63
- Contact light. Houston, this is Tranquility Base. The Eagle has
64
- landed. That's one small step for (a) man, one giant leap for
65
- mankind.
66
-
67
- <p>
68
- Here's the PDF of <a style='text-decoration: none' href='http://rubyhacker.com/blog2/rubydino.pdf'>"Ruby for the Old-Time C Programmer"</a>
69
-
70
- <p>
71
- Pity this busy monster, manunkind, not. Pity rather... Listen:
72
- There's a hell of a universe next door; let's go.
73
-
74
- <p>
75
- </div>
76
- </section>
77
-
78
- <br>
79
- <!-- <script src='https://redditjs.com/subreddit.js' data-subreddit='RubyElixirEtc' data-width=600></script> -->
80
- <!-- https://www.reddit.com/r/RubyElixirEtc/comments/ed48ra/post_this_is_only_a_test/ -->
81
-
82
- <hr>
83
- <table width=100%><tr>
84
- <td width=10%><a style="text-decoration: none" href="javascript:history.go(-1)">[Back]</a></td>
85
- <td width=10%><a style="text-decoration: none" href="http://SITE/VIEW_NAME/permalink/the-graffiti-wall.html"> [permalink] </a></td>
86
- <td width=80% align=right><font size=-3></font></td></tr></table>
87
- <hr>
88
- <script src='https://redditjs.com/post.js' data-url="ed48ra" data-width=800 ></script>
89
-
90
- </body>
91
- </html>