runeblog 0.2.38 → 0.2.39

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: 703ba416efcf4467ac20d3a9e37084c49004b48fae50adeb25beb1ec013a4d0a
4
- data.tar.gz: ac0c5e8a64578169f7faa3c729baaecb6a83ea28d9639d8ea74b49b42ada943a
3
+ metadata.gz: caacbdabded61281f3fd6cab3f627a5b014e896381f2b73e070f0aa64630b4d7
4
+ data.tar.gz: e1d37b1f874ef57568d710ab90a93977491327b40d140987f9a120ad87fb4642
5
5
  SHA512:
6
- metadata.gz: 8080cbdaedbb3795cf8f3c1e3fef03ed44633423d41471bc7a8632f57b65ca9a01a82843a4324a75abd1e9b241db5f9b3d47c21f09ef23788cc86a240083bd8e
7
- data.tar.gz: d4abe4cc7ea9af24a93416a567e6286fa4a3b8cfe6356c4e633337bff1413f9fab83e3ca60d1cea6790aa50cfca2e12593dbf7fdb392011ff86c30545c10cb41
6
+ metadata.gz: ed10a449202c4ca21d228d11eea08aa6c65693c3dd9e81498a368b0a362f341726a141fc878e31c7cf07573c1858d6aa70cdbb08fcb29043d62cd734153dffe3
7
+ data.tar.gz: a95f146d7bb55ae8a115f495423c0287453e8cdb0335c3615c5cfae4d77c842cb417bc1f763d972f2b241d6ac7f463e3b823be1789bb5b026f49745680b261d2
@@ -1,8 +0,0 @@
1
- # Custom code for 'pages' widget
2
-
3
- children = Dir["*.lt3"] - ["pages.lt3"]
4
- children.each do |child|
5
- dest = child.sub(/.lt3$/, ".html")
6
- xlate src: child, dst: dest # , debug: true
7
- end
8
-
@@ -0,0 +1,21 @@
1
+ # Custom code for 'pages' widget
2
+
3
+ # How to update repl code?
4
+
5
+ class ::RuneBlog::Widget
6
+ class Pages
7
+ def self.build
8
+ children = Dir["*.lt3"] - ["pages.lt3"]
9
+ children.each do |child|
10
+ dest = child.sub(/.lt3$/, ".html")
11
+ xlate src: child, dst: dest, debug: true
12
+ end
13
+ end
14
+
15
+ def self.edit_menu
16
+ end
17
+
18
+ def self.refresh
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,8 @@
1
+ .set card.title=Pages
2
+
3
+ <html>
4
+ <head>
5
+ <style src="main.css"></style>
6
+ </head>
7
+ <body>
8
+ <h1>$card.title</h1>
@@ -319,9 +319,14 @@ def recent_posts # side-effect
319
319
  HTML
320
320
  end
321
321
 
322
- def _run_local(widget)
322
+ def _load_local(widget)
323
323
  Dir.chdir("widgets/#{widget}") do
324
- require("./local") if File.exist?("local.rb")
324
+ # STDERR.puts "loadCP1 widget = #{widget.inspect} pwd = #{Dir.pwd}"
325
+ found = (require("./#{widget}") if File.exist?("#{widget}.rb"))
326
+ # STDERR.puts "loadCP2 found = #{found}"
327
+ code = found ? ::RuneBlog::Widget.class_eval(widget.capitalize) : nil
328
+ # STDERR.puts "loadCP3 code = #{code.inspect}"
329
+ code
325
330
  end
326
331
  rescue => err
327
332
  STDOUT.puts err
@@ -342,7 +347,8 @@ def sidebar
342
347
  raise "Can't find #{wtag}" unless Dir.exist?(wtag)
343
348
  tcard = "#{tag}-card.html"
344
349
 
345
- _run_local(tag)
350
+ code = _load_local(tag)
351
+ code && Dir.chdir(wtag) { code.build }
346
352
 
347
353
  # if File.exist?(wtag/"SUBFILES")
348
354
  # children = Dir[wtag/"*.lt3"] - [wtag/tag+".lt3"]
