Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nebelhorn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
Nebelhorn
Commits
7303234a
Verified
Commit
7303234a
authored
6 months ago
by
Nicolas Lenz
Browse files
Options
Downloads
Patches
Plain Diff
refactor: reformat some stuff in Feed.hs
parent
df416370
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Feed.hs
+14
-13
14 additions, 13 deletions
src/Feed.hs
with
14 additions
and
13 deletions
src/Feed.hs
+
14
−
13
View file @
7303234a
...
...
@@ -20,27 +20,28 @@ import Control.Concurrent.Async
-- See also https://validator.w3.org/feed/docs/atom.html
toEntry
::
PandocMonad
m
=>
Text
->
Page
->
m
Atom
.
Entry
toEntry
baseUrl
page
@
Page
{
..
}
=
let
Pandoc
meta
_
=
pageDoc
in
do
toEntry
baseUrl
page
@
Page
{
..
}
=
do
html
<-
renderPageContent
page
let
link
::
Text
=
baseUrl
<>
fromMaybe
""
(
lookupMetaPlain
"link"
meta
)
let
entry
=
Atom
.
nullEntry
link
(
Atom
.
TextString
$
fromMaybe
"Untitled"
(
lookupMetaPlain
"title"
meta
))
timestamp
let
Pandoc
meta
_
=
pageDoc
link
::
Text
=
baseUrl
<>
fromMaybe
""
(
lookupMetaPlain
"link"
meta
)
timestamp
::
Atom
.
Date
=
toText
.
iso8601Show
$
getUpdated
page
entry
::
Atom
.
Entry
=
Atom
.
nullEntry
link
(
Atom
.
TextString
$
fromMaybe
"Untitled"
(
lookupMetaPlain
"title"
meta
))
timestamp
return
entry
{
Atom
.
entryContent
=
Just
$
Atom
.
HTMLContent
html
,
Atom
.
entrySummary
=
Atom
.
TextString
<$>
lookupMetaPlain
"description"
meta
,
Atom
.
entryLinks
=
[
Atom
.
nullLink
link
]
}
where
timestamp
::
Atom
.
Date
timestamp
=
toText
.
iso8601Show
$
getUpdated
page
getUpdated
::
Page
->
ZonedTime
getUpdated
Page
{
..
}
=
case
(
pageDate
,
pageUpdated
)
of
(
_
,
Just
updated
)
->
updated
(
Just
date
,
_
)
->
date
_
->
placeholderTime
(
_
,
Just
updated
)
->
updated
(
Just
date
,
_
)
->
date
_
->
placeholderTime
placeholderTime
::
ZonedTime
placeholderTime
=
ZonedTime
(
LocalTime
(
fromOrdinalDate
1980
1
)
midnight
)
utc
...
...
@@ -59,7 +60,7 @@ toFeed baseUrl feed@Feed{..} = do
(
toText
.
iso8601Show
$
latestUpdate
feed
)
return
entry
{
Atom
.
feedEntries
=
entries
,
Atom
.
feedLinks
=
[
Atom
.
nullLink
baseUrl
]
,
Atom
.
feedLinks
=
[
Atom
.
nullLink
baseUrl
]
}
{-renderFeed :: Atom.Feed -> Text
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment