runeblog 0.2.43 → 0.2.48

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/bin/blog +8 -10
  3. data/empty_view/assets/austin-pano.jpg +0 -0
  4. data/empty_view/themes/standard/blog/generate.lt3 +5 -3
  5. data/empty_view/themes/standard/blog/post_entry.lt3 +14 -10
  6. data/empty_view/themes/standard/etc/blog.css.lt3 +18 -0
  7. data/empty_view/themes/standard/navbar/faq.lt3 +1 -0
  8. data/empty_view/themes/standard/navbar/navbar.lt3 +1 -0
  9. data/empty_view/themes/standard/widgets/ad/ad.lt3 +8 -1
  10. data/empty_view/themes/standard/widgets/ad/ad1.png +0 -0
  11. data/empty_view/themes/standard/widgets/ad/ad2.png +0 -0
  12. data/empty_view/themes/standard/widgets/ad/ad3.png +0 -0
  13. data/empty_view/themes/standard/widgets/ad/ad4.png +0 -0
  14. data/empty_view/themes/standard/widgets/bydates/bydates.rb +7 -3
  15. data/empty_view/themes/standard/widgets/links/links.rb +28 -3
  16. data/empty_view/themes/standard/widgets/news/news.rb +7 -3
  17. data/empty_view/themes/standard/widgets/pages/pages.rb +10 -3
  18. data/empty_view/themes/standard/widgets/pinned/pinned.rb +7 -3
  19. data/empty_view/themes/standard/widgets/search/search.rb +7 -3
  20. data/empty_view/themes/standard/widgets/sitemap/sitemap.rb +7 -3
  21. data/empty_view/themes/standard/widgets/tag-cloud/tag-cloud.rb +7 -3
  22. data/lib/default.rb +1 -1
  23. data/lib/global.rb +15 -40
  24. data/lib/helpers-blog.rb +15 -44
  25. data/lib/liveblog.rb +86 -62
  26. data/lib/logging.rb +17 -8
  27. data/lib/post.rb +24 -20
  28. data/lib/publish.rb +4 -5
  29. data/lib/repl.rb +52 -11
  30. data/lib/runeblog.rb +115 -93
  31. data/lib/runeblog_version.rb +1 -1
  32. data/lib/view.rb +2 -9
  33. data/lib/xlate.rb +34 -33
  34. data/test/austin.rb +31 -20
  35. metadata +8 -5
  36. data/empty_view/remote/widgets/links/list.data +0 -3
  37. data/empty_view/remote/widgets/news/list.data +0 -4
  38. data/empty_view/remote/widgets/pages/list.data +0 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16662b0b5b8ec9310e57c63c336fe13bdde1612a4b1dc0a8ffdaab0a2982db1f
4
- data.tar.gz: 93aeb315ce95b26a4aee96350fb20abf081b95af69873e57ed1e1310f8a4416b
3
+ metadata.gz: d4bd7b67f736b85651eb0650c5af974cbcf74fce48be345920e9bac4c9dba9dd
4
+ data.tar.gz: 5fda0c05a32e16103e7f7f31b7ffe104c307b63c2e14e96216644dfbc6fdefff
5
5
  SHA512:
6
- metadata.gz: 0fb2ef08e58378caa049c6b5a274f3cb6928f9e09dc9a54d5cf5fdd613fed0c473d249dbb2d43b99baf76ae209a343ab70cb89db75e26f082284db1737c967a8
7
- data.tar.gz: a35443b76f177cc48457acebdea57fcc9909edd49af992c7eb3ce8d15a7308855c08992385b9dbae0ae9b429646e052210576733e76d835e3717e4214f61e123
6
+ metadata.gz: 55b9141f9b2d0d7a06cb5134d1e1da871cd78c2dffa7502310d0ae0caedec7c27eabfa28dc7957754f611122283abc2bc833512e58f9414a541b87d8cf4e146f
7
+ data.tar.gz: 60b1546750066d75a623a3ca7866b5f5307b31e14a806a85f726fe87507ab1c3d24c5ce7737742ffdb3e41fb7cbcb0eac244089c9f96efddc6534299e9ab9ef1
data/bin/blog CHANGED
@@ -16,15 +16,15 @@ def get_started
16
16
  puts
17
17
  puts fx(<<-TEXT, :bold)
18
18
  Blog repo successfully created.
19
- You can create views with the command: new view
20
- Create a post within the current view: new post
21
- You can't publish until you set up the publish file
22
- via the config command.
19
+ For help, type h or help.
20
+ Create views with: new view
21
+ Create a post (within current view): new post
23
22
  TEXT
