runeblog 0.2.46 → 0.2.51

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: c764956fc67556826d90815f706b69523817eaee26cf7ec32671794a65e15538
4
- data.tar.gz: 3fb1d9bcc3ae3802891378568b4ef729ceb757ace7b4a4efdee7aa3d8ba775d2
3
+ metadata.gz: 600dac0389d976fd41b8c3a5f4f63e4896a1b3f330525faa6b703dfb38e0b825
4
+ data.tar.gz: 52472d46f783f209ad13e95f8e230c89173780a98867389a075833fb3cb1edd9
5
5
  SHA512:
6
- metadata.gz: f52c5f8975373cb2544126e3e7245bc37cf7e3c16a2417cdfb29a002f07e369ad0c8a50018b85665a8a20a21632af3094c9e41fa63f8065ca319acef1480322e
7
- data.tar.gz: 693309103d55a20a48984da73ecdf4c2544e9b950ea504ec54e895ab1bc68560cfad30eede26f8b30c622d9d47cd773f8424d05cf8fcca5dc6440f929420febe
6
+ metadata.gz: 9a650511f857069328ec4295e4ab1c70add5730118b68c16d45113844215f8db540bad78580225228b24ae4b26022abda6ab1e5af487edc231360d1a1c50fbda
7
+ data.tar.gz: 641d6ae9269a77d36929f36810ff779736cee66e81e0bb27660f8e7832f2f6ecce57977362a2128585789365d503a4f79b03580674293bf7a8575facadc296ac
data/bin/blog CHANGED
@@ -23,7 +23,8 @@ TEXT
23
23
  end
24
24
 
25
25
  def mainloop
26
- print fx("#{@blog.view}> ", Red, :bold)
26
+ info = @blog.view || "no view"
27
+ print fx("[#{info}] ", Red, :bold)
27
28
  cmd = STDSCR.gets(history: @cmdhist, tab: @tabcom)
28
29
  cmd_quit(nil) if cmd.nil? # ^D
29
30
  cmd.chomp!
@@ -72,7 +73,7 @@ puts fx("\n RuneBlog", :bold), fx(" v #{RuneBlog::VERSION}\n", Red)
72
73
 
73
74
  loop { mainloop }
74
75
 
75
- # sleep 0.2
76
- # system("tput clear")
76
+ system("tput clear")
77
+ sleep 0.2
77
78
  puts
78
79
 
@@ -0,0 +1,18 @@
1
+ . --------------------------------------------------
2
+ . This is a sample file typical of page referenced
3
+ . directly from the navigation bar.
4
+ . It is like a special case of a page in the "pages"
5
+ . widget.
6
+ . --------------------------------------------------
7
+
8
+ .set this.title="About me"
9
+ . make this better later
10
+ <html><body>
11
+ <div class="content container-fluid mt-4">
12
+ <div class="row">
13
+ <h1>$this.title</h1>
14
+ . content starts here...
15
+ Blah blah blah...
16
+ </div>
17
+ </div>
18
+ </body></html>
@@ -0,0 +1,18 @@
1
+ . --------------------------------------------------
2
+ . This is a sample file typical of page referenced
3
+ . directly from the navigation bar.
4
+ . It is like a special case of a page in the "pages"
5
+ . widget.
6
+ . --------------------------------------------------
7
+
8
+ .set this.title="Contact"
9
+ . make this better later
10
+ <html><body>
11
+ <div class="content container-fluid mt-4">
12
+ <div class="row">
13
+ <h1>$this.title</h1>
14
+ . content starts here...
15
+ How to contact me by email, smoke signals, ICBM, seance, ...
16
+ </div>
17
+ </div>
18
+ </body></html>
@@ -0,0 +1 @@
1
+ .include ../widgets/pages/faq.lt3
@@ -0,0 +1,17 @@
1
+ . --------------------------------------------------
2
+ . This defines the content of the navigation bar.
3
+ . The first one is a special case.
4
+ . The others are understood to refer to .lt3 files
5
+ . such as navbar/about.lt3 (which is processed into
6
+ . HTML).
7
+ . The title may be more than one word. Quotes are
8
+ . not needed.
9
+ . --------------------------------------------------
10
+
11
+ .navbar2
12
+ index Home
13
+ about About
14
+ contact Contact
15
+ faq FAQ
16
+ .end
17
+
@@ -14,16 +14,18 @@
14
14
  .include blog/head.lt3
