runeblog 0.2.27 → 0.2.32

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: 631b81f8592a8997e7d8c6fee1fc2f71a03e97e42d33e64e221e9971d08319ec
4
- data.tar.gz: 64b2c372f7d4f4c1d3cfa7fdd19c178087e0444f712773cb523e990ec220cf5b
3
+ metadata.gz: 1504fe8e39cd4ed6b42b0b6a9a8b1189d6a67b8b78c5e7a62031027f6ab10259
4
+ data.tar.gz: cfc166148ecf09d303e355fa2770b07f8affe79743fa5ad2d554f8d3411063d5
5
5
  SHA512:
6
- metadata.gz: a27f9f6fd7c8859bacfd7ad112918bfebd416e436b4852523b41f449311ae63cab5d085830947022f87fa1a3c2d70b639e0e5d672176e3fcdbc2ff461cc3effa
7
- data.tar.gz: 16eebca900c51bbadbb9ebaa14832b5a91375f726db789c50e9aad188be2f853859bc7dbf8a31798ec79735bae150eccf2a9cbf97c68cff5656af686acc26f26
6
+ metadata.gz: 9f3a7d4e429cd06e79bb213ed7fe79062117ba52d1a2238e55f2ed68ae88d23b0781190a7e27b7e3894650bbb1a79ebae33598f87ecd76368d4071fcd656296a
7
+ data.tar.gz: 4550b4d5f419d096b0ebf98574d7c6f8277bad4821730df88dbb8b404132f13fcf5bccb6b56e3cb7430c1ca19fe6c5562b6285470d6674f3c8bd7c65370d3ff3
Binary file
@@ -37,6 +37,27 @@ def backlink
37
37
  _out %[<br><a href="javascript:history.go(-1)">[Back]</a>]
38
38
  end
39
39
 
40
+ def dropcap
41
+ # Bad form: adds another HEAD
42
+ _out <<-HTML
43
+ <head>
44
+ <style>
45
+ p:first-child:first-letter {
46
+ color: #0000ff;
47
+ float: left;
48
+ font-family: Georgia;
49
+ font-size: 75px;
50
+ line-height: 60px;
51
+ padding-top: 4px;
52
+ padding-right: 8px;
53
+ padding-left: 3px;
54
+ }
55
+ </style>
56
+ </head>
57
+ HTML
58
+ _out " "
59
+ end
60
+
40
61
  def quote
41
62
  _passthru "<blockquote>"
42
63
  _passthru _body
@@ -292,7 +313,7 @@ end
292
313
  def recent_posts # side-effect
293
314
  _out <<-HTML
294
315
  <div class="col-lg-9 col-md-9 col-sm-9 col-xs-12">
295
- <iframe id="main" style="width: 100vw; height: 100vh; position: relative;"
316
+ <iframe id="main" style="width: 70vw; height: 100vh; position: relative;"
296
317
  src='recent.html' width=100% frameborder="0" allowfullscreen>
297
318
  </iframe>
298
319
  </div>
@@ -542,24 +563,17 @@ def _write_card(cardfile, mainfile, pairs, card_title, tag, relative: true)
542
563
  local = _local_tag?(tag)
543
564
  pairs.each do |file, title|
544
565
  url = file
545
- yesno = "yes"
546
- yesno, title = title.split(/, */) if title =~ /^[yes|no]/ # FIXME please!
547
-
548
- case [yesno, local]
549
- when ["yes", false] # can iframe, remote file
550
- url_ref = "href='#{file}'"
551
- when ["yes", true] # can iframe, local file
552
- url_ref = _widget_card(file, tag)
553
- when ["no", false] # CAN'T iframe, remote file
554
- url_ref = _blank(file)
555
- when ["no", true] # CAN'T iframe, local file (possible?)
556
- url_ref = _blank(file)
566
+ type, title = page_type(tag, title)
567
+ case type
568
+ when :local; url_ref = _widget_main(file, tag) # local always frameable
569
+ when :frame; url_ref = _main(file) # remote, frameable
570
+ when :noframe; url_ref = _blank(file) # remote, not frameable
557
571
  end
