diff --git a/src/Text/Pandoc/Util/Filter/Media.hs b/src/Text/Pandoc/Util/Filter/Media.hs index 61ff7c6..05340fa 100644 --- a/src/Text/Pandoc/Util/Filter/Media.hs +++ b/src/Text/Pandoc/Util/Filter/Media.hs @@ -44,6 +44,11 @@ imgExt = demoExt :: [String] demoExt = ["html", "htm"] +-- | File-extensions that should be treated as 3D model and will be shown with Mario's viewer +-- in an iframe +meshExt :: [String] +meshExt = ["off", "obj", "stl"] + -- | main media-plugin. -- -- Will convert the following syntax @@ -134,16 +139,31 @@ media (Image (id', att, att') alt (filename,_)) where (direct, css) = (classToRevealAttr . revealjsRewriteAttr) att style = filterStyle att' ---html-demos etc. as IFrames +--html-demos etc. as IFrames (use data-src instead of src to enable lazy-loading) media (Image (id', att, att') [] (filename,_)) | id' == "demo" || checkExtension filename demoExt - = return [toHtml $ ""] + = return [toHtml $ ""] where (direct, css) = (classToRevealAttr . revealjsRewriteAttr) att media (Image (id', att, att') alt (filename,_)) | id' == "demo" || checkExtension filename demoExt = return $ [toHtml $ "
attToString (idFilter "demo" id', css, att') <> ">"] - <> [toHtml $ ""] + <> [toHtml $ ""] + <> [toHtml $ "
"] + <> alt + <> [toHtml $ "
"] + where + (direct, css) = (classToRevealAttr . revealjsRewriteAttr) att +--3D meshes shown in a WebGL viewer in an iframe (use data-src to enable reveal's lazy loading) +media (Image (id', att, att') [] (filename,_)) + | checkExtension filename meshExt + = return [toHtml $ ""] + where + (direct, css) = (classToRevealAttr . revealjsRewriteAttr) att +media (Image (id', att, att') alt (filename,_)) + | checkExtension filename meshExt + = return $ [toHtml $ "
attToString (id', css, att') <> ">"] + <> [toHtml $ ""] <> [toHtml $ "
"] <> alt <> [toHtml $ "
"]