15
15
  <body>
16
16
 
17
+ .set color = #101035
18
+
17
19
  . FIXME
18
- <table width=100%>
20
+ <table width=100% bgcolor=$color>
19
21
  <tr>
20
- <td width=30% bgcolor=black>
22
+ <td width=30% bgcolor=$color>
21
23
  <div style="text-align: center; color: white">
22
24
  <h1>Around Austin</h1><br>
23
25
  The view from downtown...
24
26
  </div>
25
27
  </td>
26
- <td><img src=assets/sky2.jpg width=100%></img>
28
+ <td><img src=assets/austin-pano.jpg width=100%></img>
27
29
  </tr>
28
30
  </table>
29
31
 
@@ -2,13 +2,14 @@
2
2
  . This HTML fragment gives the format of a post's
3
3
  . "index" entry (recent posts on blog front page).
4
4
  . --------------------------------------------------
5
+ .nopara
5
6
 
6
7
  <div class="post">
7
8
  <table width=100% cellpadding=7>
8
9
  <tr>
9
10
  <td width=14% valign=top align=right style="margin-top: -1px;">
10
11
  <!-- <span class="post-date mt-1 mb-1" style="margin-top: 3px; text-align: right"> -->
11
- <font size=-1><b>#{date}</b></font>
12
+ <font size=-1>#{date}</font>
12
13
  <!-- </span> -->
13
14
  </td>
14
15
  <td>
@@ -21,3 +22,5 @@
21
22
  </tr>
22
23
  </table>
23
24
  </div>
25
+
26
+ <font size=-4><br></font>
@@ -8,7 +8,7 @@
8
8
  . not needed.
9
9
  . --------------------------------------------------
10
10
 
11
- .navbar
11
+ .navbar2
12
12
  index Home
13
13
  about About
14
14
  contact Contact
@@ -1,9 +1,40 @@
1
1
  .mixin liveblog
2
2
 
3
+ <html>
4
+ <head>
5
+
6
+ <style>
7
+ * { font-family: verdana }
8
+ </style>
9
+
10
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
11
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"></link>
12
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap-theme.min.css"></link>
13
+ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
14
+
15
+ </head>
16
+
17
+ <body>
18
+
3
19
  <h2>Frequently Asked Questions</h2>
4
20
 
5
- This is
6
- just a
7
- FAAAAAQ....
21
+ .faq Are you a rabbit?
22
+ Yes, I am.
23
+ .end
24
+
25
+ .faq Are you a frog?
26
+ Don't be stupid. I just told you I was a rabbit.
27
+ .end
28
+
29
+ .faq Why do you answer a question with a question?
30
+ *Do I in fact answer a question with a question?
31
+ .end
32
+
33
+ .faq Are you serious?
34
+ No, I'm a rabbit.
35
+ .end
8
36
 
9
37
  .backlink
38
+
39
+ </body>
40
+ </html>
@@ -30,48 +30,22 @@ def make_exception(sym, str)
30
30
  end
31
31
  end
32
32
 
33
- def system!(str, show: false)
34
- log!(enter: __method__, args: [str], level: 2)
35
- STDERR.puts str if show
36
- rc = system(str)
37
- if rc
38
- return rc
39
- else
40
- STDERR.puts "FAILED: #{str.inspect}"
41
- STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
42
- return rc
43
- end
44
- rc
45
- end
33
+ def system!(str, show: false)
34
+ log!(enter: __method__, args: [str], level: 2)
35
+ STDERR.puts str if show
36
+ rc = system(str)
37
+ if rc
38
+ return rc
39
+ else
40
+ STDERR.puts "FAILED: #{str.inspect}"
41
+ STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
42
+ return rc
43
+ end
44
+ rc
45
+ end
46
46
 
47
47
  def prefix(num)
48
48
  log!(enter: __method__, args: [num], level: 3)
49
49
  "#{'%04d' % num.to_i}"
50
50
  end
51
51
 
