25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/polites/nanoc/data_source.rb', line 25
def items
@input_files.flat_map do |input_file|
File.open(input_file) do |file|
sheet = @parser.parse_sheet(file.content)
inline_file_items = sheet.inline_files.map do |image|
build_file_item(file.media(image.image), image.image, input_file, image.filename)
end
file_items = sheet.attached_files.map do |id|
build_file_item(file.media(id), id, input_file)
end
[
new_item(
@formatter.call(sheet),
{
keywords: sheet.keywords,
image: sheet.attached_files.first,
image_caption: sheet.notes.any? ? @formatter.call(sheet.notes.first) : nil,
inline_file_items: inline_file_items,
filename: input_file.to_s,
mtime: input_file.mtime
},
identifier(input_file)
),
*inline_file_items,
*file_items
]
end
end
end
|