support "download" and "facet" options for mmm-link
s-ol
1 year, 29 days ago
78 | 78 | html = html\yieldable_gsub '<mmm%-link%s+(.-)>(.-)</mmm%-link>', (attrs, text) -> |
79 | 79 | text = nil if #text == 0 |
80 | 80 | path, facet = '', '' |
81 | opts = {} | |
81 | 82 | while attrs and attrs != '' |
82 | 83 | key, val, _attrs = attrs\match '^(%w+)="([^"]-)"%s*(.*)' |
83 | 84 | if not key |
89 | 90 | switch key |
90 | 91 | when 'path' then path = val |
91 | 92 | 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 | |
95 | 96 | |
96 | 97 | html = html\yieldable_gsub '<mmm%-embed%s+(.-)>(.-)</mmm%-embed>', (attrs, desc) -> |
97 | 98 | path, facet = '', '' |