runeblog 0.1.98 → 0.1.99

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: 0fd9b65f6c0b86016976c411fdb3908a3ad6f9047ab947212ff85d0e9b62d9e1
4
- data.tar.gz: 1e9eb6d52e34fa23e032cb80d0c83fec8cbf559b26c695ba235768b87baf77b9
3
+ metadata.gz: aec5b477d7f2cb604623e089adbaae8bb87d5ddcb784ebc3d2935aa02892e9d1
4
+ data.tar.gz: f3a03f9555b4bc7a4d9e6149e0cd9606e1d1269ceb184cac04e8d579797647ff
5
5
  SHA512:
6
- metadata.gz: c96232d21239e2f17a31c09378095a81d29d4c18a7f29c8355d98964ef7aa86bfc8d2d20976cf1c2c8095d9c3c686f4b6f1df0ff2d279072aecf058f88839d37
7
- data.tar.gz: ba17a16608da8f83145ed92e7188dec1625d25f555ef1fc5849644b554b9196a4b7d765175e5c5ca49646eee36365298fda06e36b0a493361eb2e86df95dd9dd
6
+ metadata.gz: 2956b5197b0d57215fdf7701eb3369755cdc04494b357b0dbfe538e8614c8f41f643f78cd26e67d6687a925a47b9486f6375af0d3a16810d2598625b7156ae0e
7
+ data.tar.gz: f788243f1c0c1802ecc99218de1d92f87d51a67093f8d31fbf330a8825b43e8c70f478c6b756c993a295f26c76dbe0dbcd5e7d3a9d4fa39e3b22bd365cc1c482
data/lib/liveblog.rb CHANGED
@@ -5,7 +5,7 @@ require 'date'
5
5
  require 'livetext'
6
6
  require 'runeblog'
7
7
 
8
- errfile = File.new("liveblog.out", "w")
8
+ errfile = File.new("/tmp/liveblog.out", "w")
9
9
  STDERR.reopen(errfile)
10
10
 
11
11
  def init_liveblog # FIXME - a lot of this logic sucks
@@ -28,12 +28,6 @@ def post
28
28
  _out " <!-- Post number #{@meta.num} -->\n "
29
29
  end
30
30
 
31
- def _view_from_cwd
32
- md = Dir.pwd.match(%r[.*/views/(.*?)/])
33
- return md[1] if md
34
- nil
35
- end
36
-
37
31
  def quote
38
32
  _passthru "<blockquote>"
39
33
  _passthru _body
@@ -60,11 +54,68 @@ def h6; _passthru "<h6>#{@_data}</h6>"; end
60
54
 
61
55
  def hr; _passthru "<hr>"; end
62
56
 
