runeblog 0.3.34 → 0.3.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/data/global.lt3 +3 -3
  3. data/empty_view/global.lt3 +20 -0
  4. data/empty_view/themes/standard/banner/top.lt3 +1 -1
  5. data/empty_view/themes/standard/blog/generate.lt3 +1 -1
  6. data/empty_view/themes/standard/etc/blog.css.lt3 +1 -1
  7. data/empty_view/themes/standard/post/generate.lt3 +1 -1
  8. data/empty_view/themes/standard/post/permalink.lt3 +1 -1
  9. data/lib/exceptions.rb +2 -0
  10. data/lib/helpers-blog.rb +3 -3
  11. data/lib/liveblog.rb +24 -24
  12. data/lib/lowlevel.rb +35 -0
  13. data/lib/menus.rb +2 -2
  14. data/lib/processing.rb +3 -17
  15. data/lib/publish.rb +3 -6
  16. data/lib/repl.rb +3 -5
  17. data/lib/runeblog.rb +94 -21
  18. data/lib/runeblog_version.rb +6 -2
  19. data/lib/view.rb +9 -3
  20. data/runeblog.gemspec +4 -2
  21. data/test/.blogs/data/EDITOR +1 -0
  22. data/test/.blogs/data/ROOT +1 -0
  23. data/test/.blogs/data/VERSION +2 -0
  24. data/test/.blogs/data/VIEW +1 -0
  25. data/test/.blogs/data/features.txt +18 -0
  26. data/test/.blogs/data/global.lt3 +20 -0
  27. data/test/.blogs/data/sequence +1 -0
  28. data/test/.blogs/data/universal.lt3 +20 -0
  29. data/test/.blogs/views/around_austin/assets/austin-pano.jpg +0 -0
  30. data/test/.blogs/views/around_austin/assets/back-icon.png +0 -0
  31. data/test/.blogs/views/around_austin/assets/reddit-logo.png +0 -0
  32. data/test/.blogs/views/around_austin/assets/sky2.jpg +0 -0
  33. data/test/.blogs/views/around_austin/config/exper/2svg.lt3 +38 -0
  34. data/test/.blogs/views/around_austin/config/exper/gen_svg.rb +60 -0
  35. data/test/.blogs/views/around_austin/config/exper/meta.html +10 -0
  36. data/test/.blogs/views/around_austin/config/exper/s2.html +25 -0
  37. data/test/.blogs/views/around_austin/config/exper/varmint.rb +50 -0
  38. data/test/.blogs/views/around_austin/config/facebook/credentials.txt +7 -0
  39. data/test/.blogs/views/around_austin/config/facebook/facebook.rb +42 -0
  40. data/test/.blogs/views/around_austin/config/facebook/fb.html +10 -0
  41. data/test/.blogs/views/around_austin/config/facebook/fb.js.lt3 +15 -0
  42. data/test/.blogs/views/around_austin/config/reddit/credentials.txt +6 -0
  43. data/test/.blogs/views/around_austin/config/reddit/notes.txt +4 -0
  44. data/test/.blogs/views/around_austin/config/reddit/reddit_post_url.py +34 -0
  45. data/test/.blogs/views/around_austin/config/reddit/redpost.rb +38 -0
  46. data/test/.blogs/views/around_austin/config/twitter/credentials.txt +3 -0
  47. data/test/.blogs/views/around_austin/config/twitter/tw.html +12 -0
  48. data/test/.blogs/views/around_austin/config/twitter/tw.js +5 -0
  49. data/test/.blogs/views/around_austin/config/twitter/twitter.rb +35 -0
  50. data/test/.blogs/views/around_austin/data/GIT_IS_DUMB +0 -0
  51. data/test/.blogs/views/around_austin/global.lt3 +20 -0
  52. data/test/.blogs/views/around_austin/last_published +1 -0
  53. data/test/.blogs/views/around_austin/posts/GIT_IS_DUMB +1 -0
  54. data/test/.blogs/views/around_austin/remote/assets/GIT_IS_DUMB +1 -0
  55. data/test/.blogs/views/around_austin/remote/banner/navbar/GIT_IS_DUMB +0 -0
  56. data/test/.blogs/views/around_austin/remote/etc/GIT_IS_DUMB +1 -0
  57. data/test/.blogs/views/around_austin/remote/permalink/GIT_IS_DUMB +1 -0
  58. data/test/.blogs/views/around_austin/remote/widgets/ad/GIT_IS_DUMB +2 -0
  59. data/test/.blogs/views/around_austin/remote/widgets/links/GIT_IS_DUMB +2 -0
  60. data/test/.blogs/views/around_austin/remote/widgets/news/GIT_IS_DUMB +2 -0
  61. data/test/.blogs/views/around_austin/remote/widgets/pages/GIT_IS_DUMB +2 -0
  62. data/test/.blogs/views/around_austin/remote/widgets/pinned/GIT_IS_DUMB +2 -0
  63. data/test/.blogs/views/around_austin/settings/features.txt +18 -0
  64. data/test/.blogs/views/around_austin/settings/publish.txt +5 -0
  65. data/test/.blogs/views/around_austin/settings/recent.txt +11 -0
  66. data/test/.blogs/views/around_austin/settings/view.txt +4 -0
  67. data/test/.blogs/views/around_austin/themes/standard/README +59 -0
  68. data/test/.blogs/views/around_austin/themes/standard/banner/banner.lt3 +5 -0
  69. data/test/.blogs/views/around_austin/themes/standard/banner/navbar/about.lt3 +18 -0
  70. data/test/.blogs/views/around_austin/themes/standard/banner/navbar/contact.lt3 +18 -0
  71. data/test/.blogs/views/around_austin/themes/standard/banner/navbar/faq.lt3 +1 -0
  72. data/test/.blogs/views/around_austin/themes/standard/banner/navbar/list.data +3 -0
  73. data/test/.blogs/views/around_austin/themes/standard/banner/top.lt3 +20 -0
  74. data/test/.blogs/views/around_austin/themes/standard/blog/generate.lt3 +21 -0
  75. data/test/.blogs/views/around_austin/themes/standard/blog/head.lt3 +16 -0
  76. data/test/.blogs/views/around_austin/themes/standard/blog/index.lt3 +16 -0
  77. data/test/.blogs/views/around_austin/themes/standard/blog/post_entry.lt3 +21 -0
  78. data/test/.blogs/views/around_austin/themes/standard/etc/blog.css.lt3 +62 -0
  79. data/test/.blogs/views/around_austin/themes/standard/etc/externals.lt3 +24 -0
  80. data/test/.blogs/views/around_austin/themes/standard/etc/favicon.ico +0 -0
  81. data/test/.blogs/views/around_austin/themes/standard/etc/github.css +209 -0
  82. data/test/.blogs/views/around_austin/themes/standard/etc/misc.js +20 -0
  83. data/test/.blogs/views/around_austin/themes/standard/global.lt3 +20 -0
  84. data/test/.blogs/views/around_austin/themes/standard/post/generate.lt3 +39 -0
  85. data/test/.blogs/views/around_austin/themes/standard/post/head.lt3 +7 -0
  86. data/test/.blogs/views/around_austin/themes/standard/post/index.lt3 +24 -0
  87. data/test/.blogs/views/around_austin/themes/standard/post/permalink.lt3 +31 -0
  88. data/test/.blogs/views/around_austin/widgets/README +4 -0
  89. data/test/.blogs/views/around_austin/widgets/bydates/README +2 -0
  90. data/test/.blogs/views/around_austin/widgets/bydates/bydates.rb +18 -0
  91. data/test/.blogs/views/around_austin/widgets/bydates/card.css +1 -0
  92. data/test/.blogs/views/around_austin/widgets/bydates/custom.rb +1 -0
  93. data/test/.blogs/views/around_austin/widgets/bydates/main.css +2 -0
  94. data/test/.blogs/views/around_austin/widgets/links/README +2 -0
  95. data/test/.blogs/views/around_austin/widgets/links/card.css +1 -0
  96. data/test/.blogs/views/around_austin/widgets/links/custom.rb +1 -0
  97. data/test/.blogs/views/around_austin/widgets/links/links.rb +90 -0
  98. data/test/.blogs/views/around_austin/widgets/links/list.data +3 -0
  99. data/test/.blogs/views/around_austin/widgets/links/main.css +2 -0
  100. data/test/.blogs/views/around_austin/widgets/news/README +2 -0
  101. data/test/.blogs/views/around_austin/widgets/news/card.css +1 -0
  102. data/test/.blogs/views/around_austin/widgets/news/custom.rb +1 -0
  103. data/test/.blogs/views/around_austin/widgets/news/list.data +4 -0
  104. data/test/.blogs/views/around_austin/widgets/news/main.css +2 -0
  105. data/test/.blogs/views/around_austin/widgets/news/news.rb +88 -0
  106. data/test/.blogs/views/around_austin/widgets/pages/README +2 -0
  107. data/test/.blogs/views/around_austin/widgets/pages/card.css +1 -0
  108. data/test/.blogs/views/around_austin/widgets/pages/custom.rb +1 -0
  109. data/test/.blogs/views/around_austin/widgets/pages/disclaim.lt3 +10 -0
  110. data/test/.blogs/views/around_austin/widgets/pages/faq.lt3 +41 -0
  111. data/test/.blogs/views/around_austin/widgets/pages/like-dislike.lt3 +11 -0
  112. data/test/.blogs/views/around_austin/widgets/pages/list.data +4 -0
  113. data/test/.blogs/views/around_austin/widgets/pages/local.rb +0 -0
  114. data/test/.blogs/views/around_austin/widgets/pages/main.css +2 -0
  115. data/test/.blogs/views/around_austin/widgets/pages/other-stuff.lt3 +10 -0
  116. data/test/.blogs/views/around_austin/widgets/pages/pages.rb +130 -0
  117. data/test/.blogs/views/around_austin/widgets/pinned/README +2 -0
  118. data/test/.blogs/views/around_austin/widgets/pinned/card.css +1 -0
  119. data/test/.blogs/views/around_austin/widgets/pinned/custom.rb +1 -0
  120. data/test/.blogs/views/around_austin/widgets/pinned/main.css +2 -0
  121. data/test/.blogs/views/around_austin/widgets/pinned/pinned.rb +111 -0
  122. data/test/.blogs/views/around_austin/widgets/search/README +2 -0
  123. data/test/.blogs/views/around_austin/widgets/search/card.css +1 -0
  124. data/test/.blogs/views/around_austin/widgets/search/custom.rb +1 -0
  125. data/test/.blogs/views/around_austin/widgets/search/main.css +2 -0
  126. data/test/.blogs/views/around_austin/widgets/search/search.rb +18 -0
  127. data/test/.blogs/views/around_austin/widgets/sitemap/README +2 -0
  128. data/test/.blogs/views/around_austin/widgets/sitemap/card.css +1 -0
  129. data/test/.blogs/views/around_austin/widgets/sitemap/custom.rb +1 -0
  130. data/test/.blogs/views/around_austin/widgets/sitemap/main.css +2 -0
  131. data/test/.blogs/views/around_austin/widgets/sitemap/sitemap.rb +18 -0
  132. data/test/.blogs/views/around_austin/widgets/tag-cloud/OLD-example.lt3 +12 -0
  133. data/test/.blogs/views/around_austin/widgets/tag-cloud/README +2 -0
  134. data/test/.blogs/views/around_austin/widgets/tag-cloud/card.css +1 -0
  135. data/test/.blogs/views/around_austin/widgets/tag-cloud/custom.rb +1 -0
  136. data/test/.blogs/views/around_austin/widgets/tag-cloud/main.css +2 -0
  137. data/test/.blogs/views/around_austin/widgets/tag-cloud/tag-cloud.lt3 +3 -0
  138. data/test/.blogs/views/around_austin/widgets/tag-cloud/tag-cloud.rb +18 -0
  139. data/test/.blogs/widgets/README +4 -0
  140. data/test/.blogs/widgets/bydates/README +2 -0
  141. data/test/.blogs/widgets/bydates/bydates.rb +18 -0
  142. data/test/.blogs/widgets/bydates/card.css +1 -0
  143. data/test/.blogs/widgets/bydates/custom.rb +1 -0
  144. data/test/.blogs/widgets/bydates/main.css +2 -0
  145. data/test/.blogs/widgets/links/README +2 -0
  146. data/test/.blogs/widgets/links/card.css +1 -0
  147. data/test/.blogs/widgets/links/custom.rb +1 -0
  148. data/test/.blogs/widgets/links/links.rb +90 -0
  149. data/test/.blogs/widgets/links/list.data +3 -0
  150. data/test/.blogs/widgets/links/main.css +2 -0
  151. data/test/.blogs/widgets/news/README +2 -0
  152. data/test/.blogs/widgets/news/card.css +1 -0
  153. data/test/.blogs/widgets/news/custom.rb +1 -0
  154. data/test/.blogs/widgets/news/list.data +4 -0
  155. data/test/.blogs/widgets/news/main.css +2 -0
  156. data/test/.blogs/widgets/news/news.rb +88 -0
  157. data/test/.blogs/widgets/pages/README +2 -0
  158. data/test/.blogs/widgets/pages/card.css +1 -0
  159. data/test/.blogs/widgets/pages/custom.rb +1 -0
  160. data/test/.blogs/widgets/pages/disclaim.lt3 +10 -0
  161. data/test/.blogs/widgets/pages/faq.lt3 +41 -0
  162. data/test/.blogs/widgets/pages/like-dislike.lt3 +11 -0
  163. data/test/.blogs/widgets/pages/list.data +4 -0
  164. data/test/.blogs/widgets/pages/local.rb +0 -0
  165. data/test/.blogs/widgets/pages/main.css +2 -0
  166. data/test/.blogs/widgets/pages/other-stuff.lt3 +10 -0
  167. data/test/.blogs/widgets/pages/pages.rb +130 -0
  168. data/test/.blogs/widgets/pinned/README +2 -0
  169. data/test/.blogs/widgets/pinned/card.css +1 -0
  170. data/test/.blogs/widgets/pinned/custom.rb +1 -0
  171. data/test/.blogs/widgets/pinned/main.css +2 -0
  172. data/test/.blogs/widgets/pinned/pinned.rb +111 -0
  173. data/test/.blogs/widgets/search/README +2 -0
  174. data/test/.blogs/widgets/search/card.css +1 -0
  175. data/test/.blogs/widgets/search/custom.rb +1 -0
  176. data/test/.blogs/widgets/search/main.css +2 -0
  177. data/test/.blogs/widgets/search/search.rb +18 -0
  178. data/test/.blogs/widgets/sitemap/README +2 -0
  179. data/test/.blogs/widgets/sitemap/card.css +1 -0
  180. data/test/.blogs/widgets/sitemap/custom.rb +1 -0
  181. data/test/.blogs/widgets/sitemap/main.css +2 -0
  182. data/test/.blogs/widgets/sitemap/sitemap.rb +18 -0
  183. data/test/.blogs/widgets/tag-cloud/OLD-example.lt3 +12 -0
  184. data/test/.blogs/widgets/tag-cloud/README +2 -0
  185. data/test/.blogs/widgets/tag-cloud/card.css +1 -0
  186. data/test/.blogs/widgets/tag-cloud/custom.rb +1 -0
  187. data/test/.blogs/widgets/tag-cloud/main.css +2 -0
  188. data/test/.blogs/widgets/tag-cloud/tag-cloud.lt3 +3 -0
  189. data/test/.blogs/widgets/tag-cloud/tag-cloud.rb +18 -0
  190. data/test/austin.rb +8 -3
  191. metadata +176 -6
@@ -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
@@ -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,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/"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