pbsimply 3.2.0 → 3.2.1

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: e5daf76d579a8b8d21f8b893977d3790b6e6691556767bdabcdde407dffc59a6
4
- data.tar.gz: 0c13965208a4a164af7bc42b15dc21a0384e7f237c68ce838b5acdbd7153d2d9
3
+ metadata.gz: a7ba9b297d890ca650ba7e8e80481faeb37a94c853c2a6309306ffdb01bed604
4
+ data.tar.gz: 83083a80fcf51435a5dded559e7f455889367275752ab677f9affef66c91fe2c
5
5
  SHA512:
6
- metadata.gz: 64fe31554280fb22e7102888d921cf726902b17b35c72cf1aa864bf808ff52be0c28bc2148d1a3d86829cfb889d93f121c38b8cd01e88befb2ae96f69717e45a
7
- data.tar.gz: 6a3837dd70a72e487d71e5f882ce87ff1644e9025d978301ca99165bb0d9cbbbec070076642ae40ff99867dafd0686f2edd7c9d262cfffc3cd4cc27188668c45
6
+ metadata.gz: 377b47855124b9658c8dd3c82ab498dbd6719ec3fdd2ed1e727057c43ad2e544025a9cc2206d13776d9ce888f19356a7113ec5118a1e76b1f9b59a569d2d60a7
7
+ data.tar.gz: 8ea4cac700281cbccafc6b4acaa9c72249f9952c77183c265abdd6b41c4a871f2b4cbb784a8aac9d3b30745f31bb80d82b3bc015a49066a8667f6a70780e3efb
@@ -15,13 +15,13 @@ class PBSimply
15
15
  # Abstruct super class.
16
16
  class DocDB
17
17
  def dump(object)
18
- File.open(File.join(@dir, ".indexes.#{@ext}"), "w") do |f|
18
+ File.open(File.join(@dir, ".indexes.#{@ext}"), wmode) do |f|
19
19
  f.write @store_class.dump(object)
20
20
  end
21
21
  end
22
22
 
23
23
  def load
24
- File.open(File.join(@dir, ".indexes.#{@ext}"), "r") do |f|
24
+ File.open(File.join(@dir, ".indexes.#{@ext}"), rmode) do |f|
25
25
  next @store_class.load(f)
26
26
  end
27
27
  end
@@ -38,6 +38,14 @@ class PBSimply
38
38
  @store_class.load(@store_class.dump(frontmatter))
39
39
  end
40
40
 
41
+ def wmode
42
+ "w"
43
+ end
44
+
45
+ def rmode
46
+ "r"
47
+ end
48
+
41
49
  # Use Ruby Marshal
42
50
  class Marshal < DocDB
43
51
  def initialize(dir)
@@ -49,6 +57,14 @@ class PBSimply
49
57
  def cmp_obj(frontmatter)
50
58
  frontmatter.dup
51
59
  end
60
+
61
+ def wmode
62
+ "wb"
63
+ end
64
+
65
+ def rmode
66
+ "rb"
67
+ end
52
68
  end
53
69
 
54
70
  # Use JSON with bundled library
@@ -56,10 +56,11 @@ class PBSimply
56
56
  File.open(@workfile_frontmatter, "w") {|f| YAML.dump(frontmatter, f)}
57
57
 
58
58
  # Go Pandoc
59
- pandoc_cmdline = ["pandoc"]
60
- pandoc_cmdline += ["-d", @workfile_pandoc_defaultfiles, "--metadata-file", @workfile_frontmatter, "-M", "title:#{frontmatter["title"]}"]
59
+ pandoc_cmdline = [(@config["pandoc_command"] || "pandoc")]
60
+ pandoc_cmdline += ["-d", @workfile_pandoc_defaultfiles, "--metadata-file", @workfile_frontmatter, "-M", "title:#{frontmatter["title"]}", "-w", "html5"]
61
61
  pandoc_cmdline += ["-f", frontmatter["input_format"]] if frontmatter["input_format"]
62
62
  pandoc_cmdline += [ procdoc ]
63
+ pp pandoc_cmdline if ENV["DEBUG"] == "yes"
63
64
  IO.popen((pandoc_cmdline)) do |io|
64
65
  doc = io.read
65
66
  end
@@ -59,8 +59,9 @@ class PBSimply::Hooks
59
59
  end
60
60
  end
61
61
 
62
- def initialize(pbsimply)
62
+ def initialize(pbsimply, config)
63
63
  @pbsimply = pbsimply
64
+ @config = config
64
65
  @hooks_loaded = false
65
66
 
66
67
  # Called first phase before generate. This hooks called before blessing.
@@ -111,4 +112,6 @@ class PBSimply::Hooks
111
112
  attr :delete
112
113
  attr :post
113
114
  attr :accs
115
+
116
+ attr :config
114
117
  end
data/lib/pbsimply.rb CHANGED
@@ -74,6 +74,8 @@ class PBSimply
74
74
  DocDB::JSON.new(dir)
75
75
  when "oj"
76
76
  DocDB::Oj.new(dir)
77
+ when "marshal"
78
+ DocDB::Marshal.new(dir)
77
79
  else
78
80
  DocDB::Marshal.new(dir)
79
81
  end
@@ -106,7 +108,7 @@ class PBSimply
106
108
  @accs = nil
107
109
  @accs_index = {}
108
110
  @now = Time.now
109
- @hooks = PBSimply::Hooks.new(self)
111
+ @hooks = PBSimply::Hooks.new(self, @config)
110
112
  end
111
113
 
112
114
  # Process command-line
@@ -334,9 +336,6 @@ class PBSimply
334
336
 
335
337
  @accs = true if File.exist?(File.join(@dir, ".accs.yaml"))
336
338
 
337
- # Check existing in indexes.
338
- @indexes.delete_if {|k,v| ! File.exist?([@dir, k].join("/")) }
339
-
340
339
  proc_dir
341
340
  end
342
341
  end
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.2.0
4
+ version: 3.2.1
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-28 00:00:00.000000000 Z
11
+ date: 2024-03-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Pre compile, static serving website builder.
14
14
  email: