runeblog 0.2.99 → 0.3.01
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/blog +15 -12
- data/data/features.txt +18 -0
- data/data/global.lt3 +6 -24
- data/data/universal.lt3 +2 -5
- data/empty_view/settings/features.txt +18 -0
- data/empty_view/settings/publish.txt +5 -0
- data/empty_view/settings/recent.txt +6 -0
- data/empty_view/settings/view.txt +4 -0
- data/empty_view/themes/standard/banner/top.lt3 +2 -2
- data/lib/helpers-blog.rb +15 -11
- data/lib/liveblog.rb +10 -10
- data/lib/publish.rb +2 -0
- data/lib/repl.rb +27 -1
- data/lib/runeblog.rb +94 -35
- data/lib/runeblog_version.rb +1 -1
- data/lib/view.rb +2 -0
- data/test/austin.rb +9 -11
- metadata +7 -4
- data/empty_view/themes/standard/global.lt3 +0 -32
- data/empty_view/themes/standard/recent.txt +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec29df304d77421321cba06f651b2f9111815d2d8c4db26a82c83de2e19a3b3b
|
4
|
+
data.tar.gz: 24e7358402b1f4709d04da4fea0f6fbcbf53a94aa5b8ef3ebf0b2ac21a8418cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 696f296668f2246f381caf84fa82366edc73a890ac86b558bd02a008b0c9d1f34a96ac69735b71981b266032fc9e713c26f5b497ac030d1aa35cdd2884967f9a
|
7
|
+
data.tar.gz: a66ce19884a600b1071463c4c3a344f84a2a9e9edc4f15cf2b3384d81163c550ca173cb0279d09f8a8b0b0685e1ceb55427d7a7d8b63d9256cb30843ea175f75
|
data/bin/blog
CHANGED
@@ -25,13 +25,14 @@ end
|
|
25
25
|
def get_universal
|
26
26
|
univ = "#{@blog.root}/data/universal.lt3"
|
27
27
|
if yesno("Faster initial setup? (no: edit universal.lt3)")
|
28
|
-
author = ask!("Author name: ")
|
29
|
-
site = ask!("Site/domain: ")
|
28
|
+
author = ask!(" Author name: ")
|
29
|
+
site = ask!(" Site/domain: ")
|
30
30
|
# Now stash it...
|
31
31
|
str = File.read(univ)
|
32
32
|
str = str.gsub(/AUTHOR/, author)
|
33
33
|
str = str.gsub(/SITE_DOMAIN/, site)
|
34
34
|
File.write(univ, str)
|
35
|
+
# STDERR.puts "------ universal ------\n#{`cat #{univ}`}\n------------------------"
|
35
36
|
else
|
36
37
|
vim_params = '-c ":set hlsearch" -c ":hi Search ctermfg=2 ctermbg=6" +/"\(AUTHOR.*\|SITE.*\)"'
|
37
38
|
edit_file(univ, vim: vim_params)
|
@@ -40,18 +41,20 @@ end
|
|
40
41
|
|
41
42
|
def get_global
|
42
43
|
if yesno("Faster view setup? (no: edit global.lt3)")
|
43
|
-
view_name = ask!("\
|
44
|
+
view_name = ask!("\n Filename: ")
|
44
45
|
@blog.create_view(view_name) # call change_view??
|
45
|
-
title = ask!("View title: ")
|
46
|
-
subtitle = ask!("Subtitle : ")
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
46
|
+
title = ask!(" View title: ")
|
47
|
+
subtitle = ask!(" Subtitle : ")
|
48
|
+
domain = ask!(" Domain : ")
|
49
|
+
|
50
|
+
vfile = "#{@blog.root}/views/#{view_name}/settings/view.txt"
|
51
|
+
hash = {/VIEW_NAME/ => view_name,
|
52
|
+
/VIEW_TITLE/ => title,
|
53
|
+
/VIEW_SUBTITLE/ => subtitle,
|
54
|
+
/VIEW_DOMAIN/ => domain}
|
55
|
+
@blog.complete_file(vfile, nil, hash)
|
53
56
|
else
|
54
|
-
view_name = ask!("\
|
57
|
+
view_name = ask!("\n Filename: ")
|
55
58
|
@blog.create_view(view_name) # call change_view??
|
56
59
|
vim_params = '-c ":set hlsearch" -c ":hi Search ctermfg=2 ctermbg=6" +/"\(VIEW_.*\|SITE.*\)"'
|
57
60
|
edit_file(@blog.view.dir/"themes/standard/global.lt3", vim: vim_params)
|
data/data/features.txt
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# 0 = disabled (installed but disabled)
|
2
|
+
# 1 = enabled (implies installed)
|
3
|
+
# x = excluded (not installed; does it even exist?)
|
4
|
+
|
5
|
+
reddit 1 # autopost, embed thread after blog post
|
6
|
+
facebook 0 # reader-like, reader post, autopost?
|
7
|
+
twitter 0 # reader-tweet, reader-follow, autotweet?
|
8
|
+
|
9
|
+
links 1 # widget: external links
|
10
|
+
news 1 # widget: news (external)
|
11
|
+
pages 1 # widget: internal pages
|
12
|
+
pinned 1 # widget: pinned posts
|
13
|
+
|
14
|
+
ad x # widget: embed advertising
|
15
|
+
bydates x # widget: browse posts by date
|
16
|
+
search x # widget: search posts
|
17
|
+
sitemap x # widget: site map
|
18
|
+
tag_cloud x # widget: tag cloud (clickable)
|
data/data/global.lt3
CHANGED
@@ -3,12 +3,13 @@
|
|
3
3
|
. <variable> <value>
|
4
4
|
. --------------------------------------------------
|
5
5
|
|
6
|
-
.variables
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
.variables view ../../settings/view.txt
|
7
|
+
|
8
|
+
.variables recent ../../settings/recent.txt
|
9
|
+
|
10
|
+
.variables publish ../../settings/publish.txt
|
11
11
|
|
12
|
+
.variables
|
12
13
|
host http://SITE
|
13
14
|
charset utf-8
|
14
15
|
url http://SITE
|
@@ -17,22 +18,3 @@ locale en_US
|
|
17
18
|
font.family verdana
|
18
19
|
.end
|
19
20
|
|
20
|
-
.variables recent
|
21
|
-
title.color #010101
|
22
|
-
title.size 28px
|
23
|
-
|
24
|
-
text.color #0101a1
|
25
|
-
text.size 22px
|
26
|
-
|
27
|
-
date.color #9a9a9a
|
28
|
-
date.size 15px
|
29
|
-
.end
|
30
|
-
|
31
|
-
.variables publish
|
32
|
-
user root
|
33
|
-
server SITE
|
34
|
-
docroot /var/www/
|
35
|
-
path VIEW_NAME
|
36
|
-
proto http
|
37
|
-
.end
|
38
|
-
|
data/data/universal.lt3
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# 0 = disabled (installed but disabled)
|
2
|
+
# 1 = enabled (implies installed)
|
3
|
+
# x = excluded (not installed; does it even exist?)
|
4
|
+
|
5
|
+
reddit 1 # autopost, embed thread after blog post
|
6
|
+
facebook 0 # reader-like, reader post, autopost?
|
7
|
+
twitter 0 # reader-tweet, reader-follow, autotweet?
|
8
|
+
|
9
|
+
links 1 # widget: external links
|
10
|
+
news 1 # widget: news (external)
|
11
|
+
pages 1 # widget: internal pages
|
12
|
+
pinned 1 # widget: pinned posts
|
13
|
+
|
14
|
+
ad x # widget: embed advertising
|
15
|
+
bydates x # widget: browse posts by date
|
16
|
+
search x # widget: search posts
|
17
|
+
sitemap x # widget: site map
|
18
|
+
tag_cloud x # widget: tag cloud (clickable)
|
@@ -15,6 +15,6 @@
|
|
15
15
|
|
16
16
|
<rect x="20" y="20" rx="15" ry="15" width="98%" height="100" fill="url(#grad1)"/>
|
17
17
|
|
18
|
-
<text x="45" y="70" class=heavy>$
|
19
|
-
<text x="45" y="98" class=small>$
|
18
|
+
<text x="45" y="70" class=heavy>$view.title</text>
|
19
|
+
<text x="45" y="98" class=small>$view.subtitle</text>
|
20
20
|
</svg>
|
data/lib/helpers-blog.rb
CHANGED
@@ -14,6 +14,18 @@ module RuneBlog::Helpers
|
|
14
14
|
exit
|
15
15
|
end
|
16
16
|
|
17
|
+
def read_features
|
18
|
+
hash = {}
|
19
|
+
file = @root/self.view/"settings/features.txt"
|
20
|
+
lines = File.readlines(file)
|
21
|
+
lines.each do |line|
|
22
|
+
char, line = line[0], line[1..-1].chomp
|
23
|
+
name = line.strip
|
24
|
+
hash[name] = (char != "-")
|
25
|
+
end
|
26
|
+
@features = hash
|
27
|
+
end
|
28
|
+
|
17
29
|
def get_repo_config
|
18
30
|
log!(enter: __method__, level: 3)
|
19
31
|
@editor = File.read(".blogs/data/EDITOR").chomp
|
@@ -47,14 +59,15 @@ module RuneBlog::Helpers
|
|
47
59
|
line = line.strip
|
48
60
|
next if skip.include?(line[0])
|
49
61
|
key, val = line.split(" ", 2)
|
50
|
-
|
62
|
+
next if key.nil?
|
63
|
+
hash[key] = hash[key.to_sym] = val
|
51
64
|
end
|
52
65
|
hash
|
53
66
|
rescue => err
|
54
67
|
puts "Can't read vars file '#{file}': #{err}"
|
55
68
|
puts err.backtrace.join("\n")
|
56
69
|
puts "dir = #{Dir.pwd}"
|
57
|
-
stop_RubyText
|
70
|
+
stop_RubyText rescue nil
|
58
71
|
end
|
59
72
|
|
60
73
|
def read_config(file, *syms)
|
@@ -111,15 +124,6 @@ module RuneBlog::Helpers
|
|
111
124
|
File.write(root + "/data/EDITOR", editor + "\n")
|
112
125
|
end
|
113
126
|
|
114
|
-
# def new_dotfile(root: ".blogs", current_view: "test_view", editor: "vi")
|
115
|
-
# log!(enter: __method__, args: [root, current_view, editor], level: 3)
|
116
|
-
# root = Dir.pwd + "/" + root
|
117
|
-
# x = OpenStruct.new
|
118
|
-
# x.root, x.current_view, x.editor = root, current_view, editor
|
119
|
-
# write_config(x, root + "/" + RuneBlog::ConfigFile)
|
120
|
-
# write_repo_config
|
121
|
-
# end
|
122
|
-
|
123
127
|
def new_sequence
|
124
128
|
log!(enter: __method__, level: 3)
|
125
129
|
dump(0, "data/sequence")
|
data/lib/liveblog.rb
CHANGED
@@ -72,7 +72,7 @@ def post_trailer
|
|
72
72
|
tags = _var("post.tags")
|
73
73
|
taglist = tags.empty? ? "" : "Tags: #{tags}"
|
74
74
|
|
75
|
-
reddit_enabled =
|
75
|
+
reddit_enabled = @blog.features["reddit"] rescue nil
|
76
76
|
reddit_txt = ""
|
77
77
|
if reddit_enabled
|
78
78
|
vdir = @blog.root/:views/@blog.view
|
@@ -241,8 +241,8 @@ def _svg_title(*args)
|
|
241
241
|
.subtitle { font: #{style2} #{size2} #{font2}; fill: #{color2} }
|
242
242
|
</style>
|
243
243
|
<rect x="10" y="10" rx="10" ry="10" width="#{width}" height="#{height}" fill="url(#grad1)"/>
|
244
|
-
<text text-anchor="#{align}" x="#{x}" y="#{y}" class="title">#{Livetext::Vars[
|
245
|
-
<text text-anchor="#{align2}" x="#{x2}" y="#{y2}" class="subtitle">#{Livetext::Vars["
|
244
|
+
<text text-anchor="#{align}" x="#{x}" y="#{y}" class="title">#{Livetext::Vars["view.title"]} </text>
|
245
|
+
<text text-anchor="#{align2}" x="#{x2}" y="#{y2}" class="subtitle">#{Livetext::Vars["view.subtitle"]} </text>
|
246
246
|
</svg>
|
247
247
|
<!-- ^ how does syntax highlighting get messed up? </svg> -->
|
248
248
|
HTML
|
@@ -446,18 +446,18 @@ def head # Does NOT output tags
|
|
446
446
|
defaults = {}
|
447
447
|
defaults = { "charset" => %[<meta charset="utf-8">],
|
448
448
|
"http-equiv" => %[<meta http-equiv="X-UA-Compatible" content="IE=edge">],
|
449
|
-
"title" => %[<title>\n #{_var(
|
449
|
+
"title" => %[<title>\n #{_var("view.title")} | #{_var("view.subtitle")}\n </title>],
|
450
450
|
"generator" => %[<meta name="generator" content="Runeblog v #@version">],
|
451
|
-
"og:title" => %[<meta property="og:title" content="#{_var(
|
451
|
+
"og:title" => %[<meta property="og:title" content="#{_var("view.title")}">],
|
452
452
|
"og:locale" => %[<meta property="og:locale" content="#{_var(:locale)}">],
|
453
|
-
"description" => %[<meta name="description" content="#{_var("
|
454
|
-
"og:description" => %[<meta property="og:description" content="#{_var("
|
453
|
+
"description" => %[<meta name="description" content="#{_var("view.subtitle")}">],
|
454
|
+
"og:description" => %[<meta property="og:description" content="#{_var("view.subtitle")}">],
|
455
455
|
"linkc" => %[<link rel="canonical" href="#{_var(:host)}">],
|
456
456
|
"og:url" => %[<meta property="og:url" content="#{_var(:host)}">],
|
457
|
-
"og:site_name" => %[<meta property="og:site_name" content="#{_var(
|
457
|
+
"og:site_name" => %[<meta property="og:site_name" content="#{_var("view.title")}">],
|
458
458
|
# "style" => %[<link rel="stylesheet" href="etc/blog.css">],
|
459
459
|
# ^ FIXME
|
460
|
-
"feed" => %[<link type="application/atom+xml" rel="alternate" href="#{_var(:host)}/feed.xml" title="#{_var(
|
460
|
+
"feed" => %[<link type="application/atom+xml" rel="alternate" href="#{_var(:host)}/feed.xml" title="#{_var("view.title")}">],
|
461
461
|
"favicon" => %[<link rel="shortcut icon" type="image/x-icon" href="etc/favicon.ico">\n <link rel="apple-touch-icon" href="etc/favicon.ico">]
|
462
462
|
}
|
463
463
|
result = {}
|
@@ -689,7 +689,7 @@ end
|
|
689
689
|
|
690
690
|
def _make_navbar(orient = :horiz)
|
691
691
|
vdir = @root/:views/@blog.view
|
692
|
-
title = _var(
|
692
|
+
title = _var("view.title")
|
693
693
|
|
694
694
|
if orient == :horiz
|
695
695
|
name = "navbar.html"
|
data/lib/publish.rb
CHANGED
@@ -16,6 +16,8 @@ class RuneBlog::Publishing
|
|
16
16
|
@blog = RuneBlog.blog
|
17
17
|
dir = @blog.root/:views/view/"themes/standard/"
|
18
18
|
gfile = dir/"global.lt3"
|
19
|
+
return unless File.exist?(gfile) # FIXME Hackish as hell
|
20
|
+
|
19
21
|
live = get_live_vars(gfile)
|
20
22
|
@user = live.vars["publish.user"]
|
21
23
|
@server = live.vars["publish.server"]
|
data/lib/repl.rb
CHANGED
@@ -38,7 +38,7 @@ module RuneBlog::REPL
|
|
38
38
|
@out
|
39
39
|
end
|
40
40
|
|
41
|
-
def
|
41
|
+
def OLD_cmd_config(arg, testing = false)
|
42
42
|
hash = {"global.lt3 Global configuration" => "global.lt3",
|
43
43
|
"banner/top.lt3 Text portion of banner" => "banner/top.lt3",
|
44
44
|
"blog/generate.lt3 Generator for view (usu not edited)" => "blog/generate.lt3",
|
@@ -59,6 +59,32 @@ module RuneBlog::REPL
|
|
59
59
|
edit_file(dir/target)
|
60
60
|
end
|
61
61
|
|
62
|
+
def cmd_config(arg, testing = false)
|
63
|
+
hash = {"Global configuration" => "global.lt3",
|
64
|
+
" View-specific variables" => "../../settings/view.txt",
|
65
|
+
" Recent posts" => "../../settings/recent.txt",
|
66
|
+
" Publishing vars" => "../../settings/publish.txt",
|
67
|
+
"Banner description" => "blog/banner.lt3",
|
68
|
+
" Text portion of banner" => "banner/top.lt3",
|
69
|
+
"Generator for view (usu not edited)" => "blog/generate.lt3",
|
70
|
+
" HEAD info for view" => "blog/head.lt3",
|
71
|
+
" User-edited detail for view" => "blog/index.lt3",
|
72
|
+
"Generator for post entry in recent-posts" => "blog/post_entry.lt3",
|
73
|
+
"Global CSS" => "etc/blog.css.lt3",
|
74
|
+
"External JS/CSS (Bootstrap, etc.)" => "/etc/externals.lt3",
|
75
|
+
"Generator for a post" => "post/generate.lt3",
|
76
|
+
" HEAD info for post" => "post/head.lt3",
|
77
|
+
" Content for post" => "post/index.lt3",
|
78
|
+
"Generator for permalink" => "post/permalink.lt3",
|
79
|
+
}
|
80
|
+
|
81
|
+
dir = @blog.view.dir/"themes/standard/"
|
82
|
+
num, target = STDSCR.menu(title: "Edit file:", items: hash)
|
83
|
+
edit_file(dir/target)
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
|
62
88
|
def cmd_manage(arg, testing = false)
|
63
89
|
case arg
|
64
90
|
when "pages"; _manage_pages(nil, testing = false)
|
data/lib/runeblog.rb
CHANGED
@@ -40,7 +40,7 @@ class RuneBlog
|
|
40
40
|
end
|
41
41
|
|
42
42
|
attr_reader :views, :sequence
|
43
|
-
attr_accessor :root, :editor
|
43
|
+
attr_accessor :root, :editor, :features
|
44
44
|
attr_accessor :view # overridden
|
45
45
|
|
46
46
|
attr_accessor :post_views, :post_tags, :dirty_views
|
@@ -120,7 +120,7 @@ class RuneBlog
|
|
120
120
|
self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
121
121
|
|
122
122
|
@root = Dir.pwd/root_rel
|
123
|
-
write_repo_config(root: @root)
|
123
|
+
write_repo_config(root: @root) # ?? FIXME
|
124
124
|
get_repo_config
|
125
125
|
@views = retrieve_views
|
126
126
|
self.view = File.read(@root/"data/VIEW").chomp
|
@@ -134,16 +134,67 @@ class RuneBlog
|
|
134
134
|
@post_tags = []
|
135
135
|
end
|
136
136
|
|
137
|
+
def complete_file(name, vars, hash)
|
138
|
+
debugging = vars.nil?
|
139
|
+
return if hash.empty?
|
140
|
+
text = File.read(name)
|
141
|
+
if vars.nil? # FIXME dumbest hack ever?
|
142
|
+
vars = {}
|
143
|
+
hash.values.each {|val| vars[val] = val }
|
144
|
+
end
|
145
|
+
|
146
|
+
hash.each_pair {|key, var| text.gsub!(key, vars[var]) }
|
147
|
+
File.write(name, text)
|
148
|
+
end
|
149
|
+
|
150
|
+
def _generate_settings(view = nil)
|
151
|
+
vars = read_vars("#@root/data/universal.lt3")
|
152
|
+
hash = {/AUTHOR/ => "view.author",
|
153
|
+
/SITE/ => "view.site",
|
154
|
+
/FONT/ => "font.family",
|
155
|
+
/CHARSET/ => :charset,
|
156
|
+
/LOCALE/ => :locale}
|
157
|
+
|
158
|
+
# rubytext.txt - LATER
|
159
|
+
# complete_file(settings/"rubytext.txt", {}
|
160
|
+
|
161
|
+
if view
|
162
|
+
settings = @root/view/"settings"
|
163
|
+
### ??? Where to get hash of view-specific vars?
|
164
|
+
|
165
|
+
# features.txt - handle specially
|
166
|
+
fname = settings/"features.txt"
|
167
|
+
|
168
|
+
# view.txt
|
169
|
+
complete_file(settings/"view.txt",
|
170
|
+
/AUTHOR/ => "view.author",
|
171
|
+
/TITLE/ => "view.title",
|
172
|
+
/SUBTITLE/ => "view.subtitle",
|
173
|
+
/SITE/ => "view.site")
|
174
|
+
|
175
|
+
# publish.txt
|
176
|
+
complete_file(settings/"publish.txt",
|
177
|
+
/USER/ => "publish.user",
|
178
|
+
/SERVER/ => "publish.server",
|
179
|
+
/DOCROOT/ => "publish.docroot",
|
180
|
+
/PATH/ => "publish.path",
|
181
|
+
/PROTO/ => "publish.proto")
|
182
|
+
|
183
|
+
# recent.txt - SKIP THIS?
|
184
|
+
complete_file(settings/"recent.txt", {})
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
137
188
|
def _generate_global
|
138
189
|
vars = read_vars("#@root/data/universal.lt3")
|
139
190
|
gfile = "#@root/data/global.lt3"
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
191
|
+
hash = {/AUTHOR/ => "univ.author",
|
192
|
+
/SITE/ => "univ.site",
|
193
|
+
/FONT/ => "font.family",
|
194
|
+
/CHARSET/ => :charset,
|
195
|
+
/LOCALE/ => :locale}
|
196
|
+
complete_file(gfile, vars, hash)
|
197
|
+
_generate_settings
|
147
198
|
end
|
148
199
|
|
149
200
|
def _deploy_local(dir)
|
@@ -151,10 +202,7 @@ class RuneBlog
|
|
151
202
|
Dir.chdir(dir) do
|
152
203
|
views = _retrieve_metadata(:views)
|
153
204
|
views.each do |v|
|
154
|
-
unless
|
155
|
-
puts "#{fx("Warning:", :red)} #{fx(v, :bold)} is not a view"
|
156
|
-
next
|
157
|
-
end
|
205
|
+
next unless _check_view?(v)
|
158
206
|
system!("cp *html #@root/views/#{v}/remote", show: true)
|
159
207
|
end
|
160
208
|
end
|
@@ -162,6 +210,8 @@ class RuneBlog
|
|
162
210
|
_tmp_error(err)
|
163
211
|
end
|
164
212
|
|
213
|
+
# FIXME reconcile with _get_draft data
|
214
|
+
|
165
215
|
def _retrieve_metadata(key)
|
166
216
|
key = key.to_s
|
167
217
|
lines = File.readlines("metadata.txt")
|
@@ -506,7 +556,7 @@ class RuneBlog
|
|
506
556
|
call: ".nopara"
|
507
557
|
copy!("#{vdir}/themes/standard/banner/*", "#{vdir}/remote/banner/") # includes navbar/
|
508
558
|
copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
|
509
|
-
# rebuild widgets
|
559
|
+
# rebuild widgets?
|
510
560
|
copy_widget_html(view)
|
511
561
|
rescue => err
|
512
562
|
STDERR.puts err
|
@@ -514,6 +564,27 @@ class RuneBlog
|
|
514
564
|
# _tmp_error(err)
|
515
565
|
end
|
516
566
|
|
567
|
+
def _get_draft_data(num, sym)
|
568
|
+
tag = prefix(num)
|
569
|
+
front = @blog.root/:drafts/tag
|
570
|
+
files = Dir[front + "*"]
|
571
|
+
raise "No draft #{num} found" if files.empty?
|
572
|
+
raise "Too many files found for #{num}!" if files.size > 1
|
573
|
+
file = files.first
|
574
|
+
lines = File.readlines(file)
|
575
|
+
case sym
|
576
|
+
when :views
|
577
|
+
view_line = lines.grep(/^.views /)
|
578
|
+
raise "More than one .views call in #{draft}" if view_line.size > 1
|
579
|
+
raise "No .views call in #{draft}" if view_line.size < 1
|
580
|
+
view_line = view_line.first
|
581
|
+
views = view_line[7..-1].split
|
582
|
+
return views.uniq
|
583
|
+
else
|
584
|
+
raise "Unknown symbol #{sym.inspect}"
|
585
|
+
end
|
586
|
+
end
|
587
|
+
|
517
588
|
def _get_views(draft)
|
518
589
|
log!(enter: __method__, args: [draft], level: 2)
|
519
590
|
# FIXME dumb code
|
@@ -603,6 +674,8 @@ class RuneBlog
|
|
603
674
|
log!(enter: __method__, args: [draft, view_name], level: 2)
|
604
675
|
# break into separate methods?
|
605
676
|
|
677
|
+
return unless _check_view?(view_name)
|
678
|
+
|
606
679
|
fname = File.basename(draft) # 0001-this-is-a-post.lt3
|
607
680
|
nslug = fname.sub(/.lt3$/, "") # 0001-this-is-a-post
|
608
681
|
aslug = nslug.sub(/\d\d\d\d-/, "") # this-is-a-post
|
@@ -632,30 +705,16 @@ class RuneBlog
|
|
632
705
|
_tmp_error(err)
|
633
706
|
end
|
634
707
|
|
708
|
+
def _check_view?(view)
|
709
|
+
flag = self.view?(view)
|
710
|
+
puts " Warning: '#{view}' is not a view" unless flag
|
711
|
+
flag
|
712
|
+
end
|
713
|
+
|
635
714
|
def generate_post(draft, force = false)
|
636
715
|
log!(enter: __method__, args: [draft], level: 1)
|
637
716
|
views = _get_views(draft)
|
638
|
-
views.each
|
639
|
-
unless self.view?(view)
|
640
|
-
puts "Warning: '#{view}' is not a view"
|
641
|
-
next
|
642
|
-
end
|
643
|
-
_handle_post(draft, view)
|
644
|
-
end
|
645
|
-
rescue => err
|
646
|
-
_tmp_error(err)
|
647
|
-
end
|
648
|
-
|
649
|
-
def rebuild_post(file)
|
650
|
-
log!(enter: __method__, args: [file])
|
651
|
-
raise "Doesn't currently work"
|
652
|
-
debug "Called rebuild_post(#{file.inspect})"
|
653
|
-
raise ArgumentError unless file.is_a?(String)
|
654
|
-
meta = process_post(file)
|
655
|
-
@views_dirty ||= []
|
656
|
-
@views_dirty << meta.views
|
657
|
-
@views_dirty.flatten!
|
658
|
-
@views_dirty.uniq!
|
717
|
+
views.each {|view| _handle_post(draft, view) }
|
659
718
|
rescue => err
|
660
719
|
_tmp_error(err)
|
661
720
|
end
|
data/lib/runeblog_version.rb
CHANGED
data/lib/view.rb
CHANGED
@@ -15,6 +15,8 @@ class RuneBlog::View
|
|
15
15
|
@can_publish = true # FIXME
|
16
16
|
@blog.view = self
|
17
17
|
gfile = @blog.root/"views/#{name}/themes/standard/global.lt3"
|
18
|
+
return unless File.exist?(gfile) # Hackish!! how is View.new called from create_view??
|
19
|
+
|
18
20
|
live = Livetext.customize(call: ".nopara")
|
19
21
|
live.xform_file(gfile)
|
20
22
|
@globals = live.vars
|
data/test/austin.rb
CHANGED
@@ -59,19 +59,17 @@ x = RuneBlog.new(".blogs")
|
|
59
59
|
debug("create_view: #{bold('around_austin')}")
|
60
60
|
x.create_view("around_austin") # FIXME remember view title!
|
61
61
|
|
62
|
-
#### FIXME
|
63
|
-
vars = <<-VARS
|
64
|
-
|
65
|
-
.variables
|
66
|
-
blog Around Austin
|
67
|
-
blog.desc The view from downtown...
|
62
|
+
#### FIXME
|
68
63
|
|
69
|
-
|
70
|
-
|
64
|
+
vars = <<-VARS
|
65
|
+
author Hal Fulton
|
66
|
+
title Around Austin
|
67
|
+
subtitle The view from downtown...
|
68
|
+
domain foo.com
|
71
69
|
VARS
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
vfile = ".blogs/views/around_austin/settings/view.txt"
|
71
|
+
File.open(vfile, "w") {|f| f.puts vars }
|
72
|
+
|
75
73
|
####
|
76
74
|
|
77
75
|
debug("-- change_view: #{bold('around_austin')}")
|
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.
|
4
|
+
version: 0.3.01
|
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-12-
|
11
|
+
date: 2019-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: livetext
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- data/EDITOR
|
86
86
|
- data/ROOT
|
87
87
|
- data/VIEW
|
88
|
+
- data/features.txt
|
88
89
|
- data/global.lt3
|
89
90
|
- data/universal.lt3
|
90
91
|
- empty_view/assets/austin-pano.jpg
|
@@ -116,6 +117,10 @@ files:
|
|
116
117
|
- empty_view/remote/widgets/news/GIT_IS_DUMB
|
117
118
|
- empty_view/remote/widgets/pages/GIT_IS_DUMB
|
118
119
|
- empty_view/remote/widgets/pinned/GIT_IS_DUMB
|
120
|
+
- empty_view/settings/features.txt
|
121
|
+
- empty_view/settings/publish.txt
|
122
|
+
- empty_view/settings/recent.txt
|
123
|
+
- empty_view/settings/view.txt
|
119
124
|
- empty_view/themes/standard/README
|
120
125
|
- empty_view/themes/standard/banner/banner.lt3
|
121
126
|
- empty_view/themes/standard/banner/navbar/about.lt3
|
@@ -131,12 +136,10 @@ files:
|
|
131
136
|
- empty_view/themes/standard/etc/externals.lt3
|
132
137
|
- empty_view/themes/standard/etc/favicon.ico
|
133
138
|
- empty_view/themes/standard/etc/misc.js
|
134
|
-
- empty_view/themes/standard/global.lt3
|
135
139
|
- empty_view/themes/standard/post/generate.lt3
|
136
140
|
- empty_view/themes/standard/post/head.lt3
|
137
141
|
- empty_view/themes/standard/post/index.lt3
|
138
142
|
- empty_view/themes/standard/post/permalink.lt3
|
139
|
-
- empty_view/themes/standard/recent.txt
|
140
143
|
- empty_view/themes/standard/widgets/README
|
141
144
|
- empty_view/themes/standard/widgets/ad/ad.lt3
|
142
145
|
- empty_view/themes/standard/widgets/ad/ad1.png
|
@@ -1,32 +0,0 @@
|
|
1
|
-
. --------------------------------------------------
|
2
|
-
. Global settings are stored here in the form
|
3
|
-
. <variable> <value>
|
4
|
-
. --------------------------------------------------
|
5
|
-
|
6
|
-
.variables
|
7
|
-
author Your name here
|
8
|
-
blog Blog title goes here
|
9
|
-
blog.desc Subtitle (if any) goes here
|
10
|
-
site rubyhacker.com
|
11
|
-
|
12
|
-
host localhost:4000//
|
13
|
-
charset utf-8
|
14
|
-
url localhost:4000//
|
15
|
-
locale en_US
|
16
|
-
|
17
|
-
font.family verdana
|
18
|
-
|
19
|
-
recent.title.color #010101
|
20
|
-
recent.title.size 28px
|
21
|
-
recent.text.color #0101a1
|
22
|
-
recent.text.size 22px
|
23
|
-
recent.date.color #9a9a9a
|
24
|
-
recent.date.size 15px
|
25
|
-
|
26
|
-
publish.user root
|
27
|
-
publish.server rubyhacker.com
|
28
|
-
publish.docroot /var/www/
|
29
|
-
publish.path stuff
|
30
|
-
publish.proto http
|
31
|
-
.end
|
32
|
-
|