runeblog 0.3.12 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/empty_view/themes/standard/widgets/pages/pages.rb +35 -0
  3. data/lib/repl.rb +1 -1
  4. data/lib/runeblog_version.rb +1 -1
  5. data/lib/widgets/README +4 -0
  6. data/lib/widgets/ad/ad.lt3 +22 -0
  7. data/lib/widgets/ad/ad1.png +0 -0
  8. data/lib/widgets/ad/ad2.png +0 -0
  9. data/lib/widgets/ad/ad3.png +0 -0
  10. data/lib/widgets/ad/ad4.png +0 -0
  11. data/lib/widgets/bydates/README +2 -0
  12. data/lib/widgets/bydates/bydates.rb +18 -0
  13. data/lib/widgets/bydates/card.css +1 -0
  14. data/lib/widgets/bydates/custom.rb +1 -0
  15. data/lib/widgets/bydates/main.css +2 -0
  16. data/lib/widgets/links/README +2 -0
  17. data/lib/widgets/links/card.css +1 -0
  18. data/lib/widgets/links/custom.rb +1 -0
  19. data/lib/widgets/links/links.rb +90 -0
  20. data/lib/widgets/links/list.data +3 -0
  21. data/lib/widgets/links/main.css +2 -0
  22. data/lib/widgets/news/README +2 -0
  23. data/lib/widgets/news/card.css +1 -0
  24. data/lib/widgets/news/custom.rb +1 -0
  25. data/lib/widgets/news/list.data +4 -0
  26. data/lib/widgets/news/main.css +2 -0
  27. data/lib/widgets/news/news.rb +88 -0
  28. data/lib/widgets/pages/README +2 -0
  29. data/lib/widgets/pages/card.css +1 -0
  30. data/lib/widgets/pages/custom.rb +1 -0
  31. data/lib/widgets/pages/disclaim.lt3 +10 -0
  32. data/lib/widgets/pages/faq.lt3 +41 -0
  33. data/lib/widgets/pages/like-dislike.lt3 +11 -0
  34. data/lib/widgets/pages/list.data +4 -0
  35. data/lib/widgets/pages/local.rb +0 -0
  36. data/lib/widgets/pages/main.css +2 -0
  37. data/lib/widgets/pages/other-stuff.lt3 +10 -0
  38. data/lib/widgets/pages/pages.rb +130 -0
  39. data/lib/widgets/pinned/README +2 -0
  40. data/lib/widgets/pinned/card.css +1 -0
  41. data/lib/widgets/pinned/custom.rb +1 -0
  42. data/lib/widgets/pinned/main.css +2 -0
  43. data/lib/widgets/pinned/pinned.rb +111 -0
  44. data/lib/widgets/search/README +2 -0
  45. data/lib/widgets/search/card.css +1 -0
  46. data/lib/widgets/search/custom.rb +1 -0
  47. data/lib/widgets/search/main.css +2 -0
  48. data/lib/widgets/search/search.rb +18 -0
  49. data/lib/widgets/sitemap/README +2 -0
  50. data/lib/widgets/sitemap/card.css +1 -0
  51. data/lib/widgets/sitemap/custom.rb +1 -0
  52. data/lib/widgets/sitemap/main.css +2 -0
  53. data/lib/widgets/sitemap/sitemap.rb +18 -0
  54. data/lib/widgets/tag-cloud/OLD-example.lt3 +12 -0
  55. data/lib/widgets/tag-cloud/README +2 -0
  56. data/lib/widgets/tag-cloud/card.css +1 -0
  57. data/lib/widgets/tag-cloud/custom.rb +1 -0
  58. data/lib/widgets/tag-cloud/main.css +2 -0
  59. data/lib/widgets/tag-cloud/tag-cloud.lt3 +3 -0
  60. data/lib/widgets/tag-cloud/tag-cloud.rb +18 -0
  61. metadata +58 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0372218e12e1f9436b17621b6d32a0894daf4e58bbf7f2cd55dd6fc48eca5af5'
4
- data.tar.gz: 33da1a53944d8db1b681f885446721e626699b8a3b0126bd3b854df1f707a203
3
+ metadata.gz: e22a6be6adfdd14837a0b23c07e2bddf4650521a763a9186acb1781edd1785ab
4
+ data.tar.gz: 04a82d92d9392e3b1c4a610afc9ebbeed47726c0932f72936a29ef8c5fbf440b
5
5
  SHA512:
