13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/bluedoc/sml/rules/file.rb', line 13
def self.to_html(node, opts = {})
attrs = attributes(node)
attrs[:name] ||= ""
return attrs[:name] if attrs[:src].blank?
humanize_size = number_to_human_size(attrs[:size] || 0)
file_type = (::File.extname(attrs[:name]) || "none").sub(".", "")
nid_attr = name_by_attrs(attrs)
out = " <a class=\"attachment-file\" title=\"\#{attrs[:name]}\" target=\"_blank\" href=\"\#{attrs[:src]}\"\#{nid_attr}>\n <span class=\"icon-box\"><i class=\"fas fa-file fa-\#{file_type}-file\"></i></span>\n <span class=\"filename\">\#{escape_html(attrs[:name])}</span>\n <span class=\"filesize\">\#{escape_html(humanize_size)}</span>\n </a>\n HTML\n\n out\nend\n"
|