pbsimply 3.5.0 → 3.5.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 +4 -4
- data/lib/pbsimply/document.rb +9 -7
- data/lib/pbsimply/prayer.rb +2 -2
- data/lib/pbsimply.rb +21 -14
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1e6667388a878546c3fb8b5c5880661c66012a3ad65f4ce834fba8da89d470dc
|
|
4
|
+
data.tar.gz: 14b13fbe88d551bffb92d5a2c61f8e6a1378a437baa2a805a170e152314f37c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d650ffb297c0bd3ce21e05fc0edbb8d67f01c24af295b4a2ca387ccfacecefd81649469e7ddd1600958ed0943ba2f4bf46839fb6fbd0ed0c5d7e4c8efeede449
|
|
7
|
+
data.tar.gz: 5d35227c8476719684bc8c0abf04bf49ba4c34cbf065b487230750aeea5a1d0582b187299603ccdaf93d0047017b8a9b276bd6d8a49fa04c17ad577d173da1db
|
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/prayer.rb
CHANGED
|
@@ -78,13 +78,13 @@ module PBSimply::Prayer
|
|
|
78
78
|
begin
|
|
79
79
|
@article_order = @indexes.to_a.sort_by {|i| i[1]["date"]}
|
|
80
80
|
rescue
|
|
81
|
-
abort "*** Automatic Blessing Method Error: Maybe some article
|
|
81
|
+
abort "*** Automatic Blessing Method Error: Maybe some article has no date."
|
|
82
82
|
end
|
|
83
83
|
when "timestamp"
|
|
84
84
|
begin
|
|
85
85
|
@article_order = @indexes.to_a.sort_by {|i| i[1]["timestamp"]}
|
|
86
86
|
rescue
|
|
87
|
-
abort "*** Automatic Blessing Method Error: Maybe some article
|
|
87
|
+
abort "*** Automatic Blessing Method Error: Maybe some article has no timetsamp."
|
|
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
|
@@ -129,10 +129,15 @@ class PBSimply
|
|
|
129
129
|
@accs_index = {}
|
|
130
130
|
@now = Time.now
|
|
131
131
|
@hooks = PBSimply::Hooks.new(self, @config)
|
|
132
|
+
@dir = nil
|
|
133
|
+
@frontmatter = {}
|
|
134
|
+
@accs_processing = false
|
|
132
135
|
|
|
133
136
|
@debug = (ENV["DEBUG"] == "yes")
|
|
134
137
|
end
|
|
135
138
|
|
|
139
|
+
attr_reader :config, :dir, :frontmatter, :now, :accs_processing, :outfile
|
|
140
|
+
|
|
136
141
|
# Process command-line
|
|
137
142
|
def treat_cmdline(dir=nil)
|
|
138
143
|
# Options definition.
|
|
@@ -188,6 +193,7 @@ class PBSimply
|
|
|
188
193
|
def proc_dir
|
|
189
194
|
draft_articles = []
|
|
190
195
|
target_docs = []
|
|
196
|
+
effective_docs = []
|
|
191
197
|
$stderr.puts "in #{@dir}..."
|
|
192
198
|
|
|
193
199
|
$stderr.puts "Checking Frontmatter..."
|
|
@@ -207,7 +213,7 @@ class PBSimply
|
|
|
207
213
|
end
|
|
208
214
|
|
|
209
215
|
$stderr.puts "Checking frontmatter in #{filename}"
|
|
210
|
-
doc = Document.new(
|
|
216
|
+
doc = Document.new(self, filename)
|
|
211
217
|
|
|
212
218
|
if doc.draft?
|
|
213
219
|
draft_articles.push({
|
|
@@ -219,9 +225,13 @@ class PBSimply
|
|
|
219
225
|
end
|
|
220
226
|
|
|
221
227
|
doc.orig_frontmatter = @indexes[filename]
|
|
228
|
+
@indexes[filename] = doc.frontmatter
|
|
222
229
|
|
|
223
230
|
# Push to target documents without checking modification.
|
|
224
231
|
target_docs.push(doc)
|
|
232
|
+
|
|
233
|
+
# Push to all effective documents.
|
|
234
|
+
effective_docs.push(doc)
|
|
225
235
|
end
|
|
226
236
|
ENV.delete("pbsimply_currentdoc")
|
|
227
237
|
ENV.delete("pbsimply_filename")
|
|
@@ -231,20 +241,9 @@ class PBSimply
|
|
|
231
241
|
proc_docs target_docs
|
|
232
242
|
|
|
233
243
|
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
244
|
|
|
246
245
|
# Save index.
|
|
247
|
-
|
|
246
|
+
save_index(effective_docs) unless @skip_index
|
|
248
247
|
|
|
249
248
|
# ACCS processing
|
|
250
249
|
if @accs && !target_docs.empty?
|
|
@@ -371,7 +370,7 @@ class PBSimply
|
|
|
371
370
|
|
|
372
371
|
load_index
|
|
373
372
|
|
|
374
|
-
doc = Document.new(
|
|
373
|
+
doc = Document.new(self, filename)
|
|
375
374
|
@index = doc.frontmatter
|
|
376
375
|
|
|
377
376
|
proc_docs([doc])
|
|
@@ -479,4 +478,12 @@ class PBSimply
|
|
|
479
478
|
raise CommandLineError.new "ACCS-only processing needs ACCS directory as an argument."
|
|
480
479
|
end
|
|
481
480
|
end
|
|
481
|
+
|
|
482
|
+
def save_index(effective_docs)
|
|
483
|
+
new_indexes = {}
|
|
484
|
+
effective_docs.each do |doc|
|
|
485
|
+
new_indexes[doc.filename] = doc.effective_forntmatter
|
|
486
|
+
end
|
|
487
|
+
@db.dump(new_indexes)
|
|
488
|
+
end
|
|
482
489
|
end
|