pbsimply 3.5.0 → 3.6.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 +4 -4
- data/bin/pbsimply +26 -24
- data/bin/pbsimply-init +56 -2
- data/lib/pbsimply/config-checker.rb +0 -3
- data/lib/pbsimply/docengine/docutils.rb +3 -3
- data/lib/pbsimply/docengine/misc.rb +3 -3
- data/lib/pbsimply/docengine/pandoc.rb +3 -3
- data/lib/pbsimply/document.rb +9 -7
- data/lib/pbsimply/frontmatter.rb +2 -2
- data/lib/pbsimply/prayer.rb +6 -6
- data/lib/pbsimply.rb +58 -22
- data/themes/pandoc/_pandoc_base/.pbsimply.yaml +3 -3
- data/themes/pandoc/_pandoc_new/.pbsimply.yaml +3 -3
- data/themes/{kramdown/init322/.pbsimply.yaml → rbmdlib/init322/.pbsimply.yaml.erb} +15 -3
- data/themes/{kramdown → rbmdlib}/init322/.theme.yaml +2 -1
- metadata +11 -11
- /data/themes/{kramdown → rbmdlib}/init322/.accsindex.erb +0 -0
- /data/themes/{kramdown → rbmdlib}/init322/articles/.accs.yaml +0 -0
- /data/themes/{kramdown → rbmdlib}/init322/articles/20231028-untitled.md +0 -0
- /data/themes/{kramdown → rbmdlib}/init322/css/style.css +0 -0
- /data/themes/{kramdown → rbmdlib}/init322/index.md +0 -0
- /data/themes/{kramdown → rbmdlib}/init322/menu.yaml +0 -0
- /data/themes/{kramdown → rbmdlib}/init322/template.erb +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6fcd2dee987b89244eefee781f2992241ee22b1ad7093481d515096fdc69e002
|
|
4
|
+
data.tar.gz: 9cd6f3c059ee7e524e8cad9ceaefcd5af15e622e24cd51dbbce4e148f9913f92
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2685884928fc07a47d674b8a9b91b4c8fa91c9f2d510de24d984842bf29b40ff658950c68ae4d7c235bf519ccd2420cb5ae606f78db759e642d63a9a0ac04490
|
|
7
|
+
data.tar.gz: d6c32c4d2d9aa25abe78ec986934e4259f7823f263a34a8d33a98b282e8cd45dca968a3f244567c00e3d208ad6da1afdf2163e71e2c65f8a1e0f93b5c838128b
|
data/bin/pbsimply
CHANGED
|
@@ -2,35 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
require 'pbsimply'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
begin
|
|
6
|
+
PBSimply.find_docroot
|
|
7
|
+
config = PBSimply.load_config
|
|
7
8
|
|
|
8
|
-
pbs_class = case config["pbsimply_processor"]
|
|
9
|
-
when "docutils"
|
|
10
|
-
|
|
11
|
-
when "redcarpet"
|
|
12
|
-
|
|
13
|
-
when "kramdown"
|
|
14
|
-
|
|
15
|
-
when "cmark"
|
|
16
|
-
|
|
17
|
-
when "rdoc_markdown"
|
|
18
|
-
|
|
19
|
-
when "rdoc"
|
|
20
|
-
|
|
21
|
-
else
|
|
22
|
-
|
|
23
|
-
end
|
|
9
|
+
pbs_class = case config["pbsimply_processor"]
|
|
10
|
+
when "docutils"
|
|
11
|
+
PBSimply::Processor::Docutils
|
|
12
|
+
when "redcarpet"
|
|
13
|
+
PBSimply::Processor::PbsRedCarpet
|
|
14
|
+
when "kramdown"
|
|
15
|
+
PBSimply::Processor::PbsKramdown
|
|
16
|
+
when "cmark"
|
|
17
|
+
PBSimply::Processor::PbsCommonMark
|
|
18
|
+
when "rdoc_markdown"
|
|
19
|
+
PBSimply::Processor::PbsRMakrdown
|
|
20
|
+
when "rdoc"
|
|
21
|
+
PBSimply::Processor::PbsRDoc
|
|
22
|
+
else
|
|
23
|
+
PBSimply::Processor::Pandoc
|
|
24
|
+
end
|
|
24
25
|
|
|
25
|
-
# Alias for compatibility.
|
|
26
|
-
PureBuilder = pbs_class
|
|
26
|
+
# Alias for compatibility.
|
|
27
|
+
PureBuilder = pbs_class
|
|
27
28
|
|
|
28
|
-
begin
|
|
29
29
|
pbs = pbs_class.new(config)
|
|
30
30
|
pbs.treat_cmdline
|
|
31
31
|
|
|
32
32
|
pbs.main
|
|
33
|
-
rescue PBSimply::
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
rescue PBSimply::PBSimplyError => e
|
|
34
|
+
if PBSimply::ConfigChecker::InvalidConfigError === e.original_error
|
|
35
|
+
$stderr.puts e.original_error
|
|
36
|
+
end
|
|
37
|
+
abort e.to_s
|
|
36
38
|
end
|
data/bin/pbsimply-init
CHANGED
|
@@ -2,8 +2,28 @@
|
|
|
2
2
|
require 'yaml'
|
|
3
3
|
require 'fileutils'
|
|
4
4
|
require 'optparse'
|
|
5
|
+
require 'erb'
|
|
5
6
|
|
|
6
7
|
class PBSimplyInit
|
|
8
|
+
class ConfigErb
|
|
9
|
+
def initialize theme_dir, source_dir, build_dir
|
|
10
|
+
@theme_dir = theme_dir
|
|
11
|
+
@source_dir = source_dir
|
|
12
|
+
@build_dir = build_dir
|
|
13
|
+
|
|
14
|
+
@erb = ERB.new(File.read(File.join(@source_dir, ".pbsimply.yaml.erb")), trim_mode: "%")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
attr_writer :processor
|
|
18
|
+
|
|
19
|
+
def generate
|
|
20
|
+
generated_config = @erb.result(binding)
|
|
21
|
+
File.open(File.join(@source_dir, ".pbsimply.yaml"), "w") do |f|
|
|
22
|
+
f.puts generated_config
|
|
23
|
+
end
|
|
24
|
+
File.delete(File.join(@source_dir, ".pbsimply.yaml.erb"))
|
|
25
|
+
end
|
|
26
|
+
end
|
|
7
27
|
def initialize
|
|
8
28
|
set_gemroot
|
|
9
29
|
load_default_theme
|
|
@@ -33,6 +53,8 @@ class PBSimplyInit
|
|
|
33
53
|
list_theme
|
|
34
54
|
exit true
|
|
35
55
|
end
|
|
56
|
+
|
|
57
|
+
@config_erb_params = {}
|
|
36
58
|
end
|
|
37
59
|
|
|
38
60
|
def list_theme
|
|
@@ -43,8 +65,19 @@ class PBSimplyInit
|
|
|
43
65
|
themes[theme_name] ||= YAML.load File.read i
|
|
44
66
|
end
|
|
45
67
|
end
|
|
46
|
-
|
|
47
|
-
|
|
68
|
+
|
|
69
|
+
# Expand rbmdlib -> [kramdown, redcarpet, cmark]
|
|
70
|
+
rbmdlib = themes.keys.select {|i| i =~ %r:^rbmdlib/: }
|
|
71
|
+
rbmdlib.each do |k|
|
|
72
|
+
themes[k.sub(%r:^rbmdlib/:, "kramdown/")] = themes[k]
|
|
73
|
+
themes[k.sub(%r:^rbmdlib/:, "redcarpet/")] = themes[k]
|
|
74
|
+
themes[k.sub(%r:^rbmdlib/:, "cmark/")] = themes[k]
|
|
75
|
+
themes.delete k
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
sorted_keys = themes.keys.sort
|
|
79
|
+
sorted_keys.each do |k|
|
|
80
|
+
puts [k, themes[k]["name"], themes[k]["description"]].join(" ")
|
|
48
81
|
end
|
|
49
82
|
end
|
|
50
83
|
|
|
@@ -82,6 +115,20 @@ class PBSimplyInit
|
|
|
82
115
|
else
|
|
83
116
|
@theme = @default_theme
|
|
84
117
|
end
|
|
118
|
+
|
|
119
|
+
@config_erb_params[:processor] = @theme[0]
|
|
120
|
+
|
|
121
|
+
if %w:kramdown redcarpet cmark:.include? @theme[0]
|
|
122
|
+
unified_theme = @theme.clone
|
|
123
|
+
unified_theme[0] = "rbmdlib"
|
|
124
|
+
theme_path = search_theme unified_theme
|
|
125
|
+
if theme_path
|
|
126
|
+
@config_erb_params[:theme_dir] = theme_path
|
|
127
|
+
@theme = unified_theme
|
|
128
|
+
return load_theme_yaml theme_path
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
85
132
|
theme_path = search_theme @theme
|
|
86
133
|
load_theme_yaml theme_path
|
|
87
134
|
end
|
|
@@ -134,6 +181,13 @@ class PBSimplyInit
|
|
|
134
181
|
FileUtils.cp_r(File.join(@source_dir, *i), @build_dir)
|
|
135
182
|
end
|
|
136
183
|
end
|
|
184
|
+
|
|
185
|
+
if @theme_yaml["config_erb"]
|
|
186
|
+
$stderr.puts "Building .pbsimply.yaml..."
|
|
187
|
+
erb = ConfigErb.new(@config_erb_params[:theme_dir], @source_dir, @build_dir)
|
|
188
|
+
erb.processor = @config_erb_params[:processor]
|
|
189
|
+
erb.generate
|
|
190
|
+
end
|
|
137
191
|
end
|
|
138
192
|
|
|
139
193
|
$stderr.puts "Done"
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
class PBSimply
|
|
4
4
|
class ConfigChecker
|
|
5
|
-
class InvalidConfigError < StandardError
|
|
6
|
-
end
|
|
7
|
-
|
|
8
5
|
def self.verify_config config
|
|
9
6
|
# blessmethod_accs_rel
|
|
10
7
|
if config["blessmethod_accs_rel"] && ! %w:numbering date timestamp lexical:.include?(config["blessmethod_accs_rel"])
|
|
@@ -19,7 +19,7 @@ class PBSimply
|
|
|
19
19
|
elsif @config["css"].kind_of?(Array)
|
|
20
20
|
@docutils_cli_options.push("--stylesheet=#{@config["css"].join(",")}")
|
|
21
21
|
else
|
|
22
|
-
|
|
22
|
+
raise PBLoadError.new "css in Config should be a String or an Array."
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -44,9 +44,9 @@ class PBSimply
|
|
|
44
44
|
doc = io.read
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
# Abort if
|
|
47
|
+
# Abort if docutils returns non-zero status
|
|
48
48
|
if $?.exitstatus != 0
|
|
49
|
-
|
|
49
|
+
raise ProcessorError.new "Docutils (rst2html5) returns exit code #{$?.exitstatus}"
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
doc
|
|
@@ -66,14 +66,14 @@ class PBSimply
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def print_fileproc_msg(filename)
|
|
69
|
-
$stderr.puts "#{filename} generate with
|
|
69
|
+
$stderr.puts "#{filename} generate with Commonmarker (cmark-gfm)"
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def process_document(dir, filename, frontmatter, orig_filepath, ext, procdoc)
|
|
73
|
-
options = @config["commonmarker_options"]
|
|
73
|
+
options = @config["commonmarker_options"] ? @config["commonmarker_options"].transform_keys(&:to_sym) : {}
|
|
74
74
|
|
|
75
75
|
# Getting HTML string.
|
|
76
|
-
article_body =
|
|
76
|
+
article_body = Commonmarker.parse(File.read(procdoc), options: options).to_html
|
|
77
77
|
|
|
78
78
|
# Process with eRuby temaplte.
|
|
79
79
|
erb_template = ERB.new(File.read(@config["template"]), trim_mode: '%<>')
|
|
@@ -37,7 +37,7 @@ class PBSimply
|
|
|
37
37
|
elsif @config["css"].kind_of?(Array)
|
|
38
38
|
@pandoc_default_file["css"] = @config["css"]
|
|
39
39
|
else
|
|
40
|
-
|
|
40
|
+
raise PBLoadError.new "css in Config should be a String or an Array."
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -71,14 +71,14 @@ class PBSimply
|
|
|
71
71
|
pandoc_cmdline += ["-f", @pandoc_input_extmap[File.extname filename]]
|
|
72
72
|
end
|
|
73
73
|
pandoc_cmdline += [ procdoc ]
|
|
74
|
-
pp pandoc_cmdline if
|
|
74
|
+
pp pandoc_cmdline if $debug
|
|
75
75
|
IO.popen((pandoc_cmdline)) do |io|
|
|
76
76
|
doc = io.read
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
# Abort if pandoc returns non-zero status
|
|
80
80
|
if $?.exitstatus != 0
|
|
81
|
-
|
|
81
|
+
raise ProcessorError.new "Pandoc returns exit code #{$?.exitstatus}"
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
doc
|
data/lib/pbsimply/document.rb
CHANGED
|
@@ -4,15 +4,17 @@ class PBSimply
|
|
|
4
4
|
class Document
|
|
5
5
|
include Frontmatter
|
|
6
6
|
|
|
7
|
-
def initialize(
|
|
8
|
-
@config = config
|
|
9
|
-
@dir = dir
|
|
7
|
+
def initialize(pbs, filename)
|
|
8
|
+
@config = pbs.config
|
|
9
|
+
@dir = pbs.dir
|
|
10
10
|
@filename = filename
|
|
11
11
|
@ext = File.extname filename
|
|
12
|
-
@orig_filepath = File.join(dir, filename)
|
|
13
|
-
@now = now
|
|
14
|
-
|
|
15
|
-
@
|
|
12
|
+
@orig_filepath = File.join(pbs.dir, filename)
|
|
13
|
+
@now = pbs.now
|
|
14
|
+
@accs_processing = pbs.accs_processing
|
|
15
|
+
@outfile = pbs.outfile
|
|
16
|
+
frontmatter, @pos = read_frontmatter(pbs.dir, filename)
|
|
17
|
+
@frontmatter = pbs.frontmatter.merge frontmatter
|
|
16
18
|
@modified = true
|
|
17
19
|
@proc_doc_path = nil
|
|
18
20
|
end
|
data/lib/pbsimply/frontmatter.rb
CHANGED
|
@@ -131,8 +131,8 @@ module PBSimply::Frontmatter
|
|
|
131
131
|
end
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
raise DocumentError.new("This document has no frontmatter") unless frontmatter
|
|
135
|
+
raise DocumentError.new("This document has no title.") unless frontmatter["title"]
|
|
136
136
|
|
|
137
137
|
outpath = case
|
|
138
138
|
when @outfile
|
data/lib/pbsimply/prayer.rb
CHANGED
|
@@ -50,11 +50,11 @@ module PBSimply::Prayer
|
|
|
50
50
|
File.open(@workfile_frontmatter, "w") {|f| f.write PBSimply::JSON_LIB.dump(frontmatter) }
|
|
51
51
|
# BLESSING (Always)
|
|
52
52
|
if @config["bless_cmd"]
|
|
53
|
-
(Array === @config["bless_cmd"] ? system(*@config["bless_cmd"]) : system(@config["bless_cmd"]) ) or
|
|
53
|
+
(Array === @config["bless_cmd"] ? system(*@config["bless_cmd"]) : system(@config["bless_cmd"]) ) or raise BlessError.new "*** BLESS COMMAND RETURNS NON-ZERO STATUS"
|
|
54
54
|
end
|
|
55
55
|
# BLESSING (ACCS)
|
|
56
56
|
if @config["bless_accscmd"]
|
|
57
|
-
(Array === @config["bless_accscmd"] ? system({"pbsimply_workdir" => @workdir, "pbsimply_frontmatter" => @workfile_frontmatter, "pbsimply_indexes" => @db.path}, *@config["bless_accscmd"]) : system({"pbsimply_workdir" => @workdir, "pbsimply_frontmatter" => @workfile_frontmatter, "pbsimply_indexes" => @db.path}, @config["bless_accscmd"]) ) or
|
|
57
|
+
(Array === @config["bless_accscmd"] ? system({"pbsimply_workdir" => @workdir, "pbsimply_frontmatter" => @workfile_frontmatter, "pbsimply_indexes" => @db.path}, *@config["bless_accscmd"]) : system({"pbsimply_workdir" => @workdir, "pbsimply_frontmatter" => @workfile_frontmatter, "pbsimply_indexes" => @db.path}, @config["bless_accscmd"]) ) or raise BlessError.new "*** BLESS COMMAND RETURNS NON-ZERO STATUS"
|
|
58
58
|
end
|
|
59
59
|
mod_frontmatter = JSON.load(File.read(@workfile_frontmatter))
|
|
60
60
|
frontmatter.replace(mod_frontmatter)
|
|
@@ -77,14 +77,14 @@ module PBSimply::Prayer
|
|
|
77
77
|
when "date"
|
|
78
78
|
begin
|
|
79
79
|
@article_order = @indexes.to_a.sort_by {|i| i[1]["date"]}
|
|
80
|
-
rescue
|
|
81
|
-
|
|
80
|
+
rescue => e
|
|
81
|
+
raise BlessError.new("*** Automatic Blessing Method Error: Maybe some article has no date.", e)
|
|
82
82
|
end
|
|
83
83
|
when "timestamp"
|
|
84
84
|
begin
|
|
85
85
|
@article_order = @indexes.to_a.sort_by {|i| i[1]["timestamp"]}
|
|
86
|
-
rescue
|
|
87
|
-
|
|
86
|
+
rescue => e
|
|
87
|
+
raise BlessError.new("*** Automatic Blessing Method Error: Maybe some article has no timetsamp.", e)
|
|
88
88
|
end
|
|
89
89
|
when "lexical"
|
|
90
90
|
@article_order = @indexes.to_a.sort_by {|i| i[1]["_filename"]}
|
data/lib/pbsimply.rb
CHANGED
|
@@ -26,7 +26,37 @@ class PBSimply
|
|
|
26
26
|
include ACCS
|
|
27
27
|
|
|
28
28
|
# Custom exception
|
|
29
|
-
class
|
|
29
|
+
class PBSimplyError < StandardError
|
|
30
|
+
def initialize(*arg)
|
|
31
|
+
@original_error = nil
|
|
32
|
+
if arg.size == 2
|
|
33
|
+
@original_error = arg.pop
|
|
34
|
+
print_error(@original_error)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
super(*arg)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
attr_reader :original_error
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
def print_error(e)
|
|
44
|
+
$stderr.puts e.full_message if $debug && e
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
class CommandLineError < PBSimplyError
|
|
48
|
+
end
|
|
49
|
+
class BlessError < PBSimplyError
|
|
50
|
+
end
|
|
51
|
+
class PBLoadError < PBSimplyError
|
|
52
|
+
end
|
|
53
|
+
class DocumentError < PBSimplyError
|
|
54
|
+
end
|
|
55
|
+
class ProcessorError < PBSimplyError
|
|
56
|
+
end
|
|
57
|
+
class ConfigChecker
|
|
58
|
+
class InvalidConfigError < PBSimplyError
|
|
59
|
+
end
|
|
30
60
|
end
|
|
31
61
|
|
|
32
62
|
# Use Oj as JSON library for frontmatter passing if possible.
|
|
@@ -47,7 +77,7 @@ class PBSimply
|
|
|
47
77
|
until File.exist?(".pbsimply.yaml")
|
|
48
78
|
Dir.chdir ".."
|
|
49
79
|
if lastwd == Dir.pwd
|
|
50
|
-
|
|
80
|
+
raise PBLoadError.new "PureBuilder Simply document root not found."
|
|
51
81
|
end
|
|
52
82
|
lastwd = Dir.pwd
|
|
53
83
|
end
|
|
@@ -61,14 +91,12 @@ class PBSimply
|
|
|
61
91
|
config = Psych.unsafe_load(f)
|
|
62
92
|
end
|
|
63
93
|
ConfigChecker.verify_config config
|
|
64
|
-
rescue
|
|
65
|
-
|
|
66
|
-
rescue
|
|
67
|
-
abort "Failed to load config file (./.pbsimply.yaml)"
|
|
94
|
+
rescue => e
|
|
95
|
+
raise PBLoadError.new "Failed to load config file (./.pbsimply.yaml)", e
|
|
68
96
|
end
|
|
69
97
|
|
|
70
98
|
# Required values
|
|
71
|
-
config["outdir"] or
|
|
99
|
+
config["outdir"] or raise PBLoadError.new "Output directory is not set (outdir)."
|
|
72
100
|
config["template"] ||= "./template.html"
|
|
73
101
|
|
|
74
102
|
config
|
|
@@ -129,10 +157,15 @@ class PBSimply
|
|
|
129
157
|
@accs_index = {}
|
|
130
158
|
@now = Time.now
|
|
131
159
|
@hooks = PBSimply::Hooks.new(self, @config)
|
|
160
|
+
@dir = nil
|
|
161
|
+
@frontmatter = {}
|
|
162
|
+
@accs_processing = false
|
|
132
163
|
|
|
133
|
-
|
|
164
|
+
$debug = (ENV["DEBUG"] == "yes")
|
|
134
165
|
end
|
|
135
166
|
|
|
167
|
+
attr_reader :config, :dir, :frontmatter, :now, :accs_processing, :outfile
|
|
168
|
+
|
|
136
169
|
# Process command-line
|
|
137
170
|
def treat_cmdline(dir=nil)
|
|
138
171
|
# Options definition.
|
|
@@ -145,6 +178,7 @@ class PBSimply
|
|
|
145
178
|
opts.on("-o FILE", "--output") {|v| @outfile = v }
|
|
146
179
|
opts.on("-m FILE", "--additional-metafile") {|v| @add_meta = Psych.unsafe_load(File.read(v))}
|
|
147
180
|
opts.on("-a", "--only-accs") { @accs_only = true }
|
|
181
|
+
opts.on("--debug") { $debug = true }
|
|
148
182
|
opts.parse!(ARGV)
|
|
149
183
|
|
|
150
184
|
if File.exist?(".pbsimply-bless.rb")
|
|
@@ -188,6 +222,7 @@ class PBSimply
|
|
|
188
222
|
def proc_dir
|
|
189
223
|
draft_articles = []
|
|
190
224
|
target_docs = []
|
|
225
|
+
effective_docs = []
|
|
191
226
|
$stderr.puts "in #{@dir}..."
|
|
192
227
|
|
|
193
228
|
$stderr.puts "Checking Frontmatter..."
|
|
@@ -207,7 +242,7 @@ class PBSimply
|
|
|
207
242
|
end
|
|
208
243
|
|
|
209
244
|
$stderr.puts "Checking frontmatter in #{filename}"
|
|
210
|
-
doc = Document.new(
|
|
245
|
+
doc = Document.new(self, filename)
|
|
211
246
|
|
|
212
247
|
if doc.draft?
|
|
213
248
|
draft_articles.push({
|
|
@@ -219,9 +254,13 @@ class PBSimply
|
|
|
219
254
|
end
|
|
220
255
|
|
|
221
256
|
doc.orig_frontmatter = @indexes[filename]
|
|
257
|
+
@indexes[filename] = doc.frontmatter
|
|
222
258
|
|
|
223
259
|
# Push to target documents without checking modification.
|
|
224
260
|
target_docs.push(doc)
|
|
261
|
+
|
|
262
|
+
# Push to all effective documents.
|
|
263
|
+
effective_docs.push(doc)
|
|
225
264
|
end
|
|
226
265
|
ENV.delete("pbsimply_currentdoc")
|
|
227
266
|
ENV.delete("pbsimply_filename")
|
|
@@ -231,20 +270,9 @@ class PBSimply
|
|
|
231
270
|
proc_docs target_docs
|
|
232
271
|
|
|
233
272
|
delete_missing
|
|
234
|
-
|
|
235
|
-
# Update modified doc's frontmatter
|
|
236
|
-
if @preflight
|
|
237
|
-
target_docs.each do |doc|
|
|
238
|
-
@indexes[doc.filename] = doc.effective_forntmatter
|
|
239
|
-
end
|
|
240
|
-
else
|
|
241
|
-
target_docs.each do |doc|
|
|
242
|
-
@indexes[doc.filename] = doc.frontmatter
|
|
243
|
-
end
|
|
244
|
-
end
|
|
245
273
|
|
|
246
274
|
# Save index.
|
|
247
|
-
|
|
275
|
+
save_index(effective_docs) unless @skip_index
|
|
248
276
|
|
|
249
277
|
# ACCS processing
|
|
250
278
|
if @accs && !target_docs.empty?
|
|
@@ -371,7 +399,7 @@ class PBSimply
|
|
|
371
399
|
|
|
372
400
|
load_index
|
|
373
401
|
|
|
374
|
-
doc = Document.new(
|
|
402
|
+
doc = Document.new(self, filename)
|
|
375
403
|
@index = doc.frontmatter
|
|
376
404
|
|
|
377
405
|
proc_docs([doc])
|
|
@@ -479,4 +507,12 @@ class PBSimply
|
|
|
479
507
|
raise CommandLineError.new "ACCS-only processing needs ACCS directory as an argument."
|
|
480
508
|
end
|
|
481
509
|
end
|
|
510
|
+
|
|
511
|
+
def save_index(effective_docs)
|
|
512
|
+
new_indexes = {}
|
|
513
|
+
effective_docs.each do |doc|
|
|
514
|
+
new_indexes[doc.filename] = doc.effective_forntmatter
|
|
515
|
+
end
|
|
516
|
+
@db.dump(new_indexes)
|
|
517
|
+
end
|
|
482
518
|
end
|
|
@@ -106,12 +106,12 @@ pandoc_additional_options:
|
|
|
106
106
|
#redcarpet_extensions: {}
|
|
107
107
|
#
|
|
108
108
|
#################################################
|
|
109
|
-
#
|
|
109
|
+
# Commonmarker engine option
|
|
110
110
|
#################################################
|
|
111
111
|
#pbsimply_processor: cmark
|
|
112
112
|
#
|
|
113
|
-
# An
|
|
114
|
-
#commonmarker_options:
|
|
113
|
+
# An Hash showing `Commonmarker.prase`'s `options` argument.
|
|
114
|
+
#commonmarker_options: {}
|
|
115
115
|
#
|
|
116
116
|
#################################################
|
|
117
117
|
# Docutils engine option
|
|
@@ -103,12 +103,12 @@ pandoc_additional_options:
|
|
|
103
103
|
#redcarpet_extensions: {}
|
|
104
104
|
#
|
|
105
105
|
#################################################
|
|
106
|
-
#
|
|
106
|
+
# Commonmarker engine option
|
|
107
107
|
#################################################
|
|
108
108
|
#pbsimply_processor: cmark
|
|
109
109
|
#
|
|
110
|
-
# An
|
|
111
|
-
#commonmarker_options:
|
|
110
|
+
# An Hash showing `Commonmarker.prase`'s `options` argument.
|
|
111
|
+
#commonmarker_options: {}
|
|
112
112
|
#
|
|
113
113
|
#################################################
|
|
114
114
|
# Docutils engine option
|
|
@@ -88,24 +88,36 @@ self_url_external_prefix: https://example.com/
|
|
|
88
88
|
#################################################
|
|
89
89
|
# Kramdown engine option
|
|
90
90
|
#################################################
|
|
91
|
+
% if @processor == "kramdown"
|
|
91
92
|
pbsimply_processor: kramdown
|
|
93
|
+
% else
|
|
94
|
+
#pbsimply_processor: kramdown
|
|
95
|
+
% end
|
|
92
96
|
# An associative array passed as the second argument to `Kramdown::Document.new`. See the https://kramdown.gettalong.org/rdoc/Kramdown/Options.html for detail.
|
|
93
97
|
#kramdown_features: {}
|
|
94
98
|
#
|
|
95
99
|
#################################################
|
|
96
100
|
# RedCarpet engine option
|
|
97
101
|
#################################################
|
|
102
|
+
% if @processor == "redcarpet"
|
|
103
|
+
pbsimply_processor: redcarpet
|
|
104
|
+
% else
|
|
98
105
|
#pbsimply_processor: redcarpet
|
|
106
|
+
% end
|
|
99
107
|
# An associative array showing the extensions to Redcarpet. See the https://github.com/vmg/redcarpet for details.
|
|
100
108
|
#redcarpet_extensions: {}
|
|
101
109
|
#
|
|
102
110
|
#################################################
|
|
103
|
-
#
|
|
111
|
+
# Commonmarker engine option
|
|
104
112
|
#################################################
|
|
113
|
+
% if @processor == "cmark"
|
|
114
|
+
pbsimply_processor: cmark
|
|
115
|
+
% else
|
|
105
116
|
#pbsimply_processor: cmark
|
|
117
|
+
% end
|
|
106
118
|
#
|
|
107
|
-
# An
|
|
108
|
-
#commonmarker_options:
|
|
119
|
+
# An Hash showing `Commonmarker.prase`'s `options` argument.
|
|
120
|
+
#commonmarker_options: {}
|
|
109
121
|
#
|
|
110
122
|
#################################################
|
|
111
123
|
# Docutils engine option
|
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.
|
|
4
|
+
version: 3.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masaki Haruka
|
|
@@ -11,7 +11,7 @@ date: 1980-01-02 00:00:00.000000000 Z
|
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: A flexible, programmable static site generator for Markdown, reStructuredText,
|
|
13
13
|
and RDoc formats. PureBuilder Simply supports both embedded and external content
|
|
14
|
-
processors—including Kramdown, Redcarpet,
|
|
14
|
+
processors—including Kramdown, Redcarpet, Commonmarker, RDoc, Pandoc, Docutils—and
|
|
15
15
|
enables customizable conversion workflows and CLI-based project generation.
|
|
16
16
|
email:
|
|
17
17
|
- yek@reasonset.net
|
|
@@ -43,15 +43,6 @@ files:
|
|
|
43
43
|
- lib/pbsimply/prayer.rb
|
|
44
44
|
- themes/contribute/README.md
|
|
45
45
|
- themes/default.yaml
|
|
46
|
-
- themes/kramdown/init322/.accsindex.erb
|
|
47
|
-
- themes/kramdown/init322/.pbsimply.yaml
|
|
48
|
-
- themes/kramdown/init322/.theme.yaml
|
|
49
|
-
- themes/kramdown/init322/articles/.accs.yaml
|
|
50
|
-
- themes/kramdown/init322/articles/20231028-untitled.md
|
|
51
|
-
- themes/kramdown/init322/css/style.css
|
|
52
|
-
- themes/kramdown/init322/index.md
|
|
53
|
-
- themes/kramdown/init322/menu.yaml
|
|
54
|
-
- themes/kramdown/init322/template.erb
|
|
55
46
|
- themes/pandoc/_pandoc_base/.accsindex.erb
|
|
56
47
|
- themes/pandoc/_pandoc_base/.pbsimply.yaml
|
|
57
48
|
- themes/pandoc/_pandoc_base/css/base.css
|
|
@@ -86,6 +77,15 @@ files:
|
|
|
86
77
|
- themes/pandoc/practical/css/layout.css
|
|
87
78
|
- themes/pandoc/warm/.theme.yaml
|
|
88
79
|
- themes/pandoc/warm/css/base.css
|
|
80
|
+
- themes/rbmdlib/init322/.accsindex.erb
|
|
81
|
+
- themes/rbmdlib/init322/.pbsimply.yaml.erb
|
|
82
|
+
- themes/rbmdlib/init322/.theme.yaml
|
|
83
|
+
- themes/rbmdlib/init322/articles/.accs.yaml
|
|
84
|
+
- themes/rbmdlib/init322/articles/20231028-untitled.md
|
|
85
|
+
- themes/rbmdlib/init322/css/style.css
|
|
86
|
+
- themes/rbmdlib/init322/index.md
|
|
87
|
+
- themes/rbmdlib/init322/menu.yaml
|
|
88
|
+
- themes/rbmdlib/init322/template.erb
|
|
89
89
|
homepage: https://purebuilder.app/
|
|
90
90
|
licenses:
|
|
91
91
|
- Apache-2.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|