52
- def check_meta(meta, where = "")
53
- log!(enter: __method__, args: [meta, where], level: 3)
54
- str = "--- #{where}\n"
55
- str << "\ncheck_meta: \n" + caller.join("\n") + "\n meta = #{meta.inspect}\n"
56
- str << " title missing!\n" unless meta.title
57
- str << " title missing! (empty)" if meta.title && meta.title.empty?
58
- str << " num missing!\n" unless meta.num
59
- if str =~ /missing!/
60
- debug str
61
- raise str
62
- end
63
- end
64
-
65
- def verify(hash)
66
- log!(enter: __method__, args: [hash], level: 3)
67
- hash.each_pair do |expr, msg|
68
- puts "<< #{msg}" unless expr
69
- end
70
- end
71
-
72
- def assure(hash) # really the same as verify for now...
73
- log!(enter: __method__, args: [hash], level: 3)
74
- hash.each_pair do |expr, msg|
75
- puts "<< #{msg}" unless expr
76
- end
77
- end
@@ -19,22 +19,6 @@ module RuneBlog::Helpers
19
19
  puts " Failed: #{cmd} - from #{caller[0]}" unless rc
20
20
  end
21
21
 
22
- # def get_root
23
- # log!(enter: __method__)
24
- # if $_blog
25
- # if $_blog.root
26
- # puts "0. Returned: #{$_blog.root}/"
27
- # return $_blog.root + "/"
28
- # else
29
- # puts "1. Returned: ./"
30
- # return "./"
31
- # end
32
- # else
33
- # puts "2. Returned: ./"
34
- # return "./"
35
- # end
36
- # end
37
-
38
22
  def read_config(file, *syms)
39
23
  log!(enter: __method__, args: [file, *syms], level: 3)
40
24
  lines = File.readlines(file).map(&:chomp)
@@ -67,18 +51,6 @@ module RuneBlog::Helpers
67
51
  vals
68
52
  end
69
53
 
70
- # def put_config(root:, view:"test_view", editor: "/usr/local/bin/vim")
71
- # log!(enter: __method__, args: [root, view, editor])
72
- # Dir.mkdir(root) unless Dir.exist?(root)
73
- # Dir.chdir(root) do
74
- # File.open("config", "w") do |cfg|
75
- # cfg.puts "root: #{root}"
76
- # cfg.puts "current_view: #{view}"
77
- # cfg.puts "editor: #{editor}"
78
- # end
79
- # end
80
- # end
81
-
82
54
  def write_config(obj, file)
83
55
  log!(enter: __method__, args: [obj, file], level: 2)
84
56
  hash = obj.to_h
@@ -155,7 +127,6 @@ module RuneBlog::Helpers
155
127
  log!(enter: __method__, args: [obj, name], level: 3)
156
128
  File.write(name, obj)
157
129
  end
158
-
159
130
  end
160
131
 
161
132
  def dump(obj, name) # FIXME scope
@@ -30,6 +30,7 @@ module RuneBlog::REPL
30
30
  "cv" => :cmd_change_view, # 0-arity must come second
31
31
 
32
32
  "config" => :cmd_config,
33
+ "manage $widget" => :cmd_manage,
33
34
 
34
35
  "list posts" => :cmd_list_posts,
35
36
  "lsp" => :cmd_list_posts,
@@ -1,6 +1,7 @@
1
1
  require 'ostruct'
2
2
  require 'pp'
3
3
  require 'date'
4
+ require 'find'
4
5
 
5
6
  require 'runeblog'
6
7
  require 'pathmagic'
@@ -64,13 +65,64 @@ def post_trailer
64
65
  # damned syntax highlighting
65
66
  end
66
67
 
