Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
c63495f4
Commit
c63495f4
authored
Oct 04, 2018
by
Mael NICOLAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Text -> Maybe Text to backup pandoc errors
parent
54aa9ba5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
Wikimedia.hs
src/Gargantext/Text/Parsers/Wikimedia.hs
+13
-11
No files found.
src/Gargantext/Text/Parsers/Wikimedia.hs
View file @
c63495f4
...
...
@@ -40,8 +40,8 @@ import Data.Either
-- (since there is no abstract) will see if other datas are relevant.
data
Page
=
Page
{
_title
::
T
.
Text
,
_text
::
T
.
Text
_title
::
Maybe
T
.
Text
,
_text
::
Maybe
T
.
Text
}
deriving
(
Show
)
...
...
@@ -74,12 +74,11 @@ parsePage :: MonadThrow m => ConduitT Event o m (Maybe Page)
parsePage
=
tagNoAttr
"{http://www.mediawiki.org/xml/export-0.10/}page"
$
do
title
<-
force
"title is missing"
$
tagNoAttr
"{http://www.mediawiki.org/xml/export-0.10/}title"
content
_
<-
consumeExcept
"{http://www.mediawiki.org/xml/export-0.10/}revision"
revision
<-
force
"revision is missing"
$
parseRevision
parseRevision
many_
$
ignoreAnyTreeContent
return
$
Page
title
revision
...
...
@@ -94,10 +93,13 @@ mediawikiPageToPlain page = do
title
<-
mediaToPlain
$
_title
page
revision
<-
mediaToPlain
$
_text
page
return
$
Page
title
revision
where
mediaToPlain
media
=
do
res
<-
runIO
$
do
doc
<-
readMediaWiki
def
media
writePlain
def
doc
case
res
of
(
Left
_
)
->
return
media
(
Right
r
)
->
return
r
where
mediaToPlain
media
=
case
media
of
(
Nothing
)
->
return
Nothing
(
Just
med
)
->
do
res
<-
runIO
$
do
doc
<-
readMediaWiki
def
med
writePlain
def
doc
case
res
of
(
Left
_
)
->
return
Nothing
(
Right
r
)
->
return
$
Just
r
Write
Preview
Markdown
is supported
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