git.s-ol.nu mmm / 2d5dff2
fail-early for <mmm-embed> s-ol 8 days ago
2 changed file(s) with 12 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
179179 elseif ok
180180 div "[no conversion path to #{prop.type}]"
181181 elseif res and res.match and res\match '%[nossr%]$'
182 div "[this page could not be pre-renderer on the server]"
182 div "[this page could not be pre-rendered on the server]"
183183 else
184184 if trace
185185 res = "#{res}\n#{trace}"
44 attr[k] = v
55
66 (elements) ->
7 import a from elements
7 import a, div, pre from elements
88
99 find_fileder = (fileder, origin) ->
1010 if 'string' == type fileder
3939 embed = (fileder, name='', origin, opts={}) ->
4040 fileder = find_fileder fileder, origin
4141
42 node = fileder\gett name, 'mmm/dom'
42 -- node = fileder\gett name, 'mmm/dom'
43 ok, node = pcall fileder.gett, fileder, name, 'mmm/dom'
44
45 if not ok
46 return div "couldn't embed #{fileder} #{name}",
47 (pre node),
48 style: {
49 background: 'var(--gray-fail)',
50 padding: '1em',
51 }
4352
4453 return node if opts.nolink
4554 link_to fileder, node, nil, opts.attr