6
- metadata.gz: 8d5fd3bf878e11f7d9d1cba4659c9f199a0cc7908bf2bf9596e6e2716e56a53863cd0cf978dfa3c0db033c8129ab5ddf2f29daf315fa058e50171b783c926012
7
- data.tar.gz: 5790b07d2a6b3ca787b67e473f83e99ee4d29171ffc6bdbe30e5275b2ae098c7a388bd873cd9a6e1bb1a3206082e59f1bbefcffc158b3f704a0fda3a02637d7e
6
+ metadata.gz: '08cb787718c66db9d66f53213aee5fe3d75e79c604abbeeabc977670552bbaa3bd2eaa50197b275109acb7308ca06a7f86aea7e363e57b2a4d1408d1108d2c70'
7
+ data.tar.gz: bcf1ce1be7323378113ddbdef3ee4031a4a76d7af2dbf7492c8d27014010cb4c034d7a693c2ef0239e60792910dfd940ba6f46189e8260369efc7d065cd0b8df
@@ -86,6 +86,41 @@ class ::RuneBlog::Widget
86
86
  end
87
87
  end
88
88
 
89
+ def manage
90
+ dir = @blog.view.dir/"themes/standard/widgets/pages"
91
+ # Assume child files already generated (and list.data??)
92
+ data = dir/"list.data"
93
+ lines = _get_data?(data)
94
+ hash = {}
95
+ lines.each do |line|
96
+ url, name = line.chomp.split(",")
97
+ source = url.sub(/.html$/, ".lt3")
98
+ hash[name] = source
99
+ end
100
+ new_item = "[New page]"
101
+ num, fname = STDSCR.menu(title: "Edit page:", items: hash.keys + [new_item])
102
+ return if fname.nil?
103
+ if fname == new_item
104
+ print "Page title: "
105
+ title = RubyText.gets
106
+ title.chomp!
107
+ print "File name (.lt3): "
108
+ fname = RubyText.gets
109
+ fname << ".lt3" unless fname.end_with?(".lt3")
110
+ fhtml = fname.sub(/.lt3$/, ".html")
111
+ File.open(data, "a") {|f| f.puts "#{fhtml},#{title}" }
112
+ new_file = dir/fname
113
+ File.open(new_file, "w") do |f|
114
+ f.puts "<h1>#{title}</h1>\n\n\n "
115
+ f.puts ".backlink"
116
+ end
117
+ edit_file(new_file)
118
+ else
119
+ target = hash[fname]
120
+ edit_file(dir/target)
121
+ end
122
+ end
123
+
89
124
  def edit_menu
90
125
  end
91
126
 
@@ -121,7 +121,7 @@ module RuneBlog::REPL
121
121
  edit_file(data)
122
122
  end
123
123
 
124
- def _manage_pages
124
+ def _manage_pages # FIXME move into widget code
125
125
  dir = @blog.view.dir/"themes/standard/widgets/pages"
126
126
  # Assume child files already generated (and list.data??)
127
127
  data = dir/"list.data"
@@ -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.12"
6
+ VERSION = "0.3.13"
7
7
 
8
8
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
9
9
  Path = File.dirname(path)