24
23
  end
25
24
 
26
25
  def mainloop
27
- print fx("#{@blog.view}> ", Red, :bold)
26
+ info = @blog.view || "no view"
27
+ print fx("[#{info}] ", Red, :bold)
28
28
  cmd = STDSCR.gets(history: @cmdhist, tab: @tabcom)
29
29
  cmd_quit(nil) if cmd.nil? # ^D
30
30
  cmd.chomp!
@@ -55,9 +55,7 @@ if ! RuneBlog.exist?
55
55
  print fx("\n No blog repo found. Create new one? (y/n): ", :bold)
56
56
  response = gets.chomp
57
57
  if response.downcase == "y"
58
- print fx("\n Enter default view name: ", :bold)
59
- view_name = gets.chomp
60
- RuneBlog.create_new_blog_repo(view_name)
58
+ RuneBlog.create_new_blog_repo
61
59
  get_started
62
60
  else
63
61
  exit
@@ -75,7 +73,7 @@ puts fx("\n RuneBlog", :bold), fx(" v #{RuneBlog::VERSION}\n", Red)
75
73
 
76
74
  loop { mainloop }
77
75
 
78
- # sleep 0.2
79
- # system("tput clear")
76
+ system("tput clear")
77
+ sleep 0.2
80
78
  puts
81
79
 
@@ -14,16 +14,18 @@
14
14
  .include blog/head.lt3
15
15
  <body>
16
16
 
17
+ .set color = #101035
18
+
17
19
  . FIXME
18
- <table width=100%>
20
+ <table width=100% bgcolor=$color>
19
21
  <tr>
20
- <td width=30% bgcolor=black>
22
+ <td width=30% bgcolor=$color>
21
23
  <div style="text-align: center; color: white">
22
24
  <h1>Around Austin</h1><br>
23
25
  The view from downtown...
24
26
  </div>
25
27
  </td>
26
- <td><img src=assets/sky2.jpg width=100%></img>
28
+ <td><img src=assets/austin-pano.jpg width=100%></img>
27
29
  </tr>
28
30
  </table>
29
31
 
@@ -2,21 +2,25 @@
2
2
  . This HTML fragment gives the format of a post's
3
3
  . "index" entry (recent posts on blog front page).
4
4
  . --------------------------------------------------
5
+ .nopara
5
6
 
6
7
  <div class="post">
7
- <table width=100%>
8
+ <table width=100% cellpadding=7>
8
9
  <tr>
9
- <td width=12% valign=top>
10
- <span class="post-date mt-1 mb-1">
11
- <b>#{date}</b>
12
- </span>
10
+ <td width=14% valign=top align=right style="margin-top: -1px;">
11
+ <!-- <span class="post-date mt-1 mb-1" style="margin-top: 3px; text-align: right"> -->
12
+ <font size=-1>#{date}</font>
13
+ <!-- </span> -->
13
14
  </td>
14
- <td> <!-- <span class="post-title-box"> -->
15
- <span class="post-title-text"><a href="#{url}">#{title}</a></span>
16
- <b>#{teaser_text}</b>
17
- <br>
18
- <a style="text-decoration: none" href="#{url}"><small>Keep reading...</small></a></p> <!-- </span> -->
15
+ <td>
16
+ <!-- <span class="post-title-box"> -->
17
+ <span class="post-title-text"><a href="#{url}" style="margin-top: -5px">#{title}</a></span>
18
+ <b>#{teaser_text}</b>&nbsp;&nbsp;
19
+ <a style="text-decoration: none" href="#{url}"><small>Keep reading...</small></a>
20
+ <!-- </span> -->
19
21
  </td>
20
22
  </tr>
21
23
  </table>
22
24
  </div>
25
+
26
+ <font size=-4><br></font>
@@ -40,3 +40,21 @@
40
40
  text-align: top;
41
41
  }
42
42
 
43
+ \.mydrop {
44
+ color: #444444;
45
+ float: left;
46
+ text-align: top;
47
+ # font-family: Verdana;
48
+ font-size: 38px;
49
+ line-height: 38px;
50
+ # padding-top: 0px;
51
+ padding-right: 8px;
52
+ padding-left: 3px;
53
+ }
54
+
55
+ . not used?
56
+ \.thumbnail img {
57
+ max-height: 100%;
58
+ max-width: 100%;
59
+ }
60
+
@@ -0,0 +1 @@
1
+ .include ../widgets/pages/faq.lt3
@@ -12,5 +12,6 @@
12
12
  index Home