@@ -623,9 +629,40 @@ def page_type(tag, title)
623
629
  end
624
630
  end
625
631
 
632
+ def _write_main_pages(mainfile, pairs, card_title, tag)
633
+ local = _local_tag?(tag)
634
+ pieces = @blog.view.dir/"themes/standard/widgets"/tag/:pieces
635
+ main_head = xlate! cwd: pieces, src: "main-head.lt3"
636
+ main_tail = xlate! cwd: pieces, src: "main-tail.lt3"
637
+ # ^ make into methods in pages.rb or whatever?
638
+
639
+ File.open("#{mainfile}.html", "w") do |f|
640
+ f.puts main_head
641
+ pairs.each do |file, title|
642
+ type, title = page_type(tag, title)
643
+ title = title.gsub(/\\/, "") # kludge
644
+ case type
645
+ when :local; url_ref = _widget_main(file, tag) # local always frameable
646
+ when :frame; url_ref = "href = '#{file}'" # local always frameable
647
+ when :noframe; url_ref = _blank(file) # local always frameable
648
+ end
649
+ css = "color: #8888FF; text-decoration: none; font-size: 24px; font-family: verdana"
650
+ f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
651
+ end
652
+ f.puts main_tail
653
+ end
654
+ end
655
+
626
656
  def _write_main(mainfile, pairs, card_title, tag)
627
657
  log!(str: "Creating #{mainfile}.html", pwd: true)
658
+
659
+ if tag == "pages" # temporary experiment
660
+ _write_main_pages(mainfile, pairs, card_title, tag)
661
+ return
662
+ end
663
+
628
664
  local = _local_tag?(tag)
665
+ setvar "card.title", card_title
629
666
  File.open("#{mainfile}.html", "w") do |f|
630
667
  _html_body(f) do
631
668
  f.puts "<h1>#{card_title}</h1>"
@@ -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.38"
5
+ VERSION = "0.2.39"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
@@ -35,3 +35,8 @@ LEXT = ".lt3"
35
35
  end
36
36
  end
37
37
 
38
+ def xlate!(cwd: Dir.pwd, src:, copy: nil, debug: false, force: false)
39
+ output = "/tmp/xlate-#{File.basename(src).sub(/.lt3$/, "")}"
40
+ xlate cwd: cwd, src: src, dst: output, debug: debug, force: force
41
+ File.read(output + ".html") # return all content as string
42
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runeblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.38
4
+ version: 0.2.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
@@ -68,7 +68,6 @@ files:
68
68
  - empty_view/remote/permalink/GIT_IS_DUMB
69
69
  - empty_view/remote/widgets/links/list.data
70
70
  - empty_view/remote/widgets/news/list.data
71
- - empty_view/remote/widgets/pages/SUBFILES
72
71
  - empty_view/remote/widgets/pages/list.data
73
72
  - empty_view/themes/standard/README
74
73
  - empty_view/themes/standard/blog/generate.lt3
@@ -102,6 +101,13 @@ files:
102
101
  - empty_view/themes/standard/widgets/pages/local.rb
103
102
  - empty_view/themes/standard/widgets/pages/other-stuff.lt3
104
103
  - empty_view/themes/standard/widgets/pages/pages.lt3
104
+ - empty_view/themes/standard/widgets/pages/pages.rb
105
+ - empty_view/themes/standard/widgets/pages/pieces/card-head.lt3
106
+ - empty_view/themes/standard/widgets/pages/pieces/card-tail.lt3
107
+ - empty_view/themes/standard/widgets/pages/pieces/card.css
108
+ - empty_view/themes/standard/widgets/pages/pieces/main-head.lt3
109
+ - empty_view/themes/standard/widgets/pages/pieces/main-tail.lt3
110
+ - empty_view/themes/standard/widgets/pages/pieces/main.css
105
111
  - empty_view/themes/standard/widgets/tag-cloud/tag-cloud.lt3
106
112
  - lib/Javascript.stuff
107
113
  - lib/default.rb
@@ -1 +0,0 @@
1
- Causes other *.lt3 files to be generated