68
+ def faq
69
+ @faq_count ||= 0
70
+ _out "<br>" if @faq_count == 0
71
+ @faq_count += 1
72
+ ques = _data.chomp
73
+ ans = _body_text
74
+ id = "faq#@faq_count"
75
+ # _out %[&nbsp;<a class="btn btn-default btn-xs" data-toggle="collapse" href="##{id}" role="button" aria-expanded="false" aria-controls="collapseExample">+</a>]
76
+ _out %[&nbsp;<a data-toggle="collapse" href="##{id}" role="button" aria-expanded="false" aria-controls="collapseExample"><font size=+3>&#8964;</font></a>]
77
+ _out %[&nbsp;<b>#{ques}</b>]
78
+ # _out "<font size=-2><br></font>" if @faq_count == 1
79
+ # _out "<br>" unless @faq_count == 1
80
+ _out %[<div class="collapse" id="#{id}"><br><font size=+1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#{ans}</font></div>\n]
81
+ _out "<br>" unless @faq_count == 1
82
+ _optional_blank_line
83
+ end
84
+
67
85
  def backlink
68
86
  _out %[<br><a href="javascript:history.go(-1)">[Back]</a>]
69
87
  end
70
88
 
89
+ def banner # still experimental
90
+ _out "<table>"
91
+ _body do |line|
92
+ pieces = line.split
93
+ cols = pieces.size
94
+ span = cols == 2 ? 1 : 2 # whaaat?
95
+ _out " <tr>"
96
+ pieces.each do |piece|
97
+ _out " <td colspan=#{span}>"
98
+ case
99
+ when piece.start_with?("hnav")
100
+ # horizontal navbar
101
+ # _out "<center>hnav1 hnav2 hnav3 hnav4</center>"
102
+ when piece.start_with?("vnav")
103
+ # vertical navbar
104
+ # _out "vnav1<br>vnav2<br>vnav3<br>vnav4<br>"
105
+ when piece.start_with?("text")
106
+ file = piece.split(":")[1]
107
+ file ||= "banner/text.html"
108
+ _out File.read(file)
109
+ when piece.start_with?("image")
110
+ image = piece.split(":")[1]
111
+ image ||= "banner/banner.jpg"
112
+ _out " <img src=#{image} height=100></img>"
113
+ else
114
+ _out " '#{piece}' isn't known"
115
+ end
116
+ _out " </td>"
117
+ end
118
+ _out " </tr>"
119
+ end
120
+ _out "</table>"
121
+ end
122
+
71
123
  def quote
72
124
  _passthru "<blockquote>"
73
- _passthru _body
125
+ _passthru _body.join(" ")
74
126
  _passthru "</blockquote>"
75
127
  _optional_blank_line
76
128
  end
@@ -219,6 +271,18 @@ def pin
219
271
  _debug "data = #{_args}"
220
272
  # verify only already-specified views?
221
273
  @meta.pinned = _args.dup
274
+ dir = @blog.view.dir/"themes/standard/widgets/pinned/"
275
+ datafile = dir/"list.data"
276
+ pins = File.readlines(datafile) rescue []
277
+ damn = File.new("/tmp/dammit", "w")
278
+ pins << "#{@meta.num} #{@meta.title}\n"
279
+ damn.puts pins
280
+ pins.uniq!
281
+ damn.puts pins
282
+ damn.close
283
+ File.open(datafile, "w") do
284
+ pins.each {|pin| File.puts pin }
285
+ end
222
286
  _optional_blank_line
223
287
  end
224
288
 
@@ -364,8 +428,8 @@ def _load_local(widget)
364
428
  code
365
429
  end
366
430
  rescue => err
367
- STDOUT.puts err
368
- STDOUT.puts err.backtrace.join("\n")
431
+ STDERR.puts err.to_s
432
+ STDERR.puts err.backtrace.join("\n")
369
433
  exit
370
434
  end
371
435
 
@@ -402,7 +466,12 @@ def sidebar
402
466
  end
403
467
  end
404
468
 
405
- xlate cwd: wtag, src: tag, dst: tcard # , debug: (tag == "ad")
469
+ depend = %w[card.css main.css custom.rb local.rb]
470
+ depend += ["#{wtag}.lt3", "#{wtag}.rb"]
471
+ depend += %w[pieces/card-head.lt3 pieces/card-tail.lt3]
472
+ depend += %w[pieces/main-head.lt3 pieces/main-tail.lt3]
473
+ depend.map! {|x| @blog.view.dir/"themes/standard/widgets"/wtag/x }
474
+ xlate cwd: wtag, src: tag, dst: tcard, force: true, deps: depend , debug: (tag == "ad")
406
475
  _include_file wtag/tcard
407
476
  end
408
477
  _out %[</div>]
@@ -412,6 +481,26 @@ rescue => err
412
481
  exit
413
482
  end
414
483
 
484
+ =begin
485
+ ets/widgets/pages//card.css
486
+ ets/widgets/pages//custom.rb
487
+ ets/widgets/pages//disclaim.lt3
488
+ ets/widgets/pages//faq.lt3
489
+ ets/widgets/pages//like-dislike.lt3
490
+ ets/widgets/pages//list.data
491
+ ets/widgets/pages//local-vars.lt3
492
+ ets/widgets/pages//local.rb
493
+ ets/widgets/pages//main.css
494
+ ets/widgets/pages//other-stuff.lt3
495
+ ets/widgets/pages//pages.lt3
496
+ ets/widgets/pages//pages.rb
497
+ ets/widgets/pages//pieces
498
+ ets/widgets/pages//pieces/card-head.lt3
499
+ ets/widgets/pages//pieces/card-tail.lt3
500
+ ets/widgets/pages//pieces/main-head.lt3
501
+ ets/widgets/pages//pieces/main-tail.lt3
502
+ =end
503
+
415
504
  def stylesheet
416
505
  lines = _body
417
506
  url = lines[0]
@@ -480,10 +569,16 @@ class Livetext::Functions
480
569
  ::Livetext::Vars[name] || "[:#{name} is undefined]"
481
570
  end
482
571
 
483
- def link
484
- file, cdata = self.class.param.split("||", 2)
485
- %[<link type="application/atom+xml" rel="alternate" href="#{_var(:host)}#{file}" title="#{_var(:title)}">]
486
- end
572
+ # def link(param = nil)
573
+ # puts "--- WTF?? param = #{param.inspect}"; gets
574
+ # file, cdata = param.split("||", 2)
575
+ # %[<a href="assets/#{file}">#{cdata}</a>]
576
+ # end
577
+ #
578
+ # def link(param = nil)
579
+ # file, cdata = param.split("||", 2)
580
+ # %[<link type="application/atom+xml" rel="alternate" href="#{_var(:host)}#{file}" title="#{_var(:title)}">]
581
+ # end
487
582
  end
488
583
 
489
584
  ###
@@ -550,6 +645,42 @@ def tag_cloud
550
645
  _out close
551
646
  end
552
647
 
648
+ def vnavbar
649
+ end
650
+
651
+ def navbar2
652
+ vdir = @blog.view.dir
653
+ title = _var(:blog)
654
+
655
+ open = <<-HTML
656
+ <nav class="navbar navbar-light bg-light">
657
+ <a class="navbar-brand" href="index.html">#{title}</a>
658
+ <ul class="navbar-nav mr-auto">
659
+ HTML
660
+ close = <<-HTML
661
+ </ul>
662
+ </div>
663
+ </nav>
664
+ HTML
665
+
666
+ first = true
667
+ _out open
668
+ lines = _body
669
+ lines.each do |line|
670
+ basename, cdata = line.chomp.strip.split(" ", 2)
671
+ full = :navbar/basename+".html"
672
+ href_main = _main(full)
673
+ if first
674
+ first = false # hardcode this part??
675
+ _out %[<li class="nav-item active"> <a class="nav-link" href="index.html">#{cdata}<span class="sr-only">(current)</span></a> </li>]
676
+ else
677
+ xlate cwd: "navbar", src: basename, dst: vdir/"remote/navbar"/basename+".html" # , debug: true
678
+ _out %[<li class="nav-item"> <a class="nav-link" #{href_main}>#{cdata}</a> </li>]
679
+ end
680
+ end
681
+ _out close
682
+ end
683
+
553
684
  def navbar
554
685
  vdir = @blog.view.dir
555
686
  title = _var(:blog)
@@ -587,7 +718,8 @@ def navbar
587
718
  first = false # hardcode this part??
588
719
  _out %[<li class="nav-item active"> <a class="nav-link" href="index.html">#{cdata}<span class="sr-only">(current)</span></a> </li>]
589
720
  else
590
- xlate cwd: "navbar", src: basename, dst: vdir/"remote/navbar"/basename+".html" # , debug: true
721
+ depend = Find.find(@blog.root/:views/@blog.view.to_s/"themes/standard/navbar/").to_a
722
+ xlate cwd: "navbar", src: basename, dst: vdir/"remote/navbar"/basename+".html", deps: depend # , debug: true
591
723
  _out %[<li class="nav-item"> <a class="nav-link" #{href_main}>#{cdata}</a> </li>]
592
724
  end
593
725
  end
@@ -747,7 +879,7 @@ end
747
879
 
748
880
  def _write_metadata
749
881
  File.write("teaser.txt", @meta.teaser)
750
- fields = [:num, :title, :date, :pubdate, :views, :tags]
882
+ fields = [:num, :title, :date, :pubdate, :views, :tags, :pinned]
751
883
  fname2 = "metadata.txt"
752
884
  f2 = File.open(fname2, "w") do |f2|
753
885
  fields.each {|fld| f2.puts "#{fld}: #{@meta.send(fld)}" }