Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
decker
decker
Commits
6e2f5fb9
Commit
6e2f5fb9
authored
Jul 24, 2017
by
Henrik Tramberend
Browse files
Remove dead code
parent
cf65060b
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
6e2f5fb9
before_script
:
-
stack --version
-
stack setup
test
:
...
...
src/pandoc.hs
deleted
100644 → 0
View file @
cf65060b
{-- Author: Henrik Tramberend <henrik@tramberend.de> --}
module
Pandoc
(
)
where
import
Control.Exception
import
Control.Monad
import
qualified
Data.ByteString.Char8
as
B
import
qualified
Data.ByteString.Lazy.Char8
as
L
import
Data.Digest.Pure.MD5
import
qualified
Data.HashMap.Strict
as
H
import
Data.List
import
qualified
Data.Map
as
M
import
Data.Maybe
import
qualified
Data.MultiMap
as
MM
import
qualified
Data.Text
as
T
import
qualified
Data.Yaml
as
Y
import
Debug.Trace
import
Development.Shake
import
Network.HTTP.Conduit
import
Network.HTTP.Simple
import
Network.HTTP.Types.Status
import
Network.URI
import
System.Directory
import
System.FilePath.Posix
import
Text.Pandoc
import
Text.Pandoc.Walk
import
Utilities
type
MetaData
=
M
.
Map
FilePath
Y
.
Value
readMetaData
::
[
FilePath
]
->
IO
MetaData
readMetaData
metaFiles
=
do
canonMetaFiles
<-
mapM
canonicalizePath
metaFiles
aDataList
<-
mapM
decodeYaml
canonMetaFiles
let
joined
=
M
.
map
joinHorizontally
$
MM
.
toMap
$
MM
.
fromList
aDataList
return
$
M
.
mapWithKey
(
joinVertically
joined
)
joined
where
decodeYaml
::
FilePath
->
IO
(
FilePath
,
Y
.
Value
)
decodeYaml
file
=
do
result
<-
Y
.
decodeFileEither
file
case
result
of
Right
object
@
(
Y
.
Object
_
)
->
return
(
takeDirectory
file
,
object
)
Right
_
->
throw
$
YamlException
$
"Top-level meta value must be an object: "
++
file
Left
exception
->
throw
exception
joinHorizontally
::
[
Y
.
Value
]
->
Y
.
Value
joinHorizontally
=
foldl1
joinMeta
joinVertically
::
MetaData
->
FilePath
->
Y
.
Value
->
Y
.
Value
joinVertically
meta
dir
ignore
=
if
not
$
equalFilePath
dir
"/"
then
let
up
=
joinVertically
meta
(
takeDirectory
dir
)
ignore
in
maybe
up
(
joinMeta
up
)
(
M
.
lookup
dir
meta
)
else
Y
.
Object
(
H
.
fromList
[]
)
joinMeta
::
Y
.
Value
->
Y
.
Value
->
Y
.
Value
joinMeta
(
Y
.
Object
old
)
(
Y
.
Object
new
)
=
Y
.
Object
(
H
.
union
new
old
)
joinMeta
_
_
=
throw
$
YamlException
"Can only join YAML objects."
-- extractMetaDataFromMarkdown :: T.Text -> Y.Value
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment