runeblog 0.2.48 → 0.2.50

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: d4bd7b67f736b85651eb0650c5af974cbcf74fce48be345920e9bac4c9dba9dd
4
- data.tar.gz: 5fda0c05a32e16103e7f7f31b7ffe104c307b63c2e14e96216644dfbc6fdefff
3
+ metadata.gz: 420d1360e5f860c1396eb2ba36a804c999b18d25da0b7157d577280d0cb2d42b
4
+ data.tar.gz: 65c66113d384de0e752b1abc5a2c9b68074319958f4a7762b8e00781b8a46c91
5
5
  SHA512:
6
- metadata.gz: 55b9141f9b2d0d7a06cb5134d1e1da871cd78c2dffa7502310d0ae0caedec7c27eabfa28dc7957754f611122283abc2bc833512e58f9414a541b87d8cf4e146f
7
- data.tar.gz: 60b1546750066d75a623a3ca7866b5f5307b31e14a806a85f726fe87507ab1c3d24c5ce7737742ffdb3e41fb7cbcb0eac244089c9f96efddc6534299e9ab9ef1
6
+ metadata.gz: d4a17c66ba757ea6b350d13a9a777e637157065392bfb7096e7c3de302b36c24e7d875ea8ad7cc8143fc384025dc590d5c8e03047b8b6c6477d4a2a967881c43
7
+ data.tar.gz: ce5188e490205aca014c158fe5f5202664c7d6ac9821c1408c761e2a3185d2c74eec38e9c2c0c98407f7f8e02591d2b1290a07bcc8909aa2dab22d2b65ff5f8a
@@ -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
+
@@ -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,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,
@@ -64,10 +64,57 @@ def post_trailer
64
64
  # damned syntax highlighting
65
65
  end
66
66
 
