git.s-ol.nu mmm / e2a90e8
fix embed in static rendered markdown s-ol 14 days ago
2 changed file(s) with 13 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
44 attr[k] = v
55
66 (elements) ->
7 import a, div, pre from elements
7 import a, div, span, pre from elements
88
99 find_fileder = (fileder, origin) ->
1010 if 'string' == type fileder
4343 ok, node = pcall fileder.gett, fileder, name, 'mmm/dom'
4444
4545 if not ok
46 return div "couldn't embed #{fileder} #{name}",
46 return span "couldn't embed #{fileder} #{name}",
4747 (pre node),
48 class: 'embed'
4849 style: {
4950 background: 'var(--gray-fail)',
5051 padding: '1em',
5455 klass ..= ' desc' if opts.desc
5556 klass ..= ' inline' if opts.inline
5657
57 node = div {
58 node = span {
5859 class: klass
5960 node
6061 if opts.desc
1111
1212 .markdown,
1313 .markdown > p,
14 .markdown > p > a,
1514 .markdown > a {
1615 > img, > video {
1716 display: block;
2019
2120 padding: 0 2em;
2221 box-sizing: border-box;
22 }
23
24 a, p {
25 max-width: 100%;
2326 }
2427 }
2528
3841 }
3942
4043 .embed {
44 display: block;
4145 width: inherit;
4246 height: inherit;
4347
5458 padding: 0.5em;
5559 margin: 0.2em;
5660 background: $gray-bright;
61 }
62
63 > *:not(.description) {
64 max-width: 100%;
5765 }
5866 }
5967