pbsimply 3.1.0 → 3.2.0

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: 5c2cee1a598dad5d08c823c51768afebae4d8e0459b3507658ca10a613c33bc4
4
- data.tar.gz: c13273c93cc68212ad5bb72b785dc01a640415c03bc5be98faccee449f8c54ee
3
+ metadata.gz: e5daf76d579a8b8d21f8b893977d3790b6e6691556767bdabcdde407dffc59a6
4
+ data.tar.gz: 0c13965208a4a164af7bc42b15dc21a0384e7f237c68ce838b5acdbd7153d2d9
5
5
  SHA512:
6
- metadata.gz: 1e90c599fc508e0e44aa1e882dca4de285f150dde10eecfaf7c22d20ca674cd4b29be5ace1a139a8fe36b5581afd1d81438c168c2823739a0ef1ddfbeacf1116
7
- data.tar.gz: e0a079093ca72cc0575b7858a687e838a8c848ff9c9eff036cba99e7678ee9de4f098890d619e1b5078049252f4b277bb20fc09c50d4db0488c4fb148e88ed58
6
+ metadata.gz: 64fe31554280fb22e7102888d921cf726902b17b35c72cf1aa864bf808ff52be0c28bc2148d1a3d86829cfb889d93f121c38b8cd01e88befb2ae96f69717e45a
7
+ data.tar.gz: 6a3837dd70a72e487d71e5f882ce87ff1644e9025d978301ca99165bb0d9cbbbec070076642ae40ff99867dafd0686f2edd7c9d262cfffc3cd4cc27188668c45
data/bin/pbsimply-init ADDED
@@ -0,0 +1,371 @@
1
+ #!/bin/env ruby
2
+ require 'fileutils'
3
+
4
+ module PBSimplyInit
5
+ end
6
+
7
+ PBSimplyInit::YAML = <<EOF
8
+ ---
9
+ # Built documents output path.
10
+ # ../Build means Build directory on Source document root's parent directory.
11
+ outdir: ../Build
12
+ #outdir: /home/foo/public_html/
13
+ #
14
+ # Template file path.
15
+ # ./template.html by default.
16
+ template: template.erb
17
+ #
18
+ # Loading CSS files (userd by Pandoc's default template.)
19
+ # This values must be *server's URL*.
20
+ # This settings is not avilable on rdoc, rdoc_markdown, kramdown, redcarpet or cmark engine.
21
+ #css:
22
+ # - /css/layout.css
23
+ # - /css/base.css#
24
+ # Enable TOC. true or false. false by default.
25
+ # This settings is not avilable on rdoc, rdoc_markdown, kramdown, redcarpet, cmark or docutils engine.
26
+ # toc: true
27
+ #
28
+ # Enable eRuby template expansion. true or false. false by default.
29
+ # This settings is not avilable on rdoc, rdoc_markdown, kramdown, redcarpet or cmark engine.
30
+ post_eruby: false
31
+ # Default metadata. If same key exists in document's frontmatter, document's frontmatter is given priority to this settings.
32
+ default_meta:
33
+ author: "John Doe"
34
+ site_title: "My first blog"
35
+ #
36
+ # Override every ACCS index page's frontmatter.
37
+ alt_frontmatter:
38
+ title: Serial documents by ACCS
39
+ #
40
+ # Testserver (pbsimply-testserver.rb)'s port. 8000 by default.
41
+ #testserver_port: 8000
42
+ #
43
+ # Generated document's URL absolute prefix. This value replaces reading /.
44
+ #self_url_prefix: /foowebsite/
45
+ #
46
+ # Generated document's URL absolute prefix. This value replaces reading /. Used by page_url_encoded_external.
47
+ self_url_external_prefix: https://example.com/
48
+ # Database format. use JSON if set json or oj.
49
+ #dbstyle: json
50
+ #
51
+ # Blessing way. If cmd given, you external command instead of Ruby function.
52
+ #bless_style: cmd
53
+ #
54
+ # Blessing external command
55
+ #bless_cmd: [echo, BLESS]
56
+ #
57
+ # Blessing external command on ACCS.
58
+ #bless_accscmd: [echo, ACCS]
59
+ #
60
+ # Method control for find ACCS next/prev.
61
+ # numbering, date, timestamp, lexical
62
+ #blessmethod_accs_rel: date
63
+ #
64
+ # Delete output file automatically when lose source document.
65
+ #auto_delete: yes
66
+ #
67
+ #################################################
68
+ # Pandoc engine option
69
+ #################################################
70
+ #pbsimply_processor: pandoc
71
+ #
72
+ # Pandoc's default file settings.
73
+ # It is merge into default file. See https://pandoc.org/MANUAL.html#default-files
74
+ # This option used only by pandoc engine.
75
+ #pandoc_additional_options:
76
+ # metadata:
77
+ # lang: ja
78
+ # title-prefix: "Powered by PureBuilder Simply"
79
+ # include-before-body:
80
+ # - before.html
81
+ # include-after-body:
82
+ # - after.html
83
+ #
84
+ #################################################
85
+ # Kramdown engine option
86
+ #################################################
87
+ pbsimply_processor: kramdown
88
+ # An associative array passed as the second argument to `Kramdown::Document.new`. See the https://kramdown.gettalong.org/rdoc/Kramdown/Options.html for detail.
89
+ #kramdown_features: {}
90
+ #
91
+ #################################################
92
+ # RedCarpet engine option
93
+ #################################################
94
+ #pbsimply_processor: redcarpet
95
+ # An associative array showing the extensions to Redcarpet. See the https://github.com/vmg/redcarpet for details.
96
+ #redcarpet_extensions: {}
97
+ #
98
+ #################################################
99
+ # Docutils engine option
100
+ #################################################
101
+ #pbsimply_processor: docutils
102
+ # rst2html5 command line options.
103
+ #docutils_options: []
104
+ EOF
105
+
106
+ PBSimplyInit::TEMPLATE = <<EOF
107
+ <!DOCTYPE html>
108
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
109
+ <head>
110
+ <meta charset="utf-8" />
111
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
112
+ <meta name="date" content="<%= frontmatter["date"] %>" />
113
+ <link rel="stylesheet" href="/css/style.css" />
114
+ <title><%= frontmatter["title"] %></title>
115
+ </head>
116
+ <body>
117
+ <div id="Overall">
118
+ <div id="BannerHeader">
119
+ <h1><%= frontmatter["site_title"] %></h1>
120
+ <h2><%= frontmatter["title"] %></h2>
121
+ </div>
122
+ <div id="ContentContainer">
123
+ <nav id="NavigationColumn">
124
+ <ul>
125
+ <%
126
+ require 'yaml'
127
+ menu = YAML.load File.read("menu.yaml")
128
+ %><% menu.each {|k, v| %><%= sprintf('<li><a href="%s">%s</a></li>', v, k) %><% } %>
129
+ </ul>
130
+ </nav>
131
+ <article id="MainArticle"><%= article_body %></aritcle>
132
+ </div>
133
+ <footer id="PBSimply">
134
+ Powered by <a href="https://purebuilder.app/">PureBuilder Simply</a>
135
+ </footer>
136
+ </div>
137
+ </body>
138
+ </html>
139
+ EOF
140
+
141
+ PBSimplyInit::CSS = <<EOF
142
+ body, html {
143
+ margin: 0;
144
+ padding: 0;
145
+ }
146
+ #Overall {
147
+ max-width: 800px;
148
+ margin: 0 auto;
149
+ }
150
+ #BannerHeader {
151
+ height: 200px;
152
+ width: 100%;
153
+ }
154
+ #ContentContainer {
155
+ display: flex;
156
+ width: 100%;
157
+ }
158
+ #BannerHeader {
159
+ background-color: #8eafe3;
160
+ border-radius: 2px;
161
+ color: #000;
162
+ }
163
+ #BannerHeader h1 {
164
+ font-size: 2.1rem;
165
+ text-align: center;
166
+ position: relative;
167
+ top: calc(50% - 1em);
168
+ }
169
+ #BannerHeader h2 {
170
+ font-size: 1.2rem;
171
+ text-align: center;
172
+ position: relative;
173
+ top: 1.25em;
174
+ }
175
+
176
+ #NavigationColumn ul {
177
+ list-style-type: none;
178
+ list-style-position: outside;
179
+ margin: 3px;
180
+ padding: 0;
181
+ text-align: center;
182
+ }
183
+ #NavigationColumn li {
184
+ background-color: #b9bced;
185
+ border: 2px solid #6367a1;
186
+ color: #000;
187
+ border-radius: 4px;
188
+ margin: 3px 1px;
189
+ padding: 2px;
190
+ }
191
+ #NavigationColumn a {
192
+ color: rgb(57, 18, 183);
193
+ text-decoration: none;
194
+ }
195
+ #MainArticle {
196
+ color: #666;
197
+ padding: 8px;
198
+ }
199
+ #MainArticle h1, #MainArticle h2, #MainArticle h3, #MainArticle h4, #MainArticle h5, #MainArticle h6 {
200
+ color: #333;
201
+ }
202
+ #PBSimply {
203
+ padding: 8px;
204
+ text-align: right;
205
+ border-top: 2px solid #6b84df;
206
+ }
207
+ @media screen and (min-width: 800px) {
208
+ #ContentContainer { flex-direction: row; }
209
+ #NavigationColumn {
210
+ order: 1;
211
+ width: 250px;
212
+ }
213
+ #MainArticle {
214
+ order: 2;
215
+ width: 550px;
216
+ }
217
+ }
218
+ @media screen and (max-width: 799px) {
219
+ #ContentContainer { flex-direction: column; }
220
+ #NavigationColumn {
221
+ order: 2;
222
+ width: 100%;
223
+ }
224
+ #MainArticle {
225
+ order: 1;
226
+ width: 100%;
227
+ }
228
+ }
229
+
230
+ a {
231
+ color: #4e1efd;
232
+ }
233
+ EOF
234
+
235
+ PBSimplyInit::INDEXMD = <<EOF
236
+ ---
237
+ title: First article
238
+ date: 1970-01-01
239
+ ---
240
+
241
+ # This is first article
242
+
243
+ This file is shown at top page.
244
+
245
+ The first step, edit index.md file on document source root.
246
+ EOF
247
+
248
+ PBSimplyInit::MENUYAML = <<EOF
249
+ ---
250
+ Top page: /
251
+ Article list: /articles
252
+ EOF
253
+
254
+ PBSimplyInit::ACCSYAML = <<EOF
255
+ ---
256
+ title: 1st series
257
+ EOF
258
+
259
+ PBSimplyInit::ACCSINDEX = <<EOF
260
+ ---
261
+ title: <%= @index["title"] %>
262
+ date: <%= @index["date"] %>
263
+ accsindex: yes
264
+ ---
265
+
266
+ <%
267
+ articles = Hash.new {|h,k| h[k] = Array.new }
268
+
269
+ @indexes.each do |filename, index|
270
+ articles[(index["category"] || "default")].push index
271
+ end
272
+
273
+ %>
274
+
275
+ % artkeys = articles.keys.sort
276
+ % artkeys.each do |catname|
277
+ % cat = articles[catname]
278
+
279
+ % if articles.length > 1
280
+ # <%= catname %>
281
+ % end
282
+
283
+ <%
284
+ list = if @config["accs_order"] == "desc" || @index["accs_order"] == "desc" || @index["blogmode"]
285
+ cat.sort_by {|i| [i["date"].to_s, i["title"].to_s, i["_last_update"].to_i] }.reverse
286
+ else
287
+ cat.sort_by {|i| [i["date"].to_s, i["title"].to_s, i["_last_update"].to_i] }
288
+ end
289
+
290
+ list.each do |i|
291
+ %>* [<%= i["title"].gsub('@', '\@') %>](<%= File.basename(i["_filename"].to_s, ".*") + ".html" %>) (<%= i["date"] %>)
292
+ <% end %>
293
+
294
+ % end
295
+ EOF
296
+
297
+ PBSimplyInit::ACCSARTICLE = <<EOF
298
+ ---
299
+ title: Untitled series 1
300
+ date: 2023-10-28
301
+ category: PureBuilder Simply
302
+ ---
303
+
304
+ # Untitled article
305
+
306
+ This is a series article sample.
307
+
308
+ `/articles` folder is set up as ACCS directory.
309
+ ACCS recognize articles as series, and generate index page automatically.
310
+
311
+ # How to add new article?
312
+
313
+ Add source document on `/articles`, and do `pbsimply articles`.
314
+
315
+ `pbsimply` will detect modified or new article and build it.
316
+
317
+ # How to remove this article?
318
+
319
+ Remove `/articles/20231028-untitled.md` and `../Build/articles/20231028-untitled.html`, and do `pbsimply articles`.
320
+ EOF
321
+
322
+ filepath = ARGV.shift
323
+ filepath ||= "."
324
+
325
+ if File.exist? filepath and (!File.directory? filepath)
326
+ abort "File #{filepath} is not directory."
327
+ end
328
+
329
+ if File.exist? filepath and Dir.children(filepath).length > 0
330
+ abort "File #{filepath} is not empty."
331
+ end
332
+
333
+ FileUtils.mkdir_p(File.join(filepath, "Source"))
334
+ FileUtils.mkdir_p(File.join(filepath, "Build"))
335
+
336
+ File.open(File.join(filepath, "Source", ".pbsimply.yaml"), "w") do |f|
337
+ f.puts PBSimplyInit::YAML
338
+ end
339
+
340
+ File.open(File.join(filepath, "Source", ".accsindex.erb"), "w") do |f|
341
+ f.puts PBSimplyInit::ACCSINDEX
342
+ end
343
+
344
+ File.open(File.join(filepath, "Source", "template.erb"), "w") do |f|
345
+ f.puts PBSimplyInit::TEMPLATE
346
+ end
347
+
348
+ File.open(File.join(filepath, "Source", "index.md"), "w") do |f|
349
+ f.puts PBSimplyInit::INDEXMD
350
+ end
351
+
352
+ File.open(File.join(filepath, "Source", "menu.yaml"), "w") do |f|
353
+ f.puts PBSimplyInit::MENUYAML
354
+ end
355
+
356
+ FileUtils.mkdir_p(File.join(filepath, "Source", "css"))
357
+ File.open(File.join(filepath, "Source", "css", "style.css"), "w") do |f|
358
+ f.puts PBSimplyInit::CSS
359
+ end
360
+
361
+ FileUtils.cp_r(File.join(filepath, "Source", "css"), File.join(filepath, "Build", "css"))
362
+
363
+ FileUtils.mkdir_p(File.join(filepath, "Source", "articles"))
364
+ File.open(File.join(filepath, "Source", "articles", ".accs.yaml"), "w") do |f|
365
+ f.puts PBSimplyInit::ACCSYAML
366
+ end
367
+
368
+ FileUtils.mkdir_p(File.join(filepath, "Source", "articles"))
369
+ File.open(File.join(filepath, "Source", "articles", "20231028-untitled.md"), "w") do |f|
370
+ f.puts PBSimplyInit::ACCSARTICLE
371
+ end
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby
1
+ #!/bin/env ruby
2
2
  # -*- mode: ruby; coding: UTF-8 -*-
3
3
 
4
4
  require 'webrick'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pbsimply
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaki Haruka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-16 00:00:00.000000000 Z
11
+ date: 2023-10-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Pre compile, static serving website builder.
14
14
  email:
@@ -16,10 +16,12 @@ email:
16
16
  executables:
17
17
  - pbsimply
18
18
  - pbsimply-testserver
19
+ - pbsimply-init
19
20
  extensions: []
20
21
  extra_rdoc_files: []
21
22
  files:
22
23
  - bin/pbsimply
24
+ - bin/pbsimply-init
23
25
  - bin/pbsimply-testserver
24
26
  - lib/pbsimply.rb
25
27
  - lib/pbsimply/accs.rb