13
13
  about About
14
14
  contact Contact
15
+ faq FAQ
15
16
  .end
16
17
 
@@ -1,15 +1,22 @@
1
1
  . In real life, ads won't work this way...
2
2
 
3
+ .include vars.lt3
4
+
3
5
  .set classname="btn btn-light float-right"
4
6
  .set card.title="Advertisement"
5
7
  .set card.text="Build your amazing website with blabla.com."
6
- .set extra="bg-dark text-white"
8
+ . set extra="bg-dark text-white"
9
+
10
+ <!-- "$ad.image" -->
7
11
 
8
12
  <div class="card $extra mb-3">
9
13
  <div class="card-body">
14
+ <!--
10
15
  <h5 class="card-title">$card.title</h5>
11
16
  <p class="card-text">$card.text</p>
12
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>
13
20
  </div>
14
21
  </div>
15
22
 
@@ -2,13 +2,17 @@
2
2
 
3
3
  class ::RuneBlog::Widget
4
4
  class Bydates
5
- def self.build
5
+ def initialize(repo)
6
+ @blog = repo
6
7
  end
7
8
 
8
- def self.edit_menu
9
+ def build
9
10
  end
10
11
 
11
- def self.refresh
12
+ def edit_menu
13
+ end
14
+
15
+ def refresh
12
16
  end
13
17
  end
14
18
  end
@@ -1,14 +1,39 @@
1
1
  # Custom code for 'links' widget
2
2
 
3
+ require 'liveblog'
4
+
3
5
  class ::RuneBlog::Widget
4
6
  class Links
5
- def self.build
7
+ Type = "links"
8
+
9
+ def initialize(repo)
10
+ @blog = repo
11
+ end
12
+
13
+ def build
14
+ input = "list.data"
15
+ lines = File.readlines(input)
16
+ data = lines.map! {|x| x.chomp.split(/, */, 3) }
17
+ css = "* { font-family: verdana }"
18
+ card_title = "External Links" # FIXME
19
+ File.open("#{Type}-main.html", "w") do |f|
20
+ _html_body(f, css) do
21
+ f.puts "<h1>#{card_title}</h1><br><hr>"
22
+ url_ref = nil
23
+ data.each do |url, frameable, title|
24
+ url_ref = (frameable == "yes") ? "href = '#{url}'" : _blank(url)
25
+ css = "color: #8888FF; text-decoration: none; font-size: 21px" # ; font-family: verdana"
26
+ f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
27
+ end
28
+ end
29
+ end
30
+ # remember -card also
6
31
  end
7
32
 
8
- def self.edit_menu
33
+ def edit_menu
9
34
  end
10
35
 
11
- def self.refresh
36
+ def refresh
12
37
  end
13
38
  end
14
39
  end
@@ -2,13 +2,17 @@
2
2
 
3
3
  class ::RuneBlog::Widget
4
4
  class News
5
- def self.build
5
+ def initialize(repo)
6
+ @blog = repo
6
7
  end
7
8
 
8
- def self.edit_menu
9
+ def build
9
10
  end
10
11
 
11
- def self.refresh
12
+ def edit_menu
13
+ end
14
+
15
+ def refresh
12
16
  end
13
17
  end
14
18
  end
@@ -4,18 +4,25 @@
4
4
 
5
5
  class ::RuneBlog::Widget
6
6
  class Pages
7
- def self.build
7
+ def initialize(repo)
8
+ @blog = repo
9
+ end
10
+
11
+ def build
12
+ # build child pages
8
13
  children = Dir["*.lt3"] - ["pages.lt3"]
9
14
  children.each do |child|
10
15
  dest = child.sub(/.lt3$/, ".html")
11
16
  xlate src: child, dst: dest # , debug: true
12
17
  end
18
+ # build mainfile
19
+ # build cardfile
13
20
  end
14
21
 
15
- def self.edit_menu
22
+ def edit_menu
16
23
  end
17
24
 
18
- def self.refresh
25
+ def refresh
19
26
  end
20
27
  end
21
28
  end
@@ -2,13 +2,17 @@
2
2
 
3
3
  class ::RuneBlog::Widget
4
4
  class Pinned
5
- def self.build
5
+ def initialize(repo)
6
+ @blog = repo
6
7
  end
7
8
 
8
- def self.edit_menu
9
+ def build
9
10
  end
10
11
 
11
- def self.refresh
12
+ def edit_menu
13
+ end
14
+
15
+ def refresh
12
16
  end
13
17
  end
14
18
  end
@@ -2,13 +2,17 @@
2
2
 
