Skip to content

Commit 9404526

Browse files
committed
Slightly improve titles
1 parent 8f0532f commit 9404526

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

elm-website.cabal

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ executable run-elm-website
4646
process,
4747
snap-core,
4848
snap-server,
49+
split,
4950
text,
5051
time,
5152
utf8-string

src/backend/Init/Helpers.hs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module Init.Helpers (isOutdated, make, makeWithStyle, write) where
22

33
import Control.Monad.Except (runExceptT, when)
4+
import qualified Data.List as List
5+
import qualified Data.List.Split as List
46
import System.Directory (doesFileExist, getModificationTime, removeFile)
57
import System.FilePath (splitExtension, takeBaseName)
68
import System.Exit (exitFailure)
@@ -39,7 +41,7 @@ makeWithStyle input output =
3941
".html" ->
4042
do jsSource <- readFile jsOutput
4143
writeFile output
42-
(Blaze.renderHtml (Generate.serverHtml (takeBaseName output) jsSource))
44+
(Blaze.renderHtml (Generate.serverHtml (fileToTitle output) jsSource))
4345
removeFile jsOutput
4446

4547
_ ->
@@ -48,6 +50,11 @@ makeWithStyle input output =
4850
return outdated
4951

5052

53+
fileToTitle :: FilePath -> String
54+
fileToTitle filePath =
55+
List.intercalate " " (List.splitOn "-" (takeBaseName filePath))
56+
57+
5158
makeForReal :: FilePath -> FilePath -> IO ()
5259
makeForReal input output =
5360
do compilerResult <-

0 commit comments

Comments
 (0)