git.s-ol.nu mmm / 8c4a3c7
fix absoute paths in link_to, embed s-ol 2 years ago
3 changed file(s) with 13 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
5555 convert 'table', facet.type, index, fileder, facet.name
5656 else
5757 if facet.type == 'text/html+interactive'
58 export BROWSER
59
6058 root = Fileder @store
61 BROWSER = Browser root, path, facet.name
59 browser = Browser root, path, facet.name
6260
6361 deps = [[
6462 <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/svg.js/2.6.6/svg.min.js"></script>
6967 <script type="text/lua">require 'mmm'</script>
7068 ]]
7169
72 render BROWSER\todom!, fileder, noview: true, scripts: deps .. "
70 render browser\todom!, fileder, noview: true, scripts: deps .. "
7371 <script type=\"text/lua\">
7472 on_load = on_load or {}
7573 table.insert(on_load, function()
8381 local root = fileder.Fileder(store, store:get_index(nil, -1))
8482
8583 local err_and_trace = function (msg) return debug.traceback(msg, 2) end
86 ok, BROWSER = xpcall(browser.Browser, err_and_trace, root, path, facet, true)
87 if not ok then error(BROWSER) end
84 local ok, browser = xpcall(browser.Browser, err_and_trace, root, path, facet, true)
85 if not ok then error(browser) end
8886 end)
8987 </script>"
9088 else if not fileder\has_facet facet.name
3333 for convert in *converts
3434 table.insert casts, convert
3535
36 export BROWSER
3637 class Browser
3738 new: (@root, path, facet, rehydrate=false) =>
39 BROWSER = @
40
3841 -- root fileder
3942 assert @root, 'root fileder is nil'
4043
1313
1414 find_fileder = (fileder, origin) ->
1515 if 'string' == type fileder
16 assert origin, "cannot resolve path '#{fileder}' without origin!"
17 assert (origin\walk fileder), "couldn't resolve path '#{fileder}' from #{origin}"
16 if '.' == fileder\sub 1, 1
17 assert origin, "cannot resolve path '#{fileder}' without origin!"
18 assert (origin\walk fileder), "couldn't resolve path '#{fileder}' from #{origin}"
19 else
20 assert BROWSER and BROWSER.root, "cannot resolve path '#{fileder}' without BROWSER and root set!"
21 assert (BROWSER.root\walk fileder), "couldn't resolve path '#{fileder}' from #{origin}"
1822 else
1923 assert fileder, "no fileder passed."
2024