63
- def emit # send to STDOUT?
64
- @emit = true
65
- case _args.first
66
- when "off"; @emit = false
67
- when "on"; @emit = true
57
+ def list
58
+ _out "<ul>"
59
+ _body {|line| _out "<li>#{line}</li>" }
60
+ _out "</ul>"
61
+ _optional_blank_line
62
+ end
63
+
64
+ def list!
65
+ _out "<ul>"
66
+ lines = _body.each
67
+ loop do
68
+ line = lines.next
69
+ line = _format(line)
70
+ if line[0] == " "
71
+ _out line
72
+ else
73
+ _out "<li>#{line}</li>"
74
+ end
75
+ end
76
+ _out "</ul>"
77
+ _optional_blank_line
78
+ end
79
+
80
+ def html_body(file)
81
+ file.puts "<html>\n <body>"
82
+ yield
83
+ file.puts " </body>\n</html>"
84
+ end
85
+
86
+ def make_magic_links
87
+ # FIXME remember strings may not be safe
88
+ line = _data.chomp
89
+ input, cardfile, mainfile, card_title = *line.split(" ", 4)
90
+ pairs = File.readlines(input).map {|line| line.chomp.split(",", 2) }
91
+ # HTML for main area (iframe)
92
+ File.open("#{mainfile}.html", "w") do |f|
93
+ html_body(f) do
94
+ f.puts "<h1>#{card_title}</h1>"
95
+ pairs.each {|file, title| f.puts %[<a href="#{file}">#{title}</a> <br>] }
96
+ end
97
+ end
98
+ # HTML for sidebar card
99
+ File.open("#{cardfile}.html", "w") do |f|
100
+ f.puts <<-EOS
101
+ <div class="card mb-3">
102
+ <div class="card-body">
103
+ <h5 class="card-title">
104
+ <a href="javascript: void(0)"
105
+ onclick="javascript:open_main('#{mainfile}')"
106
+ style="text-decoration: none; color: black">#{card_title}</a>
107
+ </h5>
108
+ EOS
109
+ pairs.each do |file, title|
110
+ f.puts <<-EOS
111
+ <li class="list-group-item"> <a href="javascript: void(0)"
112
+ onclick="javascript:open_main('#{file}')">#{title}</a> </li>
113
+ EOS
114
+ end
115
+ f.puts <<-EOS
116
+ </div>
117
+ </div>
118
+ EOS
68
119
  end
69
120
  end
70
121
 
@@ -164,29 +215,6 @@ def pin
164
215
  _optional_blank_line
165
216
  end
166
217
 
167
- def list
168
- _out "<ul>"
169
- _body {|line| _out "<li>#{line}</li>" }
170
- _out "</ul>"
171
- _optional_blank_line
172
- end
173
-
174
- def list!
175
- _out "<ul>"
176
- lines = _body.each
177
- loop do
178
- line = lines.next
179
- line = _format(line)
180
- if line[0] == " "
181
- _out line
182
- else
183
- _out "<li>#{line}</li>"
184
- end
185
- end
186
- _out "</ul>"
187
- _optional_blank_line
188
- end
189
-
190
218
  def write_post
191
219
  raise "'post' was not called" unless @meta
192
220
  save = Dir.pwd
@@ -277,6 +305,8 @@ class Livetext::Functions
277
305
  end
278
306
  end
279
307
 
308
+ ###
309
+
280
310
  def _var(name) # FIXME scope issue!
281
311
  ::Livetext::Vars[name] || "[:#{name} is undefined]"
282
312
  end
@@ -367,12 +397,12 @@ end
367
397
  def sidebar
368
398
  _out %[<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">]
369
399
  _body do |line|
370
- tag = line.chomp.strip
371
- source = "sidebar/#{tag.downcase}.lt3"
372
- unless File.exist?(source)
373
- source = "widgets/#{tag.downcase}.lt3"
400
+ tag = line.chomp.strip.downcase
401
+ Dir.chdir("widgets/#{tag}") do
402
+ source = "#{tag}.lt3"
403
+ livetext source, "/dev/null"
404
+ _include_file "card-#{source}.html"
374
405
  end
375
- _include_file source
376
406
  end
377
407
  _out %[</div>]
378
408
  end
@@ -457,7 +487,7 @@ def all_teasers
457
487
  end
458
488
  text << "</body></html>"
459
489
  File.write("recent.html", text)
460
- _out %[<iframe id="main" style="width: 100vw;height: 100vh;position: relative;" src='recent.html' width=100% frameborder="0" allowfullscreen></iframe>]
490
+ _out %[<iframe id="main" style="width: 100vw; height: 100vh; position: relative;" src='recent.html' width=100% frameborder="0" allowfullscreen></iframe>]
461
491
  end
462
492
 
463
493
  def _post_lookup(postid) # side-effect
@@ -547,7 +577,9 @@ def card1
547
577
  end
548
578
 
549
579
  def card2
550
- card_title = _data
580
+ str = _data
581
+ file, card_title = str.chomp.split(" ", 2)
582
+ card_title = %[<a #{_main(file)} style="text-decoration: none; color: black">#{card_title}</a>]
551
583
 
552
584
  # FIXME is this wrong??
553
585
 
@@ -555,7 +587,6 @@ def card2
555
587
  <div class="card mb-3">
556
588
  <div class="card-body">
557
589
  <h5 class="card-title">#{card_title}</h5>
558
- </div>
559
590
  <ul class="list-group list-group-flush">
560
591
  HTML
561
592
  _out open
@@ -564,7 +595,7 @@ def card2
564
595
  main = _main(url)
565
596
  _out %[<li class="list-group-item"><a #{main}}">#{cdata}</a> </li>]
566
597
  end
567
- close = %[ </ul>\n </div>]
598
+ close = %[ </ul>\n </div>\n </div>]
568
599
  _out close
569
600
  end
570
601
 
@@ -2,7 +2,7 @@
2
2
  if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
3
3
 
4
4
  class RuneBlog
5
- VERSION = "0.1.98"
5
+ VERSION = "0.1.99"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
@@ -1,4 +1,6 @@
1
1
  .recent_posts
2
2
 
3
- .sidebar! ad news calendar tag-cloud
3
+ .sidebar! news ad tag-cloud
4
+
5
+ . for now, skip: ad calendar tag-cloud
4
6
 
@@ -0,0 +1,3 @@
1
+ Should sidebar/ be deleted?
2
+ Or should it serve to show which widgets are being used?
3
+ Probably needs to be there for URLs? Not sure.
@@ -0,0 +1,11 @@
1
+ . This is the "card" (sidebar) version.
2
+
3
+ . In real life, there may be complex code here
4
+ . referencing some advertiser or ad network
5
+ . which will bring up a random ad.
6
+
7
+ .card1 Advertisement
8
+ Build your amazing website with blabla.com.
9
+ https://google.com/,btn btn-light float-right,Visit Page
10
+ .end
11
+
@@ -0,0 +1,12 @@
1
+ .set classname="btn btn-light float-right"
2
+ .set card.title="Advertisement"
3
+ .set card.text="Build your amazing website with blabla.com."
4
+ .set extra="bg-dark text-white"
5
+
6
+ <div class="card #{_var[:extra]} mb-3">
7
+ <div class="card-body">
8
+ <h5 class="card-title">#{_var["card.title"]}</h5>
9
+ <p class="card-text">#{_var["card.text"]}</p>
10
+ <a #{main} class="#{classname}">#{_var["card.text"]}</a>
11
+ </div>
12
+ </div>
@@ -0,0 +1,17 @@
1
+ <div class="card mb-3">
2
+ <div class="card-body">
3
+ <h5 class="card-title">
4
+ <a href="javascript: void(0)"
5
+ onclick="javascript:open_main('main-news')"
6
+ style="text-decoration: none; color: black">Recent News</a>
7
+ </h5>
8
+ <li class="list-group-item"> <a href="javascript: void(0)"
9
+ onclick="javascript:open_main('https://techcrunch.com/2019/09/16/fossa-scores-8-5-million-series-a-to-help-enterprise-manage-open-source-licenses/')">FOSSA scores \$8.5 million Series A to help enterprise manage open-source licenses</a> </li>
10
+ <li class="list-group-item"> <a href="javascript: void(0)"
11
+ onclick="javascript:open_main('https://techcrunch.com/2019/09/17/spacexs-orbital-starship-prototype-construction-progress-detailed-in-new-photos/')">SpaceX’s orbital Starship prototype construction progress detailed in new photos</a> </li>
12
+ <li class="list-group-item"> <a href="javascript: void(0)"
13
+ onclick="javascript:open_main('https://developers.googleblog.com/2019/05/Flutter-io19.html')">Flutter: a Portable UI Framework for Mobile, Web, Embedded, and Desktop</a> </li>
14
+ <li class="list-group-item"> <a href="javascript: void(0)"
15
+ onclick="javascript:open_main('https://jaycarlson.net/microcontrollers/')">The Amazing \$1 Microcontroller (2017)</a> </li>
16
+ </div>
17
+ </div>
@@ -1,7 +1,4 @@
1
- .card2 Recent News
2
- https://techcrunch.com/2019/09/16/fossa-scores-8-5-million-series-a-to-help-enterprise-manage-open-source-licenses/,FOSSA scores $8.5 million Series A to help enterprise manage open-source licenses
1
+ https://techcrunch.com/2019/09/16/fossa-scores-8-5-million-series-a-to-help-enterprise-manage-open-source-licenses/,FOSSA scores \$8.5 million Series A to help enterprise manage open-source licenses
3
2
  https://techcrunch.com/2019/09/17/spacexs-orbital-starship-prototype-construction-progress-detailed-in-new-photos/,SpaceX’s orbital Starship prototype construction progress detailed in new photos
4
3
  https://developers.googleblog.com/2019/05/Flutter-io19.html,Flutter: a Portable UI Framework for Mobile, Web, Embedded, and Desktop
5
- https://jaycarlson.net/microcontrollers/,The Amazing $1 Microcontroller (2017)
6
- .end
7
-
4
+ https://jaycarlson.net/microcontrollers/,The Amazing \$1 Microcontroller (2017)
@@ -0,0 +1,9 @@
1
+ <html>
2
+ <body>
3
+ <h1>Recent News</h1>
4
+ <a href="https://techcrunch.com/2019/09/16/fossa-scores-8-5-million-series-a-to-help-enterprise-manage-open-source-licenses/">FOSSA scores \$8.5 million Series A to help enterprise manage open-source licenses</a> <br>
5
+ <a href="https://techcrunch.com/2019/09/17/spacexs-orbital-starship-prototype-construction-progress-detailed-in-new-photos/">SpaceX’s orbital Starship prototype construction progress detailed in new photos</a> <br>
6
+ <a href="https://developers.googleblog.com/2019/05/Flutter-io19.html">Flutter: a Portable UI Framework for Mobile, Web, Embedded, and Desktop</a> <br>
7
+ <a href="https://jaycarlson.net/microcontrollers/">The Amazing \$1 Microcontroller (2017)</a> <br>
8
+ </body>
9
+ </html>
@@ -0,0 +1,4 @@
1
+ .mixin liveblog
2
+ .nopara
3
+ .make_magic_links list.data card-news main-news Recent News
4
+ .end
@@ -1,4 +1,4 @@
1
- .card_iframe
1
+ .card_iframe
2
2
  <h1>Pages</h1>
3
3
 
4
4
  .def make_links
@@ -15,4 +15,4 @@
15
15
  .make_links
16
16
 
17
17
  .include generated.lt3
18
- .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.1.98
4
+ version: 0.1.99
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-09-17 00:00:00.000000000 Z
11
+ date: 2019-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -94,11 +94,15 @@ files:
94
94
  - themes/standard/post/head.lt3
95
95
  - themes/standard/post/index.lt3
96
96
  - themes/standard/post/permalink.lt3
97
- - themes/standard/sidebar/ad.lt3
98
- - themes/standard/sidebar/calendar.lt3
99
- - themes/standard/sidebar/news.lt3
100
- - themes/standard/sidebar/tag-cloud.lt3
97
+ - themes/standard/sidebar/README
101
98
  - themes/standard/widgets/README
99
+ - themes/standard/widgets/ad/ad.lt3
100
+ - themes/standard/widgets/ad/ad2.lt3
101
+ - themes/standard/widgets/calendar/calendar.lt3
102
+ - themes/standard/widgets/news/card-news.html
103
+ - themes/standard/widgets/news/list.data
104
+ - themes/standard/widgets/news/main-news.html
105
+ - themes/standard/widgets/news/news.lt3
102
106
  - themes/standard/widgets/pages/README
103
107
  - themes/standard/widgets/pages/disclaim.lt3
104
108
  - themes/standard/widgets/pages/faq.lt3
@@ -108,6 +112,7 @@ files:
108
112
  - themes/standard/widgets/pages/list.data
109
113
  - themes/standard/widgets/pages/main.html
110
114
  - themes/standard/widgets/pages/main.lt3
115
+ - themes/standard/widgets/tag-cloud/tag-cloud.lt3
111
116
  homepage: https://github.com/Hal9000/runeblog
112
117
  licenses:
113
118
  - Ruby
@@ -1,5 +0,0 @@
1
- .card1 Advertisement
2
- Build your amazing website with blabla.com.
3
- https://google.com/,btn btn-light float-right,Visit Page
4
- .end
5
-