67
+ def faq
68
+ @faq_count ||= 0
69
+ _out "<br>" if @faq_count == 0
70
+ @faq_count += 1
71
+ ques = _data.chomp
72
+ ans = _body_text
73
+ id = "faq#@faq_count"
74
+ # _out %[&nbsp;<a class="btn btn-default btn-xs" data-toggle="collapse" href="##{id}" role="button" aria-expanded="false" aria-controls="collapseExample">+</a>]
75
+ _out %[&nbsp;<a data-toggle="collapse" href="##{id}" role="button" aria-expanded="false" aria-controls="collapseExample"><font size=+3>&#8964;</font></a>]
76
+ _out %[&nbsp;<b>#{ques}</b>]
77
+ # _out "<font size=-2><br></font>" if @faq_count == 1
78
+ # _out "<br>" unless @faq_count == 1
79
+ _out %[<div class="collapse" id="#{id}"><br><font size=+1>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#{ans}</font></div>\n]
80
+ _out "<br>" unless @faq_count == 1
81
+ _optional_blank_line
82
+ end
83
+
67
84
  def backlink
68
85
  _out %[<br><a href="javascript:history.go(-1)">[Back]</a>]
69
86
  end
70
87
 
88
+ def banner # still experimental
89
+ _out "<table>"
90
+ _body do |line|
91
+ pieces = line.split
92
+ cols = pieces.size
93
+ span = cols == 2 ? 1 : 2 # whaaat?
94
+ _out " <tr>"
95
+ pieces.each do |piece|
96
+ _out " <td colspan=#{span}>"
97
+ case
98
+ when piece.start_with?("hnav")
99
+ _out "<center>hnav1 hnav2 hnav3 hnav4</center>"
100
+ when piece.start_with?("vnav")
101
+ _out "vnav1<br>vnav2<br>vnav3<br>vnav4<br>"
102
+ when piece.start_with?("text")
103
+ file = piece.split(":")[1]
104
+ _out File.read(file)
105
+ when piece.start_with?("image")
106
+ file = piece.split(":")[1]
107
+ _out " <img src=#{file} height=100></img>"
108
+ else
109
+ _out " '#{piece}' isn't known"
110
+ end
111
+ _out " </td>"
112
+ end
113
+ _out " </tr>"
114
+ end
115
+ _out "</table>"
116
+ end
117
+
71
118
  def quote
72
119
  _passthru "<blockquote>"
73
120
  _passthru _body.join(" ")
@@ -219,6 +266,18 @@ def pin
219
266
  _debug "data = #{_args}"
220
267
  # verify only already-specified views?
221
268
  @meta.pinned = _args.dup
269
+ dir = @blog.view.dir/"themes/standard/widgets/pinned/"
270
+ datafile = dir/"list.data"
271
+ pins = File.readlines(datafile) rescue []
272
+ damn = File.new("/tmp/dammit", "w")
273
+ pins << "#{@meta.num} #{@meta.title}\n"
274
+ damn.puts pins
275
+ pins.uniq!
276
+ damn.puts pins
277
+ damn.close
278
+ File.open(datafile, "w") do
279
+ pins.each {|pin| File.puts pin }
280
+ end
222
281
  _optional_blank_line
223
282
  end
224
283
 
@@ -402,7 +461,7 @@ def sidebar
402
461
  end
403
462
  end
404
463
 
405
- xlate cwd: wtag, src: tag, dst: tcard # , debug: (tag == "ad")
464
+ xlate cwd: wtag, src: tag, dst: tcard, force: true # , debug: (tag == "ad")
406
465
  _include_file wtag/tcard
407
466
  end
408
467
  _out %[</div>]
@@ -556,6 +615,42 @@ def tag_cloud
556
615
  _out close
557
616
  end
558
617
 
618
+ def vnavbar
619
+ end
620
+
621
+ def navbar2
622
+ vdir = @blog.view.dir
623
+ title = _var(:blog)
624
+
625
+ open = <<-HTML
626
+ <nav class="navbar navbar-light bg-light">
627
+ <a class="navbar-brand" href="index.html">#{title}</a>
628
+ <ul class="navbar-nav mr-auto">
629
+ HTML
630
+ close = <<-HTML
631
+ </ul>
632
+ </div>
633
+ </nav>
634
+ HTML
635
+
636
+ first = true
637
+ _out open
638
+ lines = _body
639
+ lines.each do |line|
640
+ basename, cdata = line.chomp.strip.split(" ", 2)
641
+ full = :navbar/basename+".html"
642
+ href_main = _main(full)
643
+ if first
644
+ first = false # hardcode this part??
645
+ _out %[<li class="nav-item active"> <a class="nav-link" href="index.html">#{cdata}<span class="sr-only">(current)</span></a> </li>]
646
+ else
647
+ xlate cwd: "navbar", src: basename, dst: vdir/"remote/navbar"/basename+".html" # , debug: true
648
+ _out %[<li class="nav-item"> <a class="nav-link" #{href_main}>#{cdata}</a> </li>]
649
+ end
650
+ end
651
+ _out close
652
+ end
653
+
559
654
  def navbar
560
655
  vdir = @blog.view.dir
561
656
  title = _var(:blog)
@@ -753,7 +848,7 @@ end
753
848
 
754
849
  def _write_metadata
755
850
  File.write("teaser.txt", @meta.teaser)
756
- fields = [:num, :title, :date, :pubdate, :views, :tags]
851
+ fields = [:num, :title, :date, :pubdate, :views, :tags, :pinned]
757
852
  fname2 = "metadata.txt"
758
853
  f2 = File.open(fname2, "w") do |f2|
759
854
  fields.each {|fld| f2.puts "#{fld}: #{@meta.send(fld)}" }
@@ -37,7 +37,77 @@ module RuneBlog::REPL
37
37
  @out
38
38
  end
39
39
 
40
- def cmd_pages(arg, testing = false)
40
+ def cmd_config(arg, testing = false)
41
+ list = ["global.lt3", "blog/generate.lt3", " head.lt3", " index.lt3",
42
+ " post_entry.lt3", "etc/blog.css.lt3", " externals.lt3",
43
+ "post/generate.lt3", " head.lt3", " index.lt3",
44
+ " permalink.lt3"]
45
+ name = ["global.lt3", "blog/generate.lt3", "blog/head.lt3", "blog/index.lt3",
46
+ "blog/post_entry.lt3", "etc/blog.css.lt3", "blog/externals.lt3",
47
+ "post/generate.lt3", "post/head.lt3", "post/index.lt3",
48
+ "post/permalink.lt3"]
49
+ dir = @blog.view.dir/"themes/standard/"
50
+ num, str = STDSCR.menu(title: "Edit file:", items: list)
51
+ target = name[num]
52
+ edit_file(dir/target)
53
+ end
54
+
55
+ def cmd_manage(arg, testing = false)
56
+ case arg
57
+ when "pages"; _manage_pages(nil, testing = false)
58
+ when "links"; _manage_links(nil, testing = false)
59
+ when "navbar"; _manage_navbar(nil, testing = false)
60
+ # when "pinned"; _manage_pinned(nil, testing = false) # ditch this??
61
+ else
62
+ puts "#{arg} is unknown"
63
+ end
64
+ end
65
+
66
+ def _manage_pinned(arg, testing = false) # cloned from manage_links
67
+ check_empty(arg)
68
+ dir = @blog.view.dir/"themes/standard/widgets/pinned"
69
+ data = dir/"list.data"
70
+ edit_file(data)
71
+ end
72
+
73
+ def _manage_navbar(arg, testing = false) # cloned from manage_pages
74
+ puts "Got to #{__method__}"
75
+ check_empty(arg)
76
+ dir = @blog.view.dir/"themes/standard/navbar"
77
+ files = Dir.entries(dir) - %w[. .. navbar.lt3]
78
+ new_item = " [New item] "
79
+ main_file = "[ navbar.lt3 ]"
80
+ files = [main_file] + files + [new_item]
81
+ num, fname = STDSCR.menu(title: "Edit navbar:", items: files)
82
+ return if fname.nil?
83
+ case fname
84
+ when new_item
85
+ print "Page title: "
86
+ title = RubyText.gets
87
+ title.chomp!
88
+ print "File name (.lt3): "
89
+ fname = RubyText.gets
90
+ fname << ".lt3" unless fname.end_with?(".lt3")
91
+ new_file = dir/fname
92
+ File.open(new_file, "w") do |f|
93
+ f.puts "<h1>#{title}</h1>\n\n\n "
94
+ f.puts ".backlink"
95
+ end
96
+ edit_file(new_file)
97
+ when main_file
98
+ edit_file(main_file[2..-3])
99
+ else
100
+ edit_file(dir/fname)
101
+ end
102
+ end
103
+
104
+ def _manage_links(arg, testing = false)
105
+ dir = @blog.view.dir/"themes/standard/widgets/links"
106
+ data = dir/"list.data"
107
+ edit_file(data)
108
+ end
109
+
110
+ def _manage_pages(arg, testing = false)
41
111
  check_empty(arg)
42
112
  dir = @blog.view.dir/"themes/standard/widgets/pages"
43
113
  # Assume child files already generated (and list.data??)
@@ -393,7 +463,7 @@ module RuneBlog::REPL
393
463
  list views List all views available
394
464
  lsv Same as: list views
395
465
 
396
- * config Edit the publish file or the templates
466
+ config Edit various system files
397
467
  * customize (BUGGY) Change set of tags, extra views
398
468
 
399
469
  p, post Create a new post
@@ -438,7 +438,7 @@ class RuneBlog
438
438
  @theme = @root/:views/view/:themes/:standard
439
439
  xlate cwd: vdir/"themes/standard/etc",
440
440
  src: "blog.css.lt3", copy: vdir/"remote/etc/blog.css" # , debug: true
441
- xlate cwd: vdir/"themes/standard",
441
+ xlate cwd: vdir/"themes/standard", force: true,
442
442
  src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
443
443
  copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
444
444
  rescue => err
@@ -543,7 +543,7 @@ class RuneBlog
543
543
  @theme = @root/:views/view_name/:themes/:standard
544
544
  # Step 1...
545
545
  create_dirs(pdraft)
546
- xlate cwd: pdraft, src: draft, dst: "guts.html", debug: true
546
+ xlate cwd: pdraft, src: draft, dst: "guts.html" # , debug: true
547
547
  _post_metadata(draft, pdraft)
548
548
  # Step 2...
549
549
  vposts = @root/:views/view_name/:posts
@@ -553,7 +553,7 @@ class RuneBlog
553
553
  copy(pdraft/"vars.lt3", @theme/:post)
554
554
  # Step 4...
555
555
  xlate cwd: @theme/:post, src: "generate.lt3", force: true,
556
- dst: remote/ahtml, copy: @theme/:post, debug: true
556
+ dst: remote/ahtml, copy: @theme/:post # , debug: true
557
557
  xlate cwd: @theme/:post, src: "permalink.lt3",
558
558
  dst: remote/:permalink/ahtml # , debug: true
559
559
  copy_widget_html(view_name)
@@ -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.48"
5
+ VERSION = "0.2.50"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  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.2.48
4
+ version: 0.2.50
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-20 00:00:00.000000000 Z
11
+ date: 2019-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -69,6 +69,11 @@ files:
69
69
  - empty_view/remote/navbar/GIT_IS_DUMB
70
70
  - empty_view/remote/permalink/GIT_IS_DUMB
71
71
  - empty_view/themes/standard/README
72
+ - empty_view/themes/standard/banner/about.lt3
73
+ - empty_view/themes/standard/banner/blog-banner.jpg
74
+ - empty_view/themes/standard/banner/contact.lt3
75
+ - empty_view/themes/standard/banner/faq.lt3
76
+ - empty_view/themes/standard/banner/navbar.lt3
72
77
  - empty_view/themes/standard/blog/generate.lt3
73
78
  - empty_view/themes/standard/blog/head.lt3
74
79
  - empty_view/themes/standard/blog/index.lt3