~alcinnz/rhapsode

2dc5e4d3e62531c5915ee0bc8dca6068be8faff0 — Adrian Cochrane 10 months ago 33ca829
Fix embedding of data files to be more lenient towards build systems.
3 files changed, 6 insertions(+), 3 deletions(-)

M rhapsode.cabal
M src/CExports.hs
M src/Render.hs
M rhapsode.cabal => rhapsode.cabal +1 -1
@@ 61,7 61,7 @@ library
  
  -- Other library packages from which modules are imported.
  build-depends:       base >=4.9 && <5, directory >= 1.3.2, bytestring,
        file-embed >= 0.0.9 && < 0.1, time, parallel >= 1,
        file-embed >= 0.0.10 && < 0.1, time, parallel >= 1,
        -- HTML parsing, SSML output
        xml-conduit, text, containers, hurl-xml >= 0.2,
        -- Networking

M src/CExports.hs => src/CExports.hs +3 -1
@@ 111,7 111,9 @@ foreign export ccall c_freeSession :: StablePtr Session -> IO ()

c_newSession = do
    sess <- newSession
    newStablePtr $ sess {aboutPages = map lazify $(embedDir $ buildDirFile "about")}
    newStablePtr $ sess {
        aboutPages = map lazify $(makeRelativeToProject "about" >>= embedDir)
    }
  where lazify (a, b) = (a, B.fromStrict b)
c_freeSession = freeStablePtr


M src/Render.hs => src/Render.hs +2 -1
@@ 74,7 74,8 @@ renderElLBS el = XML.renderLBS XML.def $ XML.Document {

retreiveStyles :: Session -> CSSCond.ConditionalStyles (CSSTxt.TextStyle SpeechStyle) -> IO (CSSCond.ConditionalStyles (CSSTxt.TextStyle SpeechStyle))
retreiveStyles manager authorStyle = do
    let agentStyle = cssPriorityAgent authorStyle `CSS.parse` $(embedStringFile $ buildDirFile "useragent.css")
    let agentStyle = cssPriorityAgent authorStyle `CSS.parse`
            $(makeRelativeToProject "useragent.css" >>= embedStringFile)
    userStyle <- loadUserStyles agentStyle
    CSSCond.loadImports loadURL lowerVars lowerToks userStyle []
  where