Class: Alula::AttachmentTag
- Inherits:
-
Tag
- Object
- Liquid::Tag
- Tag
- Alula::AttachmentTag
show all
- Defined in:
- lib/alula/core_ext/tags/attachment.rb
Instance Attribute Summary
Attributes included from LiquidExt
#context
Instance Method Summary
collapse
Methods included from LiquidExt
included, #initialize, #render
Instance Method Details
#content ⇒ Object
22
23
24
|
# File 'lib/alula/core_ext/tags/attachment.rb', line 22
def content
"<a href=\"#{attachment_url(@source)}\">#{@title}</a>"
end
|
#prepare ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/alula/core_ext/tags/attachment.rb', line 3
def prepare
@classes = []
if m = /(["'])?([^"']+)\1?(?: (.+))?/.match(@markup)
@source = m[2]
@title = File.basename(@source)
options = m[3]
end
if options
options.scan(/(\S+):["]?((?:.(?!["]?\s+(?:\S+):|[>"]))+.)["]?/) do |name, value|
case name
when "title"
@title = value
end
end
end
end
|