3
3
  class ::RuneBlog::Widget
4
4
  class Search
5
- def self.build
5
+ def initialize(repo)
6
+ @blog = repo
6
7
  end
7
8
 
8
- def self.edit_menu
9
+ def build
9
10
  end
10
11
 
11
- def self.refresh
12
+ def edit_menu
13
+ end
14
+
15
+ def refresh
12
16
  end
13
17
  end
14
18
  end
@@ -2,13 +2,17 @@
2
2
 
3
3
  class ::RuneBlog::Widget
4
4
  class Sitemap
5
- def self.build
5
+ def initialize(repo)
6
+ @blog = repo
6
7
  end
7
8
 
8
- def self.edit_menu
9
+ def build
9
10
  end
10
11
 
11
- def self.refresh
12
+ def edit_menu
13
+ end
14
+
15
+ def refresh
12
16
  end
13
17
  end
14
18
  end
@@ -2,13 +2,17 @@
2
2
 
3
3
  class ::RuneBlog::Widget
4
4
  class TagCloud
5
- def self.build
5
+ def initialize(repo)
6
+ @blog = repo
6
7
  end
7
8
 
8
- def self.edit_menu
9
+ def build
9
10
  end
10
11
 
11
- def self.refresh
12
+ def edit_menu
13
+ end
14
+
15
+ def refresh
12
16
  end
13
17
  end
14
18
  end
@@ -5,7 +5,7 @@ class RuneBlog::Default
5
5
  def RuneBlog.post_template(num: 0, title: "No title", date: nil, view: "test_view",
6
6
  teaser: "No teaser", body: "No body", tags: ["untagged"],
7
7
  views: [], back: "javascript:history.go(-1)", home: "no url")
8
- log!(enter: __method__, args: [num, title, date, view, teaser, body, tags, views, back, home])
8
+ log!(enter: __method__, args: [num, title, date, view, teaser, body, tags, views, back, home], level: 3)
9
9
  viewlist = (views + [view.to_s]).join(" ")
10
10
  taglist = ".tags " + tags.join(" ")
11
11
  <<-TEXT
@@ -20,7 +20,7 @@ end
20
20
  # Refactor, move stuff elsewhere?
21
21
 
22
22
  def make_exception(sym, str)
23
- log!(enter: __method__, args: [sym, str])
23
+ log!(enter: __method__, args: [sym, str], level: 3)
24
24
  return if Object.constants.include?(sym)
25
25
  Object.const_set(sym, StandardError.dup)
26
26
  define_method(sym) do |*args|
@@ -30,47 +30,22 @@ def make_exception(sym, str)
30
30
  end
31
31
  end
32
32
 
33
- def system!(str)
34
- log!(enter: __method__, args: [str])
35
- rc = system(str)
36
- if rc
37
- return rc
38
- else
39
- STDERR.puts "FAILED: #{str.inspect}"
40
- STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
41
- return rc
42
- end
43
- rc
44
- end
33
+ def system!(str, show: false)
34
+ log!(enter: __method__, args: [str], level: 2)
35
+ STDERR.puts str if show
36
+ rc = system(str)
37
+ if rc
38
+ return rc
39
+ else
40
+ STDERR.puts "FAILED: #{str.inspect}"
41
+ STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
42
+ return rc
43
+ end
44
+ rc
45
+ end
45
46
 
46
47
  def prefix(num)
47
- log!(enter: __method__, args: [num])
48
+ log!(enter: __method__, args: [num], level: 3)
48
49
  "#{'%04d' % num.to_i}"
49
50
  end
50
51
 
51
- def check_meta(meta, where = "")
52
- log!(enter: __method__, args: [meta, where])
53
- str = "--- #{where}\n"
54
- str << "\ncheck_meta: \n" + caller.join("\n") + "\n meta = #{meta.inspect}\n"
55
- str << " title missing!\n" unless meta.title
56
- str << " title missing! (empty)" if meta.title && meta.title.empty?
57
- str << " num missing!\n" unless meta.num
58
- if str =~ /missing!/
59
- debug str
60
- raise str
61
- end
62
- end
63
-
64
- def verify(hash)
65
- log!(enter: __method__, args: [hash])
66
- hash.each_pair do |expr, msg|
67
- puts "<< #{msg}" unless expr
68
- end
69
- end
70
-
71
- def assure(hash) # really the same as verify for now...
72
- log!(enter: __method__, args: [hash])
73
- hash.each_pair do |expr, msg|
74
- puts "<< #{msg}" unless expr
75
- end
76
- end