Don't hardcode images path in blog post
parent
456b6b1df3
commit
cae4d68870
|
@ -97,8 +97,11 @@ blogPost
|
||||||
-> Text
|
-> Text
|
||||||
-> Text
|
-> Text
|
||||||
-> Day
|
-> Day
|
||||||
|
-> FilePath
|
||||||
-> Text
|
-> Text
|
||||||
blogPost title see adj1 adj2 seal date =
|
blogPost title see adj1 adj2 seal date imagesPath =
|
||||||
|
let imagesPath' = T.pack imagesPath
|
||||||
|
in
|
||||||
[text|
|
[text|
|
||||||
---
|
---
|
||||||
title: $title
|
title: $title
|
||||||
|
@ -106,7 +109,7 @@ blogPost title see adj1 adj2 seal date =
|
||||||
|
|
||||||
$see this $adj1, $adj2 seal!
|
$see this $adj1, $adj2 seal!
|
||||||
<img
|
<img
|
||||||
src="/images/$seal"
|
src="$imagesPath'/$seal"
|
||||||
alt="A picture of a $adj1, $adj2 seal! <3"
|
alt="A picture of a $adj1, $adj2 seal! <3"
|
||||||
width="400"
|
width="400"
|
||||||
/>
|
/>
|
||||||
|
@ -138,6 +141,7 @@ sealText config n date = ( fileName', bp)
|
||||||
"older"
|
"older"
|
||||||
"birthdaySeal.jpg"
|
"birthdaySeal.jpg"
|
||||||
date
|
date
|
||||||
|
(sealImagesPath config)
|
||||||
|
|
||||||
blogPost' (_, 04, 01) =
|
blogPost' (_, 04, 01) =
|
||||||
blogPost
|
blogPost
|
||||||
|
@ -147,6 +151,7 @@ sealText config n date = ( fileName', bp)
|
||||||
"supermodel, singing"
|
"supermodel, singing"
|
||||||
"singerSeal.jpg"
|
"singerSeal.jpg"
|
||||||
date
|
date
|
||||||
|
(sealImagesPath config)
|
||||||
|
|
||||||
blogPost' (_, _, _) =
|
blogPost' (_, _, _) =
|
||||||
blogPost
|
blogPost
|
||||||
|
@ -156,22 +161,23 @@ sealText config n date = ( fileName', bp)
|
||||||
(randomPull $ adjectives2 config)
|
(randomPull $ adjectives2 config)
|
||||||
(randomPull $ unsafeListDirContents $ sealImagesPath config)
|
(randomPull $ unsafeListDirContents $ sealImagesPath config)
|
||||||
date
|
date
|
||||||
|
(sealImagesPath config)
|
||||||
|
|
||||||
|
|
||||||
{-
|
{-
|
||||||
Utils
|
Utils
|
||||||
-}
|
-}
|
||||||
{-
|
{-
|
||||||
Gives a random number between from and to
|
Gives a random number between from and to
|
||||||
Uses unsafeIO to get the number out of IO
|
Uses unsafeIO to get the number out of IO
|
||||||
It's safe because we're only shuffling
|
It's safe because we're only shuffling
|
||||||
-}
|
-}
|
||||||
randomNum :: Random a => a -> a -> a
|
randomNum :: Random a => a -> a -> a
|
||||||
randomNum from to = unsafePerformIO $ randomRIO (from, to)
|
randomNum from to = unsafePerformIO $ randomRIO (from, to)
|
||||||
|
|
||||||
{-
|
{-
|
||||||
Given a list, returns a random element
|
Given a list, returns a random element
|
||||||
-}
|
-}
|
||||||
randomPull :: [a] -> a
|
randomPull :: [a] -> a
|
||||||
randomPull lst = lst !! r'
|
randomPull lst = lst !! r'
|
||||||
where r' = randomNum 0 l
|
where r' = randomNum 0 l
|
||||||
|
|
Loading…
Reference in New Issue