mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-25 12:42:02 +03:00
fix switch from takeLast to extension
This commit is contained in:
parent
e8fc14e890
commit
ca7a6cecff
@ -40,12 +40,18 @@ htmlFooter = concat $ the (List String) $
|
||||
, "</html>"
|
||||
]
|
||||
|
||||
addHeaderAndFooter : String -> String -> String
|
||||
addHeaderAndFooter outfile es =
|
||||
case toLower <$> extension outfile of
|
||||
Just "html" => htmlHeader ++ es ++ htmlFooter
|
||||
_ => es
|
||||
|
||||
||| Javascript implementation of the `compileExpr` interface.
|
||||
compileExpr : Ref Ctxt Defs -> (tmpDir : String) -> (outputDir : String) ->
|
||||
ClosedTerm -> (outfile : String) -> Core (Maybe String)
|
||||
compileExpr c tmpDir outputDir tm outfile
|
||||
= do es <- compileToJS c tm
|
||||
let res = if toLower (extension outfile) == "html" then htmlHeader ++ es ++ htmlFooter else es
|
||||
let res = addHeaderAndFooter outfile es
|
||||
let out = outputDir </> outfile
|
||||
Right () <- coreLift (writeFile out res)
|
||||
| Left err => throw (FileErr out err)
|
||||
|
Loading…
Reference in New Issue
Block a user