support facet attribute in <mmm-link>
s-ol
1 year, 5 months ago
86 | 86 | (html, fileder) => |
87 | 87 | html = html\yieldable_gsub '<mmm%-link%s+(.-)>(.-)</mmm%-link>', (attrs, text) -> |
88 | 88 | text = nil if #text == 0 |
89 | path = '' | |
89 | path, facet = '', '' | |
90 | 90 | while attrs and attrs != '' |
91 | 91 | key, val, _attrs = attrs\match '^(%w+)="([^"]-)"%s*(.*)' |
92 | 92 | if not key |
97 | 97 | |
98 | 98 | switch key |
99 | 99 | when 'path' then path = val |
100 | when 'facet' then facet = val | |
100 | 101 | else warn "unkown attribute '#{key}=\"#{val}\"' in <mmm-link>" |
101 | 102 | |
102 | 103 | link_to path, text, fileder |