solutus 0.0.2 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/solutus.rb +240 -33
- data/resources/editBlog.html +51 -0
- data/resources/editPage.html +39 -0
- data/resources/index.html +49 -14
- metadata +59 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b53796ffa09cef641f839b82b1c6a550039db52c0dfeba0b20b1f4e5fa291cd
|
4
|
+
data.tar.gz: f98588c4cb4b9b4ae957457438770f6c21c8d33fe964bf5f091ba98ce12ba375
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96ec0c958d3fedbeed95f74e04c9b0b95add3a09e6bbb064354be042e4893e0fdb1cdfc071870f5f15ab7a98bd73a975fa1d62e218ded353f8e31b12f4eaacef
|
7
|
+
data.tar.gz: 813cf1e0610875f65d39fbc8645ab839a65bc2e08f04d4f6ed7d048660d0c453b646e5e049900cd65094567dc15eebb84b3548066fe4c25474e3cec36cbed55e
|
data/lib/solutus.rb
CHANGED
@@ -3,6 +3,8 @@ require 'yaml'
|
|
3
3
|
require 'sinatra/base'
|
4
4
|
require 'mustache'
|
5
5
|
require 'redcarpet'
|
6
|
+
require 'json'
|
7
|
+
require 'nokogiri'
|
6
8
|
|
7
9
|
class Solutus
|
8
10
|
DEFAULT_TEMPLATE = "default"
|
@@ -14,12 +16,35 @@ class Solutus
|
|
14
16
|
TEMPLATES_PATH = "templates"
|
15
17
|
SITE_PAGES_PATH = File.join("pages", "site-pages")
|
16
18
|
POSTS_PATH = File.join("pages", "posts")
|
17
|
-
BLOG_DATE_FORMAT = "%b
|
19
|
+
BLOG_DATE_FORMAT = "%b %e, %Y"
|
18
20
|
SETTINGS_FILE = "settings.yml"
|
19
|
-
|
21
|
+
DAY_ENDINGS = ["th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "st"]
|
22
|
+
|
23
|
+
@@blog_urls = Hash.new
|
24
|
+
@@page_urls = Array.new
|
25
|
+
|
26
|
+
def self.load_settings
|
27
|
+
begin
|
28
|
+
yml_text = ""
|
29
|
+
f = File.open(SETTINGS_FILE, "r")
|
30
|
+
f.each_line do |line|
|
31
|
+
yml_text += line
|
32
|
+
end
|
33
|
+
f.close
|
34
|
+
YAML.load(yml_text)
|
35
|
+
rescue
|
36
|
+
puts "settings.yml not found"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
20
40
|
class Solutus_Server < Sinatra::Base
|
21
41
|
set :public_folder, SITE_PATH
|
22
42
|
|
43
|
+
configure do
|
44
|
+
glob = Solutus.load_settings
|
45
|
+
set :global_settings, glob
|
46
|
+
end
|
47
|
+
|
23
48
|
get "/" do
|
24
49
|
send_file File.join(settings.public_folder, 'index.html')
|
25
50
|
end
|
@@ -30,18 +55,182 @@ class Solutus
|
|
30
55
|
end
|
31
56
|
|
32
57
|
get "/edit" do
|
33
|
-
|
58
|
+
render_index
|
59
|
+
end
|
60
|
+
|
61
|
+
get "/editpage" do
|
62
|
+
render_edit_page(params["page-path"])
|
63
|
+
end
|
64
|
+
|
65
|
+
post "/savepage" do
|
66
|
+
path = params["path"]
|
67
|
+
|
68
|
+
f = File.open(path, "r")
|
69
|
+
yml_text = ""
|
70
|
+
f.each_line do |line|
|
71
|
+
yml_text += line
|
72
|
+
end
|
73
|
+
f.close
|
74
|
+
|
75
|
+
data = YAML.load(yml_text)
|
76
|
+
data["content"] = params["content"]
|
77
|
+
|
78
|
+
new_contents = YAML.dump(data)
|
79
|
+
f = File.open(path, "w")
|
80
|
+
f.write(new_contents)
|
81
|
+
f.close
|
82
|
+
|
83
|
+
Solutus.command("build")
|
84
|
+
"saved page @ #{path}"
|
34
85
|
end
|
35
86
|
|
36
87
|
post "/newpost" do
|
37
|
-
Solutus.command("new", "post", params["post-title"])
|
88
|
+
path = Solutus.command("new", "post", params["post-title"])
|
38
89
|
Solutus.build
|
39
|
-
|
90
|
+
render_edit_post(path)
|
91
|
+
end
|
92
|
+
|
93
|
+
get "/editpost" do
|
94
|
+
render_edit_post(*params["post-path"].split(","))
|
95
|
+
end
|
96
|
+
|
97
|
+
post "/savepost" do
|
98
|
+
path = params["path"]
|
99
|
+
f = File.open(path, "r")
|
100
|
+
yml_text = ""
|
101
|
+
f.each_line do |line|
|
102
|
+
yml_text += line
|
103
|
+
end
|
104
|
+
f.close
|
105
|
+
data = YAML.load(yml_text)
|
106
|
+
data["title"] = params["title"]
|
107
|
+
new_contents = YAML.dump(data)
|
108
|
+
new_contents += "---\n"
|
109
|
+
new_contents += params["markdown"]
|
110
|
+
f = File.open(path, "w")
|
111
|
+
f.write(new_contents)
|
112
|
+
f.close
|
113
|
+
Solutus.command("build")
|
114
|
+
"saved post @ #{path}"
|
40
115
|
end
|
41
116
|
|
42
117
|
def path_to_resources
|
43
118
|
File.join(File.dirname(File.expand_path(__FILE__)), '../resources')
|
44
119
|
end
|
120
|
+
|
121
|
+
class ServerStache < Mustache
|
122
|
+
end
|
123
|
+
|
124
|
+
def render_edit_page(path)
|
125
|
+
f = File.open(File.join(path_to_resources, "editPage.html"), "r")
|
126
|
+
template = ""
|
127
|
+
f.each_line do |line|
|
128
|
+
template += line
|
129
|
+
end
|
130
|
+
f.close
|
131
|
+
|
132
|
+
f = File.open(path, "r")
|
133
|
+
file_contents = ""
|
134
|
+
f.each_line do |line|
|
135
|
+
file_contents += line
|
136
|
+
end
|
137
|
+
data = YAML.load(file_contents)
|
138
|
+
|
139
|
+
ServerStache.template = template
|
140
|
+
result = ServerStache.new
|
141
|
+
|
142
|
+
result[:title] = data["title"]
|
143
|
+
result[:path] = path
|
144
|
+
settings.global_settings.each do |key, val|
|
145
|
+
result[key.to_sym] = val
|
146
|
+
end
|
147
|
+
page_html = Solutus.render_page(Solutus.templates, settings.global_settings, data)
|
148
|
+
parser = Nokogiri::HTML(page_html)
|
149
|
+
parser.at_css("#solutus-content")['contenteditable'] = true
|
150
|
+
result[:everything] = parser.at_css("#solutus-everything")
|
151
|
+
result.render
|
152
|
+
end
|
153
|
+
|
154
|
+
def render_edit_post(path, url="/")
|
155
|
+
f = File.open(File.join(path_to_resources, "editBlog.html"), "r")
|
156
|
+
template = ""
|
157
|
+
f.each_line do |line|
|
158
|
+
template += line
|
159
|
+
end
|
160
|
+
f.close
|
161
|
+
|
162
|
+
Mustache.template = template
|
163
|
+
result = Mustache.new
|
164
|
+
|
165
|
+
f = File.open(path, "r")
|
166
|
+
file_contents = ""
|
167
|
+
f.each_line do |line|
|
168
|
+
file_contents += line
|
169
|
+
end
|
170
|
+
data = YAML.load(file_contents)
|
171
|
+
|
172
|
+
result[:title] = data["title"]
|
173
|
+
result[:markdown] = file_contents.split("---")[-1]
|
174
|
+
result[:link] = url
|
175
|
+
result[:canview] = url != "/"
|
176
|
+
result[:path] = path
|
177
|
+
result.render
|
178
|
+
end
|
179
|
+
|
180
|
+
def render_index
|
181
|
+
f = File.open(File.join(path_to_resources, "index.html"), "r")
|
182
|
+
template = ""
|
183
|
+
f.each_line do |line|
|
184
|
+
template += line
|
185
|
+
end
|
186
|
+
f.close
|
187
|
+
Mustache.template = template
|
188
|
+
result = Mustache.new
|
189
|
+
settings.global_settings.each do |key, val|
|
190
|
+
result[key.to_sym] = val
|
191
|
+
end
|
192
|
+
result[:blogs] = blog_select
|
193
|
+
result[:pages] = page_select
|
194
|
+
result.render
|
195
|
+
end
|
196
|
+
|
197
|
+
def page_select
|
198
|
+
result = "<select name=\"page-path\">\n"
|
199
|
+
Solutus.page_urls.each do |page|
|
200
|
+
path = page["file_path"]
|
201
|
+
title = page["title"]
|
202
|
+
result += "<option value=\"#{path}\">#{title}</option>\n"
|
203
|
+
end
|
204
|
+
result += "</select>"
|
205
|
+
result
|
206
|
+
end
|
207
|
+
|
208
|
+
def blog_select
|
209
|
+
result = "<select name=\"post-path\">\n"
|
210
|
+
Solutus.blog_urls.each do |yr, arr|
|
211
|
+
sorted = arr.sort_by {|k| k["date"]} .reverse
|
212
|
+
sorted.each do |blog|
|
213
|
+
title = blog["title"]
|
214
|
+
path = blog["file_path"]
|
215
|
+
url = blog["url"]
|
216
|
+
result += "<option value=\"#{path},#{url}\">#{title}</option>\n"
|
217
|
+
end
|
218
|
+
end
|
219
|
+
result += "</select>"
|
220
|
+
result
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
def self.blog_urls
|
225
|
+
@@blog_urls
|
226
|
+
end
|
227
|
+
|
228
|
+
def self.page_urls
|
229
|
+
@@page_urls
|
230
|
+
end
|
231
|
+
|
232
|
+
def self.templates
|
233
|
+
@@templates
|
45
234
|
end
|
46
235
|
|
47
236
|
def self.command(*args)
|
@@ -67,15 +256,15 @@ class Solutus
|
|
67
256
|
if args[1] == "page"
|
68
257
|
new_page(args[2])
|
69
258
|
elsif args[1] == "post"
|
70
|
-
new_post(args[2])
|
259
|
+
return new_post(args[2])
|
71
260
|
end
|
72
261
|
end
|
73
262
|
else
|
74
|
-
puts "
|
263
|
+
puts "Invalid arguments"
|
75
264
|
end
|
76
265
|
end
|
77
266
|
else
|
78
|
-
puts "
|
267
|
+
puts "Unknown command"
|
79
268
|
end
|
80
269
|
end
|
81
270
|
end
|
@@ -92,12 +281,7 @@ class Solutus
|
|
92
281
|
end
|
93
282
|
|
94
283
|
def self.build
|
95
|
-
|
96
|
-
f = File.open(SETTINGS_FILE, "r")
|
97
|
-
f.each_line do |line|
|
98
|
-
yml_text += line
|
99
|
-
end
|
100
|
-
settings_data = YAML.load(yml_text)
|
284
|
+
settings_data = load_settings
|
101
285
|
|
102
286
|
if File.directory?(BUILD_PATH)
|
103
287
|
FileUtils.remove_dir(BUILD_PATH)
|
@@ -106,7 +290,7 @@ class Solutus
|
|
106
290
|
Dir.mkdir(SITE_PATH)
|
107
291
|
copy_static
|
108
292
|
|
109
|
-
templates = Hash.new
|
293
|
+
@@templates = Hash.new
|
110
294
|
Dir.entries(TEMPLATES_PATH).each do |entry|
|
111
295
|
next if entry == "." || entry == ".."
|
112
296
|
puts "Loading template #{entry}"
|
@@ -117,10 +301,11 @@ class Solutus
|
|
117
301
|
f.each_line do |line|
|
118
302
|
contents += line
|
119
303
|
end
|
120
|
-
templates[entry.split(".")[0]] = contents
|
304
|
+
@@templates[entry.split(".")[0]] = contents
|
121
305
|
end
|
122
306
|
end
|
123
|
-
|
307
|
+
|
308
|
+
@@page_urls = Array.new
|
124
309
|
Dir.entries(SITE_PAGES_PATH).each do |entry|
|
125
310
|
next if entry == "." || entry == ".."
|
126
311
|
puts "Rendering page #{entry}"
|
@@ -132,16 +317,20 @@ class Solutus
|
|
132
317
|
yml_text += line
|
133
318
|
end
|
134
319
|
data = YAML.load(yml_text)
|
135
|
-
html = render_page(templates, settings_data, data, false)
|
320
|
+
html = render_page(@@templates, settings_data, data, false)
|
136
321
|
new_path = File.join(SITE_PATH, entry.split(".")[0] + ".html")
|
137
322
|
f = File.new(new_path, "w")
|
138
323
|
puts "Created #{new_path}"
|
139
324
|
f.write(html)
|
140
325
|
f.close
|
326
|
+
@@page_urls.push({
|
327
|
+
"title" => data["title"],
|
328
|
+
"file_path" => path
|
329
|
+
})
|
141
330
|
end
|
142
331
|
end
|
143
332
|
|
144
|
-
blog_urls = Hash.new
|
333
|
+
@@blog_urls = Hash.new
|
145
334
|
Dir.entries(POSTS_PATH).each do |entry|
|
146
335
|
next if entry == "." || entry == ".."
|
147
336
|
path = File.join(POSTS_PATH, entry)
|
@@ -157,16 +346,21 @@ class Solutus
|
|
157
346
|
date = data["date"]
|
158
347
|
|
159
348
|
puts "Rendering blog post #{entry}"
|
160
|
-
html = render_page(templates, settings_data, data, true)
|
349
|
+
html = render_page(@@templates, settings_data, data, true)
|
161
350
|
|
162
351
|
relative_dir = File.join(date.year.to_s, date.month.to_s, date.day.to_s)
|
163
352
|
root_url = File.join("archive", relative_dir, entry.split(".")[0] + ".html")
|
164
353
|
|
165
354
|
year = date.year.to_s
|
166
|
-
if
|
167
|
-
blog_urls[year] = Array.new
|
355
|
+
if !@@blog_urls.key?(year)
|
356
|
+
@@blog_urls[year] = Array.new
|
168
357
|
end
|
169
|
-
blog_urls[year].push({
|
358
|
+
@@blog_urls[year].push({
|
359
|
+
"title" => data["title"],
|
360
|
+
"url" => root_url,
|
361
|
+
"file_path" => path,
|
362
|
+
"date" => date
|
363
|
+
})
|
170
364
|
|
171
365
|
dir_path = File.join(BLOG_BUILD_PATH, relative_dir)
|
172
366
|
if !File.directory?(dir_path)
|
@@ -181,23 +375,25 @@ class Solutus
|
|
181
375
|
|
182
376
|
#TODO: CREATE SOME FCUKIN BLOG NAVIGATION HTML PAGES
|
183
377
|
content = ""
|
184
|
-
blog_urls.each do |yr, arr|
|
378
|
+
@@blog_urls.each do |yr, arr|
|
185
379
|
sorted = arr.sort_by {|k| k["date"]} .reverse
|
186
380
|
content += "<h3>#{yr}</h3>\n<hr>\n"
|
187
|
-
content += "<ul>"
|
188
381
|
sorted.each do |hash|
|
189
382
|
url = hash["url"]
|
190
383
|
title = hash["title"]
|
191
|
-
pretty_date = hash["date"].strftime("%b
|
192
|
-
|
384
|
+
pretty_date = hash["date"].strftime("%b %e") +
|
385
|
+
DAY_ENDINGS[hash["date"].strftime("%e").to_i]
|
386
|
+
content += "<div class=\"solutus-blog-block\">"
|
387
|
+
content += "<div class=\"solutus-blog-title\"><a href=\"/#{url}\">#{title}</a></div>"
|
388
|
+
content += "<div>#{pretty_date}</div>"
|
389
|
+
content += "</div>"
|
193
390
|
end
|
194
|
-
content += "</ul>"
|
195
391
|
end
|
196
392
|
path = File.join(SITE_PATH, "archive.html")
|
197
393
|
data = Hash.new
|
198
394
|
data["title"] = "Archive"
|
199
395
|
data["content"] = content
|
200
|
-
html = render_page(templates, settings_data, data, false)
|
396
|
+
html = render_page(@@templates, settings_data, data, false)
|
201
397
|
f = File.new(path, "w")
|
202
398
|
f.write(html)
|
203
399
|
f.close
|
@@ -228,9 +424,17 @@ HERE
|
|
228
424
|
puts "Created new site page #{title} at #{path}"
|
229
425
|
end
|
230
426
|
|
427
|
+
def self.correct_time(time)
|
428
|
+
time.utc.localtime("+05:30")
|
429
|
+
end
|
430
|
+
|
231
431
|
def self.new_post(title)
|
232
432
|
i = 1
|
233
433
|
new_title = title.gsub(/\s+/, "")
|
434
|
+
if title.empty?
|
435
|
+
puts "Empty title"
|
436
|
+
return ""
|
437
|
+
end
|
234
438
|
while true
|
235
439
|
path = File.join(POSTS_PATH, new_title + ".md")
|
236
440
|
if File.file?(path)
|
@@ -252,9 +456,10 @@ HERE
|
|
252
456
|
f.write(text)
|
253
457
|
f.close
|
254
458
|
puts "Created new blog post #{title} at #{path}"
|
459
|
+
path
|
255
460
|
end
|
256
461
|
|
257
|
-
def self.render_page(templates, default_data, data, blog)
|
462
|
+
def self.render_page(templates, default_data, data, blog=false)
|
258
463
|
if data.key?("template")
|
259
464
|
Mustache.template = templates[data["template"]]
|
260
465
|
else
|
@@ -277,7 +482,7 @@ HERE
|
|
277
482
|
|
278
483
|
def self.wrap_element(key, content)
|
279
484
|
if content.is_a?(Time)
|
280
|
-
content = content.strftime(BLOG_DATE_FORMAT)
|
485
|
+
content = correct_time(content).strftime(BLOG_DATE_FORMAT)
|
281
486
|
end
|
282
487
|
result = ""
|
283
488
|
result += "<div id=\"solutus-#{key}\">\n"
|
@@ -337,7 +542,7 @@ name: #{name}
|
|
337
542
|
author: Your Name
|
338
543
|
watermark: |
|
339
544
|
<p style="text-align: center;">
|
340
|
-
<small>Powered by <a href="https://rubygems.org/gems/solutus/
|
545
|
+
<small>Powered by <a href="https://rubygems.org/gems/solutus/">Solutus</a></small>
|
341
546
|
</p>
|
342
547
|
stylesheets: |
|
343
548
|
<link rel="stylesheet" type="text/css" href="/css/styles.css" />
|
@@ -364,9 +569,10 @@ HERE
|
|
364
569
|
{{{date}}}
|
365
570
|
{{/blog}}
|
366
571
|
{{{content}}}
|
572
|
+
<small style="display: block; text-align: center;">© {{author}}</small>
|
367
573
|
{{{watermark}}}
|
368
|
-
{{{scripts}}}
|
369
574
|
</div>
|
575
|
+
{{{scripts}}}
|
370
576
|
</body>
|
371
577
|
</html>
|
372
578
|
HERE
|
@@ -381,6 +587,7 @@ HERE
|
|
381
587
|
index_file = <<HERE
|
382
588
|
template: default
|
383
589
|
title: Home page
|
590
|
+
type: html
|
384
591
|
content: |
|
385
592
|
<h1>Hello World!</h1>
|
386
593
|
<p>
|
data/resources/editBlog.html
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<head>
|
3
|
+
<title>Editing {{title}}</title>
|
4
|
+
<style type="text/css">
|
5
|
+
body {
|
6
|
+
margin:40px auto;
|
7
|
+
background-color: #eeeeee;
|
8
|
+
max-width:650px;
|
9
|
+
line-height:1.6;
|
10
|
+
font-size:18px;
|
11
|
+
color:#444;
|
12
|
+
padding:0 10px;
|
13
|
+
font-family: "Segoe UI", sans-serif;
|
14
|
+
}
|
15
|
+
|
16
|
+
h1, h2, h3 {
|
17
|
+
line-height:1.2
|
18
|
+
}
|
19
|
+
</style>
|
20
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
21
|
+
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
|
22
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
|
23
|
+
</head>
|
24
|
+
|
25
|
+
<body>
|
26
|
+
<h1>Editing <span style="border: 1px solid gray" id="title-input" contenteditable>{{title}}</span></h1>
|
27
|
+
({{path}})
|
28
|
+
<p><a href="/edit">Back to Edit</a></p>
|
29
|
+
{{#canview}}
|
30
|
+
<p><a href="{{link}}">View on Site</a></p>
|
31
|
+
{{/canview}}
|
32
|
+
<p><button id="solutus-save-button" type="submit">Save</button></p>
|
33
|
+
<textarea id="solutus-mde">{{{markdown}}}</textarea>
|
34
|
+
|
35
|
+
<script>
|
36
|
+
var simplemde = new SimpleMDE({ element: document.getElementById("solutus-mde") });
|
37
|
+
|
38
|
+
function save() {
|
39
|
+
$.post("/savepost", {
|
40
|
+
"path": "{{path}}",
|
41
|
+
"title": $("#title-input").html(),
|
42
|
+
"markdown": simplemde.value()
|
43
|
+
}, function(response) {
|
44
|
+
console.log(response);
|
45
|
+
});
|
46
|
+
}
|
47
|
+
|
48
|
+
$("#solutus-save-button").click(save);
|
49
|
+
</script>
|
50
|
+
</body>
|
51
|
+
</html>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<head>
|
3
|
+
<title>Editing {{title}}</title>
|
4
|
+
|
5
|
+
<style type="text/css">
|
6
|
+
#solutus-editmenu {
|
7
|
+
width: 100%;
|
8
|
+
margin: 0;
|
9
|
+
padding: 15px;
|
10
|
+
background-color: #eeeeee;
|
11
|
+
font-family: sans-serif;
|
12
|
+
}
|
13
|
+
</style>
|
14
|
+
{{{stylesheets}}}
|
15
|
+
</head>
|
16
|
+
|
17
|
+
<body>
|
18
|
+
<div id="solutus-editmenu">
|
19
|
+
Editing <b>{{title}}</b> @ <code>{{path}}</code>
|
20
|
+
<button id="solutus-save-button">Save</button>
|
21
|
+
<a href="/edit">Back to Edit</a>
|
22
|
+
</div>
|
23
|
+
{{{everything}}}
|
24
|
+
{{{scripts}}}
|
25
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js"></script>
|
26
|
+
<script>
|
27
|
+
function save() {
|
28
|
+
$.post("/savepage", {
|
29
|
+
"path": "{{path}}",
|
30
|
+
"content": $("#solutus-content").html()
|
31
|
+
}, function(response) {
|
32
|
+
console.log(response);
|
33
|
+
});
|
34
|
+
}
|
35
|
+
|
36
|
+
$("#solutus-save-button").click(save);
|
37
|
+
</script>
|
38
|
+
</body>
|
39
|
+
</html>
|
data/resources/index.html
CHANGED
@@ -1,18 +1,53 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<head>
|
3
|
-
<title>Editing
|
3
|
+
<title>Editing {{name}}</title>
|
4
|
+
<style type="text/css">
|
5
|
+
body {
|
6
|
+
margin:40px auto;
|
7
|
+
background-color: #eeeeee;
|
8
|
+
max-width:650px;
|
9
|
+
line-height:1.6;
|
10
|
+
font-size:18px;
|
11
|
+
color:#444;
|
12
|
+
padding:0 10px;
|
13
|
+
font-family: "Segoe UI", sans-serif;
|
14
|
+
}
|
15
|
+
|
16
|
+
h1, h2, h3 {
|
17
|
+
line-height:1.2
|
18
|
+
}
|
19
|
+
</style>
|
4
20
|
</head>
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
</fieldset>
|
15
|
-
</
|
16
|
-
</
|
17
|
-
</
|
21
|
+
|
22
|
+
<body>
|
23
|
+
<h1>Editing {{name}}</h1>
|
24
|
+
<p><a href="/">View Site</a></p>
|
25
|
+
<p>
|
26
|
+
<form method="get" action="/editpage">
|
27
|
+
<fieldset>
|
28
|
+
<legend>Edit Page:</legend>
|
29
|
+
{{{pages}}}
|
30
|
+
<p><button type="submit">Edit page</button></fieldset></p>
|
31
|
+
</fieldset>
|
32
|
+
</form>
|
33
|
+
</p>
|
34
|
+
<p>
|
35
|
+
<form method="post" action="/newpost">
|
36
|
+
<fieldset>
|
37
|
+
<legend>New Blog Post:</legend>
|
38
|
+
<p><label for="post-title">Title:</label> <input type="text" name="post-title"></p>
|
39
|
+
<p><button type="submit">Create new blog post</button></fieldset></p>
|
40
|
+
</fieldset>
|
41
|
+
</form>
|
42
|
+
</p>
|
43
|
+
<p>
|
44
|
+
<form method="get" action="/editpost">
|
45
|
+
<fieldset>
|
46
|
+
<legend>Edit Blog Post:</legend>
|
47
|
+
{{{blogs}}}
|
48
|
+
<p><button type="submit">Edit blog post</button></fieldset></p>
|
49
|
+
</fieldset>
|
50
|
+
</form>
|
51
|
+
</p>
|
52
|
+
</body>
|
18
53
|
</html>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solutus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jerome Wei
|
@@ -9,7 +9,63 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2018-05-15 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sinatra
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mustache
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: redcarpet
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nokogiri
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
13
69
|
description: A miminal static site generator and local Web frontend
|
14
70
|
email: jeromew@berkeley.edu
|
15
71
|
executables:
|
@@ -20,6 +76,7 @@ files:
|
|
20
76
|
- bin/solutus
|
21
77
|
- lib/solutus.rb
|
22
78
|
- resources/editBlog.html
|
79
|
+
- resources/editPage.html
|
23
80
|
- resources/index.html
|
24
81
|
homepage: https://github.com/jeromew21/solutus
|
25
82
|
licenses:
|