pbsimply 3.7.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d2819cbfc7057533e6c680ba3ee1b8dc30117eb532e7061a778437b2a5f3433
4
- data.tar.gz: fe9e02ca45a41d2a7649ea4b47be2230f52bf516b8b03722a4c6448be75d99b1
3
+ metadata.gz: 717a87ae1856795d8986e631c8d5d116755d6424a6e1dd1c2327e7d06eaac809
4
+ data.tar.gz: c36c32dd6bff2322e7424930a557a247354a05095f61f748940ea946e7f156ce
5
5
  SHA512:
6
- metadata.gz: 20eefe2e45fb693831c91fda93007f64782d7ebcc37fc8a964709f506771a0e7b60b03612b16fdc5edd1f59c0e6ac0c51065c51447074bca1c3ca36727a4642b
7
- data.tar.gz: 673a659f5af31b89441e048e1896e3773d385404a9dcc9055fcc93ec85f95d2945e7daef92c6d0fd86ed23c39e73767949a5f66da732a450e97a613e08c24557
6
+ metadata.gz: 129096f38f40fcce9d44f6c4e3a530a163d84b0211047dddf89b3a0d044e7fa54d62d1da7a51802824b58e0cc5f809e8237e01454dc874b1c159aec45f6339e2
7
+ data.tar.gz: 69dbd490e5cdd2194d04037fa04605ca8c1968304cdf8cf39e8bddddd17cf587d41b36dc20f7b70c126676d5173d69ad3a61cdfe3f7136df051f1f095350c76b
@@ -13,8 +13,8 @@ class PBSimply
13
13
  @now = pbs.now
14
14
  @accs_processing = pbs.accs_processing
15
15
  @outfile = pbs.outfile
16
- frontmatter, @pos = read_frontmatter(pbs.dir, filename)
17
- @frontmatter = pbs.frontmatter.merge frontmatter
16
+ fmt, @pos = read_frontmatter(pbs.dir, filename)
17
+ @frontmatter = pbs.frontmatter.merge fmt
18
18
  @modified = true
19
19
  @proc_doc_path = nil
20
20
  end
@@ -42,7 +42,7 @@ class PBSimply
42
42
  end
43
43
 
44
44
  def draft?
45
- frontmatter["draft"]
45
+ frontmatter["draft"] || frontmatter["pbsimply_exclude"]
46
46
  end
47
47
 
48
48
  def to_a
@@ -1,6 +1,8 @@
1
1
  #!/bin/env ruby
2
2
  require 'erb'
3
3
  require 'yaml'
4
+ require 'time'
5
+ require 'date'
4
6
 
5
7
  module PBSimply::Frontmatter
6
8
  # Read Frontmatter from the document.
@@ -132,6 +134,11 @@ module PBSimply::Frontmatter
132
134
  end
133
135
 
134
136
  raise PBSimply::DocumentError.new("This document has no frontmatter") unless frontmatter
137
+
138
+ if (frontmatter["draft"] || frontmatter["pbsimply_exclude"])
139
+ return frontmatter, pos
140
+ end
141
+
135
142
  raise PBSimply::DocumentError.new("This document has no title.") unless frontmatter["title"]
136
143
 
137
144
  outpath = case
@@ -170,8 +177,7 @@ module PBSimply::Frontmatter
170
177
  frontmatter["title_encoded"] = ERB::Util.url_encode(frontmatter["title"])
171
178
  frontmatter["title_html_escaped"] = ERB::Util.html_escape(frontmatter["title"])
172
179
  fts = frontmatter["timestamp"]
173
- fts = fts.to_datetime if Time === fts
174
- if DateTime === fts
180
+ if Time === fts || DateTime === fts
175
181
  frontmatter["timestamp_xmlschema"] = fts.xmlschema
176
182
  frontmatter["timestamp_jplocal"] = fts.strftime('%Y年%m月%d日 %H時%M分%S秒')
177
183
  frontmatter["timestamp_rubytimestr"] = fts.strftime('%a %b %d %H:%M:%S %Z %Y')
data/lib/pbsimply.rb CHANGED
@@ -227,13 +227,19 @@ class PBSimply
227
227
  draft_articles = []
228
228
  target_docs = []
229
229
  effective_docs = []
230
+ exclude_files = []
230
231
  $stderr.puts "in #{@dir}..."
231
232
 
233
+ # Check exclude file
234
+ if File.exist?(File.join(@dir, ".pbsimply-exclude"))
235
+ exclude_files = File.read(File.join(@dir, ".pbsimply-exclude")).each_line.map(&:chomp).reject(&:empty?)
236
+ end
237
+
232
238
  $stderr.puts "Checking Frontmatter..."
233
239
  Dir.foreach(@dir) do |filename|
234
240
  next if filename == "." || filename == ".." || filename == ".index.md"
235
241
  next unless File.file? File.join(@dir, filename)
236
- if filename =~ /^\./ || filename =~ /^draft-/
242
+ if filename =~ /^\./ || filename =~ /^draft-/ || exclude_files.include?(filename)
237
243
  draft_articles.push({
238
244
  article_filename: filename.sub(/^(?:\.|draft-)/, ""),
239
245
  filename: filename,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pbsimply
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaki Haruka
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
112
  requirements: []
113
- rubygems_version: 3.6.9
113
+ rubygems_version: 4.0.3
114
114
  specification_version: 4
115
115
  summary: Flexible and programmable static site generator with pluggable Markdown engines
116
116
  test_files: []