git.s-ol.nu mmm / e369a67
support "download" and "facet" options for mmm-link s-ol 1 year, 29 days ago
1 changed file(s) with 4 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
7878 html = html\yieldable_gsub '<mmm%-link%s+(.-)>(.-)</mmm%-link>', (attrs, text) ->
7979 text = nil if #text == 0
8080 path, facet = '', ''
81 opts = {}
8182 while attrs and attrs != ''
8283 key, val, _attrs = attrs\match '^(%w+)="([^"]-)"%s*(.*)'
8384 if not key
8990 switch key
9091 when 'path' then path = val
9192 when 'facet' then facet = val
92 else warn "unkown attribute '#{key}=\"#{val}\"' in <mmm-link>"
93
94 link_to path, text, fileder
93 else opts[key] = val
94
95 link_to path, text, fileder, opts, facet
9596
9697 html = html\yieldable_gsub '<mmm%-embed%s+(.-)>(.-)</mmm%-embed>', (attrs, desc) ->
9798 path, facet = '', ''