@@ -0,0 +1,4 @@
1
+ bydates Browse blog entries for past dates
2
+ links List of links (typically offsite)
3
+ pages List of pages (my own local stuff)
4
+ search Search posts by tag, title, body, etc.
@@ -0,0 +1,22 @@
1
+ . In real life, ads won't work this way...
2
+
3
+ .include vars.lt3
4
+
5
+ .set classname="btn btn-light float-right"
6
+ .set card.title="Advertisement"
7
+ .set card.text="Build your amazing website with blabla.com."
8
+ . set extra="bg-dark text-white"
9
+
10
+ <!-- "$ad.image" -->
11
+
12
+ <div class="card $extra mb-3">
13
+ <div class="card-body">
14
+ <!--
15
+ <h5 class="card-title">$card.title</h5>
16
+ <p class="card-text">$card.text</p>
17
+ <a href="javascript: void(0)" onclick="javascript:open_main('widgets/ad/ad.html')" class="$classname">Visit page</a>
18
+ -->
19
+ <img style="max-height: 100%; max-width: 100%" src="$ad.image"></img>
20
+ </div>
21
+ </div>
22
+
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,2 @@
1
+ This is for a "standard" Runeblog widget
2
+ Code and docs are a work in progress
@@ -0,0 +1,18 @@
1
+ # Custom code for 'bydates' widget
2
+
3
+ class ::RuneBlog::Widget
4
+ class Bydates
5
+ def initialize(repo)
6
+ @blog = repo
7
+ end
8
+
9
+ def build
10
+ end
11
+
12
+ def edit_menu
13
+ end
14
+
15
+ def refresh
16
+ end
17
+ end
18
+ end
@@ -0,0 +1 @@
1
+ # CSS for sidebar card
@@ -0,0 +1 @@
1
+ # This is for specialized livetext add-ons (Ruby methods)
@@ -0,0 +1,2 @@
1
+ # CSS for main area page
2
+ bosy { font-family: verdana }
@@ -0,0 +1,2 @@
1
+ This is for a "standard" Runeblog widget
2
+ Code and docs are a work in progress
@@ -0,0 +1 @@
1
+ # CSS for sidebar card
@@ -0,0 +1 @@
1
+ # This is for specialized livetext add-ons (Ruby methods)
@@ -0,0 +1,90 @@
1
+ # Custom code for 'links' widget
2
+
3
+ require 'liveblog'
4
+
5
+ class ::RuneBlog::Widget
6
+ class Links
7
+ Type, Title = "links", "External links"
8
+
9
+ def initialize(repo)
10
+ @blog = repo
11
+ @datafile = input = "list.data"
12
+ @lines = _get_data(@datafile)
13
+ end
14
+
15
+ def build
16
+ write_main
17
+ write_card
18
+ end
19
+
20
+ def _html_body(file, css = nil)
21
+ file.puts "<html>"
22
+ if css
23
+ file.puts " <head>"
24
+ file.puts " <style>\n#{css}\n </style>"
25
+ file.puts " </head>"
26
+ end
27
+ file.puts " <body>"
28
+ yield
29
+ file.puts " </body>\n</html>"
30
+ end
31
+
32
+ def write_main
33
+ @data = @lines.map! {|x| x.chomp.split(/, */, 3) }
34
+ css = "body { font-family: verdana }"
35
+ card_title = Title
36
+ File.open("#{Type}-main.html", "w") do |f|
37
+ _html_body(f, css) do
38
+ f.puts "<h1>#{card_title}</h1><br><hr>"
39
+ url_ref = nil
40
+ @data.each do |url, frameable, title|
41
+ url_ref = "href = '#{url}'"
42
+ url_ref << " target=blank" if frameable == "yes"
43
+ css = "color: #8888FF; text-decoration: none; font-size: 21px"
44
+ f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ def write_card
51
+ tag = "links"
52
+ url = :widgets/tag/tag+"-main.html"
53
+ card_title = "External links" # FIXME
54
+ cardfile = "#{Type}-card"
55
+ File.open("#{cardfile}.html", "w") do |f|
56
+ f.puts <<-EOS
57
+ <div class="card mb-3">
58
+ <div class="card-body">
59
+ <h5 class="card-title">
60
+ <button type="button" class="btn btn-primary" data-toggle="collapse" data-target="##{tag}">+</button>
61
+ <a href="javascript: void(0)"
62
+ onclick="javascript:open_main('#{url}')"
63
+ style="text-decoration: none; color: black"> #{card_title}</a>
64
+ </h5>
65
+ <div class="collapse" id="#{tag}">
66
+ EOS
67
+ @data.each do |url2, frameable, title|
68
+ f.puts "<!-- #{[url2, frameable, title].inspect} -->"
69
+ main_ref = %[href="javascript: void(0)" onclick="javascript:open_main('#{url2}')"]
70
+ tab_ref = %[href="#{url2}"]
71
+ url_ref = (frameable == "yes") ? main_ref : tab_ref
72
+ anchor = %[<a #{url_ref}>#{title}</a>]
73
+ wrapper = %[<li class="list-group-item">#{anchor}</li>]
74
+ f.puts wrapper
75
+ end
76
+ f.puts <<-EOS
77
+ </div>
78
+ </div>
79
+ </div>
80
+ EOS
81
+ end
82
+ end
83
+
84
+ def edit_menu
85
+ end
86
+
87
+ def refresh
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,3 @@
1
+ https://www.mensa.org, no, Mensa International
2
+ http://space.com, yes, Space.com: NASA, Space Exploration and Astronomy News
3
+ https://arstechnica.com, no, Ars Technica
@@ -0,0 +1,2 @@
1
+ # CSS for main area page
2
+ body { font-family: verdana }
@@ -0,0 +1,2 @@
1
+ This is for a "standard" Runeblog widget
2
+ Code and docs are a work in progress
@@ -0,0 +1 @@
1
+ # CSS for sidebar card
@@ -0,0 +1 @@
1
+ # This is for specialized livetext add-ons (Ruby methods)
@@ -0,0 +1,4 @@
1
+ https://techcrunch.com/2019/09/16/fossa-scores-8-5-million-series-a-to-help-enterprise-manage-open-source-licenses/, yes, FOSSA scores \$8.5 million Series A to help enterprise manage open-source licenses
2
+ https://techcrunch.com/2019/09/17/spacexs-orbital-starship-prototype-construction-progress-detailed-in-new-photos/, yes, SpaceX’s orbital Starship prototype construction progress detailed in new photos
3
+ https://developers.googleblog.com/2019/05/Flutter-io19.html, yes, Flutter: a Portable UI Framework for Mobile, Web, Embedded, and Desktop
4
+ https://jaycarlson.net/microcontrollers/, no, The Amazing \$1 Microcontroller (2017)
@@ -0,0 +1,2 @@
1
+ # CSS for main area page
2
+ body { font-family: verdana }
@@ -0,0 +1,88 @@
1
+ # Custom code for 'news' widget
2
+
3
+ class ::RuneBlog::Widget
4
+ class News
5
+ Type, Title = "news", "News"
6
+
7
+ def initialize(repo)
8
+ @blog = repo
9
+ @datafile = "list.data"
10
+ lines = _get_data(@datafile)
11
+ @data = lines.map {|line| line.chomp.split(/, */) }
12
+ end
13
+
14
+ def build
15
+ write_main
16
+ write_card
17
+ end
18
+
19
+ def _html_body(file, css = nil)
20
+ file.puts "<html>"
21
+ if css
22
+ file.puts " <head>"
23
+ file.puts " <style>\n#{css}\n </style>"
24
+ file.puts " </head>"
25
+ end
26
+ file.puts " <body>"
27
+ yield
28
+ file.puts " </body>\n</html>"
29
+ end
30
+
31
+ def write_main
32
+ mainfile = "#{Type}-main"
33
+ css = "body { font-family: verdana }"
34
+ File.open("#{mainfile}.html", "w") do |f|
35
+ _html_body(f, css) do
36
+ f.puts "<h1>#{Title}</h1><br><hr>"
37
+ @data.each do |file, frameable, title|
38
+ title = title.gsub(/\\/, "") # kludge
39
+ case frameable
40
+ when "yes"; url_ref = "href = '#{file}'"
41
+ when "no"; url_ref = %[href='#{file}' target='blank']
42
+ end
43
+ css = "color: #8888FF; text-decoration: none; font-size: 21px"
44
+ f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ def write_card
51
+ cardfile = "#{Type}-card"
52
+ url = "widgets/#{Type}/#{Type}-main.html"
53
+ File.open("#{cardfile}.html", "w") do |f|
54
+ f.puts <<-EOS
55
+ <div class="card mb-3">
56
+ <div class="card-body">
57
+ <h5 class="card-title">
58
+ <button type="button" class="btn btn-primary" data-toggle="collapse" data-target="##{Type}">+</button>
59
+ <a href="javascript: void(0)"
60
+ onclick="javascript:open_main('#{url}')"
61
+ style="text-decoration: none; color: black"> #{Title}</a>
62
+ </h5>
63
+ <div class="collapse" id="#{Type}">
64
+ EOS
65
+ @data.each do |file, frameable, title|
66
+ case frameable
67
+ when "yes"; url_ref = _main(file) # remote, frameable
68
+ when "no"; url_ref = _blank(file) # remote, not frameable
69
+ end
70
+ anchor = %[<a #{url_ref}>#{title}</a>]
71
+ wrapper = %[<li class="list-group-item">#{anchor}</li>]
72
+ f.puts wrapper
73
+ end
74
+ f.puts <<-EOS
75
+ </div>
76
+ </div>
77
+ </div>
78
+ EOS
79
+ end
80
+ end
81
+
82
+ def edit_menu
83
+ end
84
+
85
+ def refresh
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,2 @@
1
+ This is a work in progress...
2
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+ # This is for specialized livetext add-ons (Ruby methods)
@@ -0,0 +1,10 @@
1
+ .mixin liveblog
2
+
3
+ <h2>Disclaimer</h2>
4
+
5
+ This is just a
6
+ dummy file
7
+
8
+ disclaimer, blah blah
9
+
10
+ .backlink
@@ -0,0 +1,41 @@
1
+ .nopara # FIXME later
2
+ .mixin liveblog
3
+
4
+ <html>
5
+ <head>
6
+
7
+ <style>
8
+ body { font-family: verdana }
9
+ </style>
10
+
11
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
12
+ <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>
13
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap-theme.min.css"></link>
14
+ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
15
+
16
+ </head>
17
+
18
+ <body>
19
+
20
+ <h2>Frequently Asked Questions</h2>
21
+
22
+ .faq Are you a rabbit?
23
+ Yes, I am.
24
+ .end
25
+
26
+ .faq Are you a frog?
27
+ Don't be stupid. I just told you I was a rabbit.
28
+ .end
29
+
30
+ .faq Why do you answer a question with a question?
31
+ *Do I in fact answer a question with a question?
32
+ .end
33
+
34
+ .faq Are you serious?
35
+ No, I'm a rabbit.
36
+ .end
37
+
38
+ .backlink
39
+
40
+ </body>
41
+ </html>
@@ -0,0 +1,11 @@
1
+ .mixin liveblog
2
+
3
+ <h2>My Likes and Dislikes</h2>
4
+
5
+ This is
6
+ stuff that I
7
+ like
8
+ and
9
+ dislike...
10
+
11
+ .backlink
@@ -0,0 +1,4 @@
1
+ faq.html,Frequently Asked Questions
2
+ like-dislike.html,Likes and Dislikes
3
+ disclaim.html,Disclaimer
4
+ other-stuff.html,Other Stuff
File without changes
@@ -0,0 +1,2 @@
1
+ # CSS for pages widget
2
+ body { font-family: verdana }
@@ -0,0 +1,10 @@
1
+ .mixin liveblog
2
+
3
+ <h2>Other Stuff</h2>
4
+
5
+ This is
6
+ just
7
+ some
8
+ other stuff...
9
+
10
+ .backlink
@@ -0,0 +1,130 @@
1
+ # Custom code for 'pages' widget
2
+
3
+ # How to update repl code?
4
+
5
+ class ::RuneBlog::Widget
6
+ class Pages
7
+ Type, Title = "pages", "My Pages"
8
+
9
+ def initialize(repo)
10
+ @blog = repo
11
+ @datafile = "list.data"
12
+ @lines = _get_data(@datafile)
13
+ @data = @lines.map {|x| x.chomp.split(/, */, 2) }
14
+ end
15
+
16
+ def build
17
+ # build child pages
18
+ children = Dir["*.lt3"] - ["pages.lt3"]
19
+ children.each do |child|
20
+ dest = child.sub(/.lt3$/, ".html")
21
+ preprocess src: child, dst: dest
22
+ end
23
+ write_main
24
+ write_card
25
+ end
26
+
27
+ def _html_body(file, css = nil)
28
+ file.puts "<html>"
29
+ if css
30
+ file.puts " <head>"
31
+ file.puts " <style>\n#{css}\n </style>"
32
+ file.puts " </head>"
33
+ end
34
+ file.puts " <body>"
35
+ yield
36
+ file.puts " </body>\n</html>"
37
+ end
38
+
39
+ def write_main
40
+ css = "body { font-family: verdana }"
41
+ card_title = Title
42
+ File.open("#{Type}-main.html", "w") do |f|
43
+ _html_body(f, css) do
44
+ f.puts "<h1>#{card_title}</h1><br><hr>"
45
+ url_ref = nil
46
+ @data.each do |url, title|
47
+ url_ref = "href = '#{url}'"
48
+ css = "color: #8888FF; text-decoration: none; font-size: 21px"
49
+ f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ def write_card
56
+ tag = Type
57
+ url = :widgets/tag/tag+"-main.html"
58
+ card_title = "Pages" # FIXME
59
+ cardfile = "#{Type}-card"
60
+ File.open("#{cardfile}.html", "w") do |f|
61
+ f.puts <<-EOS
62
+ <div class="card mb-3">
63
+ <div class="card-body">
64
+ <h5 class="card-title">
65
+ <button type="button" class="btn btn-primary" data-toggle="collapse" data-target="##{tag}">+</button>
66
+ <a href="javascript: void(0)"
67
+ onclick="javascript:open_main('#{url}')"
68
+ style="text-decoration: none; color: black">#{card_title}</a>
69
+ </h5>
70
+ <div class="collapse" id="#{tag}">
71
+ EOS
72
+ @data.each do |url2, title|
73
+ f.puts "<!-- #{[url2, title].inspect} -->"
74
+ url3 = :widgets/tag/url2
75
+ f.puts "<!-- url3 = #{url3.inspect} -->"
76
+ url_ref = %[href="javascript: void(0)" onclick="javascript:open_main('#{url3}')"]
77
+ anchor = %[<a #{url_ref}>#{title}</a>]
78
+ wrapper = %[<li class="list-group-item">#{anchor}</li>]
79
+ f.puts wrapper
80
+ end
81
+ f.puts <<-EOS
82
+ </div>
83
+ </div>
84
+ </div>
85
+ EOS
86
+ end
87
+ end
88
+
89
+ def manage
90
+ dir = @blog.view.dir/"themes/standard/widgets/pages"
91
+ # Assume child files already generated (and list.data??)
92
+ data = dir/"list.data"
93
+ lines = _get_data?(data)
94
+ hash = {}
95
+ lines.each do |line|
96
+ url, name = line.chomp.split(",")
97
+ source = url.sub(/.html$/, ".lt3")
98
+ hash[name] = source
99
+ end
100
+ new_item = "[New page]"
101
+ num, fname = STDSCR.menu(title: "Edit page:", items: hash.keys + [new_item])
102
+ return if fname.nil?
103
+ if fname == new_item
104
+ print "Page title: "
105
+ title = RubyText.gets
106
+ title.chomp!
107
+ print "File name (.lt3): "
108
+ fname = RubyText.gets
109
+ fname << ".lt3" unless fname.end_with?(".lt3")
110
+ fhtml = fname.sub(/.lt3$/, ".html")
111
+ File.open(data, "a") {|f| f.puts "#{fhtml},#{title}" }
112
+ new_file = dir/fname
113
+ File.open(new_file, "w") do |f|
114
+ f.puts "<h1>#{title}</h1>\n\n\n "
115
+ f.puts ".backlink"
116
+ end
117
+ edit_file(new_file)
118
+ else
119
+ target = hash[fname]
120
+ edit_file(dir/target)
121
+ end
122
+ end
123
+
124
+ def edit_menu
125
+ end
126
+
127
+ def refresh
128
+ end
129
+ end
130
+ end
@@ -0,0 +1,2 @@
1
+ This is for a "standard" Runeblog widget
2
+ Code and docs are a work in progress
@@ -0,0 +1 @@
1
+ # CSS for sidebar card
@@ -0,0 +1 @@
1
+ # This is for specialized livetext add-ons (Ruby methods)
@@ -0,0 +1,2 @@
1
+ # CSS for main area page
2
+ body { font-family: verdana }
@@ -0,0 +1,111 @@
1
+ # Custom code for 'pinned' widget
2
+
3
+ class ::RuneBlog::Widget
4
+ class Pinned
5
+ Type, Title = "pinned", "Pinned posts"
6
+
7
+ def initialize(repo)
8
+ @blog = repo
9
+ @datafile = "list.data"
10
+ @lines = _get_data?(@datafile)
11
+ end
12
+
13
+ def read_metadata
14
+ meta = read_pairs!("metadata.txt")
15
+ meta.views = meta.views.split
16
+ meta.tags = meta.tags.split
17
+ meta
18
+ end
19
+
20
+ def _html_body(file, css = nil) # FIXME
21
+ file.puts "<html>"
22
+ if css
23
+ file.puts " <head>"
24
+ file.puts " <style>\n#{css}\n </style>"
25
+ file.puts " </head>"
26
+ end
27
+ file.puts " <body>"
28
+ yield
29
+ file.puts " </body>\n</html>"
30
+ end
31
+
32
+ def build
33
+ dir = @blog.root/:posts
34
+ posts = nil
35
+ Dir.chdir(dir) { posts = Dir["*"] }
36
+ hash = {}
37
+ @links = []
38
+ @lines.each do |x|
39
+ num, title = x.chomp.split(" ", 2)
40
+ hash[num] = title
41
+ pre = '%04d' % num
42
+ nslug = posts.grep(/#{pre}-/).first
43
+ meta = nil
44
+ Dir.chdir(dir/nslug) { meta = read_metadata }
45
+ pubdate = meta.pubdate
46
+ name = nslug[5..-1]
47
+ link = name+".html"
48
+ @links << [pubdate, title, link]
49
+ end
50
+ write_main
51
+ write_card
52
+ end
53
+
54
+ def write_main
55
+ tag = Type
56
+ card_title = Title
57
+ css = "body { font-family: verdana }"
58
+ mainfile = "#{tag}-main"
59
+ File.open("#{mainfile}.html", "w") do |f|
60
+ _html_body(f, css) do
61
+ f.puts "<!-- #{@lines.inspect} in #{Dir.pwd} -->"
62
+ f.puts "<h1>#{card_title}</h1><br><hr>"
63
+ @links.each do |pubdate, title, file|
64
+ title = title.gsub(/\\/, "") # kludge
65
+ css = "color: #8888FF; text-decoration: none; font-size: 21px"
66
+ f.puts "<!-- pubdate = #{pubdate.inspect} -->"
67
+ f.puts %[#{pubdate} <a style="#{css}" href="../../#{file}">#{title}</a> <br>]
68
+ end
69
+ end
70
+ end
71
+ end
72
+
73
+ def write_card
74
+ tag = Type
75
+ url = :widgets/tag/tag+"-main.html"
76
+ card_title = Title
77
+ cardfile = "#{tag}-card"
78
+ File.open("#{cardfile}.html", "w") do |f|
79
+ f.puts <<-EOS
80
+ <div class="card mb-3">
81
+ <div class="card-body">
82
+ <h5 class="card-title">
83
+ <button type="button" class="btn btn-primary" data-toggle="collapse" data-target="##{tag}">+</button>
84
+ <a href="javascript: void(0)"
85
+ onclick="javascript:open_main('#{url}')"
86
+ style="text-decoration: none; color: black"> #{card_title}</a>
87
+ </h5>
88
+ <div class="collapse" id="#{tag}">
89
+ EOS
90
+ @links.each do |pubdate, title, file|
91
+ url2 = file
92
+ url_ref = %[href="javascript: void(0)" onclick="javascript:open_main('#{url2}')"]
93
+ anchor = %[<a #{url_ref}>#{title}</a>]
94
+ wrapper = %[<li class="list-group-item">#{anchor}</li>]
95
+ f.puts wrapper
96
+ end
97
+ f.puts <<-EOS
98
+ </div>
99
+ </div>
100
+ </div>
101
+ EOS
102
+ end
103
+ end
104
+
105
+ def edit_menu
106
+ end
107
+
108
+ def refresh
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,2 @@
1
+ This is for a "standard" Runeblog widget
2
+ Code and docs are a work in progress
@@ -0,0 +1 @@
1
+ # CSS for sidebar card
@@ -0,0 +1 @@
1
+ # This is for specialized livetext add-ons (Ruby methods)
@@ -0,0 +1,2 @@
1
+ # CSS for main area page
2
+ body { font-family: verdana }
@@ -0,0 +1,18 @@
1
+ # Custom code for 'search' widget
2
+
3
+ class ::RuneBlog::Widget
4
+ class Search
5
+ def initialize(repo)
6
+ @blog = repo
7
+ end
8
+
9
+ def build
10
+ end
11
+
12
+ def edit_menu
13
+ end
14
+
15
+ def refresh
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,2 @@
1
+ This is for a "standard" Runeblog widget
2
+ Code and docs are a work in progress
@@ -0,0 +1 @@
1
+ # CSS for sidebar card
@@ -0,0 +1 @@
1
+ # This is for specialized livetext add-ons (Ruby methods)
@@ -0,0 +1,2 @@
1
+ # CSS for main area page
2
+ body { font-family: verdana }
@@ -0,0 +1,18 @@
1
+ # Custom code for 'sitemap' widget
2
+
3
+ class ::RuneBlog::Widget
4
+ class Sitemap
5
+ def initialize(repo)
6
+ @blog = repo
7
+ end
8
+
9
+ def build
10
+ end
11
+
12
+ def edit_menu
13
+ end
14
+
15
+ def refresh
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ .mixin liveblog
2
+
3
+ .tag_cloud
4
+ https://google.com/,btn btn-dark m-1,Programming
5
+ https://google.com/,btn btn-danger m-1,Science Fiction
6
+ https://google.com/,btn btn-light m-1,Art
7
+ https://google.com/,btn btn-dark m-1,Robotics
8
+ https://google.com/,btn btn-warning m-1,Food and Travel
9
+ https://google.com/,btn btn-light m-1,DIY Hacks
10
+ https://google.com/,btn btn-info m-1,Surfing
11
+ .end
12
+
@@ -0,0 +1,2 @@
1
+ This is for a "standard" Runeblog widget
2
+ Code and docs are a work in progress
@@ -0,0 +1 @@
1
+ # CSS for sidebar card
@@ -0,0 +1 @@
1
+ # This is for specialized livetext add-ons (Ruby methods)
@@ -0,0 +1,2 @@
1
+ # CSS for main area page
2
+ body { font-family: verdana }
@@ -0,0 +1,3 @@
1
+ .mixin liveblog
2
+
3
+ <h3>Currently nothing here -- not implemented</h3)
@@ -0,0 +1,18 @@
1
+ # Custom code for 'tag-cloud' widget
2
+
3
+ class ::RuneBlog::Widget
4
+ class TagCloud
5
+ def initialize(repo)
6
+ @blog = repo
7
+ end
8
+
9
+ def build
10
+ end
11
+
12
+ def edit_menu
13
+ end
14
+
15
+ def refresh
16
+ end
17
+ end
18
+ end
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.12
4
+ version: 0.3.13
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-12 00:00:00.000000000 Z
11
+ date: 2020-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -212,6 +212,62 @@ files:
212
212
  - lib/runeblog.rb
213
213
  - lib/runeblog_version.rb
214
214
  - lib/view.rb
215
+ - lib/widgets/README
216
+ - lib/widgets/ad/ad.lt3
217
+ - lib/widgets/ad/ad1.png
218
+ - lib/widgets/ad/ad2.png
219
+ - lib/widgets/ad/ad3.png
220
+ - lib/widgets/ad/ad4.png
221
+ - lib/widgets/bydates/README
222
+ - lib/widgets/bydates/bydates.rb
223
+ - lib/widgets/bydates/card.css
224
+ - lib/widgets/bydates/custom.rb
225
+ - lib/widgets/bydates/main.css
226
+ - lib/widgets/links/README
227
+ - lib/widgets/links/card.css
228
+ - lib/widgets/links/custom.rb
229
+ - lib/widgets/links/links.rb
230
+ - lib/widgets/links/list.data
231
+ - lib/widgets/links/main.css
232
+ - lib/widgets/news/README
233
+ - lib/widgets/news/card.css
234
+ - lib/widgets/news/custom.rb
235
+ - lib/widgets/news/list.data
236
+ - lib/widgets/news/main.css
237
+ - lib/widgets/news/news.rb
238
+ - lib/widgets/pages/README
239
+ - lib/widgets/pages/card.css
240
+ - lib/widgets/pages/custom.rb
241
+ - lib/widgets/pages/disclaim.lt3
242
+ - lib/widgets/pages/faq.lt3
243
+ - lib/widgets/pages/like-dislike.lt3
244
+ - lib/widgets/pages/list.data
245
+ - lib/widgets/pages/local.rb
246
+ - lib/widgets/pages/main.css
247
+ - lib/widgets/pages/other-stuff.lt3
248
+ - lib/widgets/pages/pages.rb
249
+ - lib/widgets/pinned/README
250
+ - lib/widgets/pinned/card.css
251
+ - lib/widgets/pinned/custom.rb
252
+ - lib/widgets/pinned/main.css
253
+ - lib/widgets/pinned/pinned.rb
254
+ - lib/widgets/search/README
255
+ - lib/widgets/search/card.css
256
+ - lib/widgets/search/custom.rb
257
+ - lib/widgets/search/main.css
258
+ - lib/widgets/search/search.rb
259
+ - lib/widgets/sitemap/README
260
+ - lib/widgets/sitemap/card.css
261
+ - lib/widgets/sitemap/custom.rb
262
+ - lib/widgets/sitemap/main.css
263
+ - lib/widgets/sitemap/sitemap.rb
264
+ - lib/widgets/tag-cloud/OLD-example.lt3
265
+ - lib/widgets/tag-cloud/README
266
+ - lib/widgets/tag-cloud/card.css
267
+ - lib/widgets/tag-cloud/custom.rb
268
+ - lib/widgets/tag-cloud/main.css
269
+ - lib/widgets/tag-cloud/tag-cloud.lt3
270
+ - lib/widgets/tag-cloud/tag-cloud.rb
215
271
  - test/austin.rb
216
272
  - test/fakeimage.jpg
217
273
  - test/general_test.rb