11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/doc_template/tables/activity.rb', line 11
def parse(fragment, *args)
template_type = args.[:template_type].presence || 'core'
idx = 0
[].tap do |result|
fragment.xpath(, XpathFunctions.new).each do |el|
table = el.ancestors('table').first
data = fetch table
data = process_title(data)
if data['activity-title'].present?
idx += 1
value = "#{idx}-#{template_type}-l2-#{data['activity-title']}".parameterize
data['idx'] = idx
data['anchor'] = value
= "<p><span>[#{::DocTemplate::Tags::ActivityMetadataTypeTag::TAG_NAME}: #{value}]</span></p>"
table.add_next_sibling
end
table.remove
data = fetch_materials data, MATERIALS_KEY
result << data
end
end
end
|