projects
/
xyz.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0e5ea23
)
Fix bug in sorting of entryList
author
Cameron Ball
<cameron@cameron1729.xyz>
Sat, 16 Feb 2019 16:43:12 +0000
(
00:43
+0800)
committer
Cameron Ball
<cameron@cameron1729.xyz>
Sat, 16 Feb 2019 16:43:12 +0000
(
00:43
+0800)
src/Lib.hs
patch
|
blob
|
history
diff --git
a/src/Lib.hs
b/src/Lib.hs
index
80cf44f
..
a0f089e
100644
(file)
--- a/
src/Lib.hs
+++ b/
src/Lib.hs
@@
-31,10
+31,10
@@
type EntryList = [(Text, [(Text, [(Text, BlogEntry)])])]
format t format = fromString $ formatTime defaultTimeLocale format $ utcToLocalTime (hoursToTimeZone 8) t
myGroup :: (Eq a, Ord a) => [(a, b)] -> [(a, [b])]
format t format = fromString $ formatTime defaultTimeLocale format $ utcToLocalTime (hoursToTimeZone 8) t
myGroup :: (Eq a, Ord a) => [(a, b)] -> [(a, [b])]
-myGroup = map (\l -> (fst . head $ l, map snd l)) . groupBy ((==) `on` fst)
+myGroup = map (\l -> (fst . head $ l, map snd l)) . groupBy ((==) `on` fst)
. sortBy (comparing fst)
stampsToEntryList :: [BlogEntry] -> EntryList
stampsToEntryList :: [BlogEntry] -> EntryList
-stampsToEntryList stamps = map (\(a,b) -> (a, reverse $ map (\(c,d) -> (c, map (\(x, y) -> ("0" `append` (fromString . show) x, y)) $ zip [1..] d)) b)) $
+stampsToEntryList stamps =
reverse $
map (\(a,b) -> (a, reverse $ map (\(c,d) -> (c, map (\(x, y) -> ("0" `append` (fromString . show) x, y)) $ zip [1..] d)) b)) $
map (\(a, b) -> (a, myGroup b)) $
map (\(a, b) -> (a, concat b)) $ myGroup $
foldl (\c -> \v ->
map (\(a, b) -> (a, myGroup b)) $
map (\(a, b) -> (a, concat b)) $ myGroup $
foldl (\c -> \v ->
@@
-49,12
+49,13
@@
entryListToPaths el = concat $ concat $ map (\(year, months)
month) entries) months) el
entryListToIndex :: EntryList -> Text
month) entries) months) el
entryListToIndex :: EntryList -> Text
-entryListToIndex el = unorderedList Nothing $ map (\(year, monthList) -> unorderedList (Just year) $ map (\(month, entryList) -> unorderedList (Just month) $ map (\x -> "<a href=\"" <> year <> "/" <> month <> "/" <> ((
slug
ify . title . snd) x) <> ".html\">" <> (title . snd) x <> "</a>") entryList) monthList) el
+entryListToIndex el = unorderedList Nothing $ map (\(year, monthList) -> unorderedList (Just year) $ map (\(month, entryList) -> unorderedList (Just month) $ map (\x -> "<a href=\"" <> year <> "/" <> month <> "/" <> ((
url
ify . title . snd) x) <> ".html\">" <> (title . snd) x <> "</a>") entryList) monthList) el
i2t :: Integer -> Text
i2t = (fromString . show)
slugify = toLower. replace " " "-"
i2t :: Integer -> Text
i2t = (fromString . show)
slugify = toLower. replace " " "-"
+urlify = slugify . replace "?" ""
timeStampToDateString = fromString . formatTime defaultTimeLocale "%d %B %Y" . utcToLocalTime (hoursToTimeZone 8)
timeStampToDateString = fromString . formatTime defaultTimeLocale "%d %B %Y" . utcToLocalTime (hoursToTimeZone 8)
@@
-97,7
+98,7
@@
exportEntry entry = do
"build",
format (postDate entry) "%Y",
format (postDate entry) "%B",
"build",
format (postDate entry) "%Y",
format (postDate entry) "%B",
-
slug
ify (title entry) `append` ".html"]) $ unpack $ entryToMarkup entry entryTemplate
+
url
ify (title entry) `append` ".html"]) $ unpack $ entryToMarkup entry entryTemplate
exportIndex :: EntryList -> IO()
exportIndex entryList = do
exportIndex :: EntryList -> IO()
exportIndex entryList = do