History

Merge pull request #1293 from simon04/about-docs-metadata

/about: Obtain credits from docs metadata

Simon Legner committed 3 years ago

Commit 604cfd22 parents 310ce5d eac7f965 files · +27 −942Browse files

Showing the changes to lib/docs (2 of 5 files). Show all

Unified · Split

2 files
  1. lib/docs/core/doc.rb +8 −0
  2. lib/docs/core/manifest.rb +1 −1
lib/docs/core/doc.rb+8−0
@@ -86,6 +86,14 @@ module Docs · 85 unmodified lines
86 json86 json
87 end87 end
88 88
89 def as_json_extra(store)
90 json = self.as_json
91 json[:attribution] = options[:attribution].strip if self.class.method_defined?(:options) and options[:attribution].present?
92 json[:db_size] = store.size(self.db_path) if store.exist?(self.db_path)
93 json[:mtime] = store.mtime(self.meta_path).to_i if store.exist?(self.meta_path)
94 json
95 end
96
89 def store_page(store, id)97 def store_page(store, id)
90 index = EntryIndex.new98 index = EntryIndex.new
91 pages = PageDb.new99 pages = PageDb.new
lib/docs/core/manifest.rb+1−1
@@ -16,7 +16,7 @@ module Docs · 15 unmodified lines
16 def as_json16 def as_json
17 @docs.each_with_object [] do |doc, result|17 @docs.each_with_object [] do |doc, result|
18 next unless @store.exist?(doc.meta_path)18 next unless @store.exist?(doc.meta_path)
19 result << JSON.parse(@store.read(doc.meta_path))19 result << doc.as_json_extra(@store)
20 end20 end
21 end21 end
22 22