558
-
559
572
  anchor = %[<a #{url_ref}>#{title}</a>]
560
573
  wrapper = %[<li class="list-group-item">#{anchor}</li>]
561
574
  f.puts wrapper
562
575
  end
576
+ _include_file cardfile+".html"
563
577
  f.puts <<-EOS
564
578
  </div>
565
579
  </div>
@@ -579,6 +593,20 @@ def _local_tag?(tag)
579
593
  end
580
594
  end
581
595
 
596
+ def page_type(tag, title)
597
+ yesno = "yes"
598
+ yesno, title = title.split(/, */) if title =~ /^[yes|no]/
599
+ local = _local_tag?(tag)
600
+ frameable = (yesno == "yes")
601
+ if local
602
+ return [:local, title]
603
+ elsif frameable
604
+ return [:frame, title]
605
+ else
606
+ return [:noframe, title]
607
+ end
608
+ end
609
+
582
610
  def _write_main(mainfile, pairs, card_title, tag)
583
611
  log!(str: "Creating #{mainfile}.html", pwd: true)
584
612
  local = _local_tag?(tag)
@@ -586,17 +614,12 @@ def _write_main(mainfile, pairs, card_title, tag)
586
614
  _html_body(f) do
587
615
  f.puts "<h1>#{card_title}</h1>"
588
616
  pairs.each do |file, title|
589
- yesno = "yes"
590
- yesno, title = title.split(/, */) if title =~ /^[yes|no]/ # FIXME please!
591
- case [yesno, local]
592
- when ["yes", false] # can iframe, remote file
593
- url_ref = "href='#{file}'"
594
- when ["yes", true] # can iframe, local file
595
- url_ref = _widget_main(file, tag)
596
- when ["no", false] # CAN'T iframe, remote file
597
- url_ref = _blank(file)
598
- when ["no", true] # CAN'T iframe, local file (possible?)
599
- url_ref = _blank(file)
617
+ type, title = page_type(tag, title)
618
+ title = title.gsub(/\\/, "") # kludge
619
+ case type
620
+ when :local; url_ref = _widget_main(file, tag) # local always frameable
621
+ when :frame; url_ref = "href = '#{file}'" # local always frameable
622
+ when :noframe; url_ref = _blank(file) # local always frameable
600
623
  end
601
624
  css = "color: #8888FF; text-decoration: none; font-size: 24px; font-family: verdana"
602
625
  f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
@@ -63,8 +63,8 @@ class RuneBlog::Post
63
63
  end
64
64
 
65
65
  def self.create(title:, teaser:, body:, pubdate: Time.now.strftime("%Y-%m-%d"),
66
- other_views:[])
67
- log!(enter: __method__, args: [title, teaser, body, pubdate, other_views])
66
+ views:[])
67
+ log!(enter: __method__, args: [title, teaser, body, pubdate, views])
68
68
  post = self.new
69
69
  # NOTE: This is the ONLY place next_sequence is called!
70
70
  num = post.meta.num = post.blog.next_sequence
@@ -72,7 +72,8 @@ class RuneBlog::Post
72
72
  # new_metadata
73
73
  post.meta.title, post.meta.teaser, post.meta.body, post.meta.pubdate =
74
74
  title, teaser, body, pubdate
75
- post.meta.views = [post.blog.view.to_s] + other_views
75
+ post.meta.views = [post.blog.view.to_s] + views
76
+ # STDERR.puts "Post.create: views = #{views.inspect}"
76
77
  post.meta.tags = []
77
78
  post.blog.make_slug(post.meta) # adds to meta
78
79
 
@@ -39,7 +39,7 @@ class RuneBlog::Publishing
39
39
  def url
40
40
  log!(enter: __method__)
41
41
  vname = @blog.view.name # .gsub(/_/, "\\_")
42
- url = "#@proto://#@server/#@path/#{vname}"
42
+ url = "#@proto://#@server/#@path" # /#{vname}"
43
43
  end
44
44
 
45
45
  def system!(str)
@@ -52,11 +52,11 @@ class RuneBlog::Publishing
52
52
  log!(enter: __method__, args: [files, assets])
53
53
  dir = @docroot/@path
54
54
  view_name = @blog.view.name
55
- viewpath = dir/view_name
55
+ viewpath = dir # /view_name
56
56
  # result = system!("ssh #@user@#@server -x mkdir -p #{viewpath}")
57
57
  result = system!("ssh #@user@#@server -x mkdir -p #{viewpath}/assets")
58
58
  files.each do |file|
59
- dest = "#@user@#@server:" + dir/view_name
59
+ dest = "#@user@#@server:" + dir # /view_name
60
60
  file.gsub!(/\/\//, "/") # weird... :-/
61
61
  cmd = "scp -r #{file} #{dest} >/dev/null 2>/tmp/wtf"
62
62
  debug "cmd = #{cmd.inspect} - see /tmp/wtf"
@@ -91,26 +91,18 @@ module RuneBlog::REPL
91
91
 
92
92
  def cmd_publish(arg, testing = false)
93
93
  # Future Hal says please refactor this
94
- STDERR.puts :CP1
95
94
  puts unless testing
96
- STDERR.puts :CP2
97
95
  reset_output
98
- STDERR.puts :CP3
99
96
  check_empty(arg)
100
- STDERR.puts :CP4
101
97
  unless @blog.view.can_publish?
102
- STDERR.puts :CP5
103
98
  msg = "Can't publish... see globals.lt3"
104
99
  puts msg unless testing
105
100
  output! msg
106
101
  return @out
107
102
  end
108
103
 
109
- STDERR.puts :CP6
110
104
  # Need to check dirty/clean status first
111
105
  dirty, all, assets = @blog.view.publishable_files
112
- STDERR.puts [dirty, all, assets].inspect
113
- sleep 8
114
106
  files = dirty
115
107
  if dirty.empty?
116
108
  puts fx("\n No files are out of date." + " "*20, :bold)
@@ -118,7 +118,7 @@ class RuneBlog
118
118
  result = nil # not found
119
119
  when 1
120
120
  front = "#{key}: "
121
- n = front.size + 1
121
+ n = front.size
122
122
  str = lines.first.chomp[n..-1]
123
123
  case key
124
124
  when "views", "tags" # plurals
@@ -297,7 +297,7 @@ class RuneBlog
297
297
  id = slug.to_i
298
298
  text = nil
299
299
  post_entry_name = @theme/"blog/post_entry.lt3"
300
- xlate src: post_entry_name, dst: "/tmp/post_entry.html", debug: true
300
+ xlate src: post_entry_name, dst: "/tmp/post_entry.html" # , debug: true
301
301
  @_post_entry ||= File.read("/tmp/post_entry.html")
302
302
  vp = post_lookup(id)
303
303
  nslug, aslug, title, date, teaser_text =
@@ -336,12 +336,12 @@ class RuneBlog
336
336
  File.write(@vdir/:remote/file, text)
337
337
  end
338
338
 
339
- def create_new_post(title, testing = false, teaser: nil, body: nil, other_views: [])
340
- log!(enter: __method__, args: [title, testing, teaser, body, other_views])
339
+ def create_new_post(title, testing = false, teaser: nil, body: nil, views: [])
340
+ log!(enter: __method__, args: [title, testing, teaser, body, views])
341
341
  meta = nil
342
- STDERR.puts other_views.inspect
342
+ views = views + [self.view.to_s]
343
343
  Dir.chdir(@root/:posts) do
344
- post = Post.create(title: title, teaser: teaser, body: body, other_views: other_views)
344
+ post = Post.create(title: title, teaser: teaser, body: body, views: views)
345
345
  post.edit unless testing
346
346
  post.build
347
347
  meta = post.meta
@@ -401,6 +401,8 @@ STDERR.puts other_views.inspect
401
401
  src: "blog.css.lt3", copy: vdir/"remote/etc/blog.css" # , debug: true
402
402
  xlate cwd: vdir/"themes/standard",
403
403
  src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
404
+ copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
405
+
404
406
  end
405
407
 
406
408
  def _get_views(draft)
@@ -2,7 +2,7 @@
2
2
  if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
3
3
 
4
4
  class RuneBlog
5
- VERSION = "0.2.27"
5
+ VERSION = "0.2.32"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
@@ -41,7 +41,8 @@ class RuneBlog::View
41
41
  vdir = dir()
42
42
  remote = local_index()
43
43
  files = [remote]
44
- others = Dir.entries(vdir + "/remote").map {|x| "#{vdir}/remote/#{x}" }
44
+ others = Dir.entries(vdir/:remote) - %w[. ..]
45
+ others.map! {|x| "#{vdir}/remote/#{x}" }
45
46
 
46
47
  assets = Dir.entries("#{vdir}/assets") - %w[. ..]
47
48
  assets.map! {|x| "#{vdir}/assets/#{x}" }
@@ -29,7 +29,7 @@ end
29
29
 
30
30
  def make_post(x, title, teaser, body, views=[])
31
31
  debug " make_post #{bold(title)}"
32
- x.create_new_post(title, true, teaser: teaser, body: body, other_views: views)
32
+ x.create_new_post(title, true, teaser: teaser, body: body, views: views)
33
33
  views.each do |view|
34
34
  debug
35
35
  debug "** generate_index #{bold(view)}"
@@ -46,7 +46,7 @@ end
46
46
 
47
47
  # "Main"...
48
48
 
49
- puts Time.now
49
+ puts bold("\nGenerating test blog...")
50
50
 
51
51
  system("rm -rf .blogs")
52
52
  RuneBlog.create_new_blog_repo(".blogs")
@@ -116,8 +116,32 @@ x.change_view("around_austin")
116
116
  make_post(x, "The graffiti wall", <<-EXCERPT, <<-BODY)
117
117
  RIP, Hope Gallery
118
118
  EXCERPT
119
+ .dropcap
120
+
119
121
  It's been a while since I was there. They say it was torn down
120
122
  while I wasn't looking.
123
+
124
+ This fake entry is a long one so as to demonstrate both drop-caps
125
+ (above) and an inset quote. Blah blah blah. Lorem ipsum dolor and
126
+ a partridge in a pear tree.
127
+
128
+ Wherever you go, there you are. Last night I saw upon the stair
129
+ a little man who was not there. He wasn't there again today; I
130
+ wish, I wish he'd go away.
131
+
132
+ As far as we know, our computer has never had an undetected error.
133
+ And never let it be denied that pobbles are happier without their
134
+ toes. And may your snark never be a boojum.
135
+
136
+ Contact light. Houston, this is Tranquility Base. The Eagle has
137
+ landed. That's one small step for (a) man, one giant leap for
138
+ mankind.
139
+ .inset left 20
140
+ On a clean disk, you can seek forever.
141
+ .end
142
+
143
+ Pity this busy monster, manunkind, not. Pity rather... Listen:
144
+ There's a hell of a universe next door; let's go.
121
145
  BODY
122
146
 
123
147
  make_post(x, "The Waller Creek project", <<-EXCERPT, <<-BODY)
@@ -145,5 +169,7 @@ BODY
145
169
  debug
146
170
  debug("** generate_view: #{bold('around_austin')}")
147
171
  x.generate_view("around_austin")
172
+ x.change_view("around_austin")
173
+
174
+ puts bold("...finished.\n")
148
175
 
149
- debug
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.2.27
4
+ version: 0.2.32
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-10-11 00:00:00.000000000 Z
11
+ date: 2019-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext