summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorache <ache@ache.one>2018-02-06 05:33:32 +0100
committerache <ache@ache.one>2018-02-06 05:33:32 +0100
commit6f5a6cd7353b8ff8243c86df75432780ba643944 (patch)
tree887094bed9defaf939ec85f8b271031e1e8b7d73 /src
parentHTML5 compatible tools (diff)
no pandoc dependencies
Diffstat (limited to 'src')
-rw-r--r--src/Id.hs19
-rw-r--r--src/Secret.hs46
-rw-r--r--src/articleFilter.hs55
-rw-r--r--src/introFilter.hs51
-rw-r--r--src/titleFilter.hs36
5 files changed, 0 insertions, 207 deletions
diff --git a/src/Id.hs b/src/Id.hs
deleted file mode 100644
index adc7e2e..0000000
--- a/src/Id.hs
+++ /dev/null
@@ -1,19 +0,0 @@
-module Id
-( newId,
- nextId
-) where
-
-{-
- -
- - Écrit par HĂ©dy GIRAUDEAU
- - 27/07/17
- -
--}
-
-import Data.IORef
-import Data.Functor
-
-type Id_number a = IORef a
-
-newId = (newIORef 0)
-nextId cnt = modifyIORef cnt (+1) >> (+0) <$> readIORef cnt
diff --git a/src/Secret.hs b/src/Secret.hs
deleted file mode 100644
index 7b428ce..0000000
--- a/src/Secret.hs
+++ /dev/null
@@ -1,46 +0,0 @@
-module Secret
-( to_secret
-) where
-
-
-{-
- -
- - Écrit par HĂ©dy GIRAUDEAU
- - 27/07/17
- -
--}
-
-
-
-import Text.Pandoc
-import Text.Pandoc.JSON
-
-
-firstLine :: [Inline] -> ([Inline],[Inline])
-firstLine [] = ([],[])
-firstLine ((SoftBreak) : x) = ([], x)
-firstLine (x:q) = ([x] ++ y, z) where (y,z) = (firstLine q)
-
-
-
-
-to_secret (BlockQuote (Para (Str(first) : inlines) : blocks)) =
- Div
- ("", ["secret"], [])
- ([
- RawBlock (Format "html")
- (start_detail ++ start_summary)
- ] ++ [Plain $ fLine] ++ [
- RawBlock (Format "html")
- (end_summary)
- ] ++ [ Plain rest ]++ blocks ++ [
- RawBlock (Format "html")
- (end_detail)
- ]
- )
- where start_detail = "<details>"
- start_summary = "<summary>"
- end_detail = "</details>"
- end_summary = "</summary>"
- (fLine, rest) = firstLine inlines
-
diff --git a/src/articleFilter.hs b/src/articleFilter.hs
deleted file mode 100644
index a94cd3d..0000000
--- a/src/articleFilter.hs
+++ /dev/null
@@ -1,55 +0,0 @@
-import Text.Pandoc
-import Text.Pandoc.JSON
-import Control.Monad.State
-import Id
-
-
-{-
- - Écrit par HĂ©dy GIRAUDEAU
- - 27/07/17
--}
-extractStart :: [Inline] -> ([Inline],[Inline])
-extractStart [] = ([],[])
-extractStart ((SoftBreak):q) = ((SoftBreak):y, z) where (y,z) = (extractStart q)
-extractStart ((LineBreak):q) = ((LineBreak):y, z) where (y,z) = (extractStart q)
-extractStart (img@(Image _ _ _):q) = (img: y, z) where (y,z) = (extractStart q)
-extractStart x = ([],x)
-
-
-
-
-transformBlock cnt ( hdF@(Header 1 _ inlines) : paraF@(Para inlinesP) : blocks ) =
- return (( (RawBlock (Format "html")
- ( start_header )
- ) : hdF :
- (RawBlock (Format "html")
- ( end_header )
- ) : (Plain inlinesP) :
- (RawBlock (Format "html")
- ( end_intro )
- ) : blocks
- ) ++ [ (RawBlock (Format "html")
- (end_article) )
- ])
- where start_header = "<header>"
- end_header = "</header><section class=\"entry-content clearfix\" >"
- end_intro = ""
- end_article = "</section>"
-
---transformBlock _ ((Para inlines):tl) =
--- return ((Plain plainInline):(Para paraInline:tl))
--- where (plainInline, paraInline) = extractStart(inlines)
-
-
-transformBlock _ x = return x
-
-
-bar :: Pandoc -> IO Pandoc
-bar x = do cnt <- newId
- bottomUpM (transformBlock cnt) x
-
-main :: IO()
-main = toJSONFilter bar
-
-
--- vim:set et:
diff --git a/src/introFilter.hs b/src/introFilter.hs
deleted file mode 100644
index 93603c0..0000000
--- a/src/introFilter.hs
+++ /dev/null
@@ -1,51 +0,0 @@
-import Text.Pandoc
-import Text.Pandoc.JSON
-import Control.Monad.State
-import Id
-
-
-{-
- - Écrit par HĂ©dy GIRAUDEAU
- - 27/07/17
--}
-firstPara :: [Block] -> [Block]
-firstPara [] = []
-firstPara (p@(Para x):blocks) = [(Para x)]
-firstPara (x:blocks) = (firstPara blocks)
-
-setMignature (id, classes, mapsAttrib) = (id, "miniature":classes, mapsAttrib)
-
-
-purgePara (Para (Image x y (trgt,title):_)) = (Para [(Image (setMignature x) y ("article/" ++ trgt, title))])
-purgePara (Para (x:t)) = purgePara (Para t)
-purgePara (Para []) = (Para [])
-
-transformBlock cnt ( hdF@(Header 1 _ inlines) : paraF@(Para inlinesP) : blocks ) =
- return (( (RawBlock (Format "html")
- ( start_header )
- ) : hdF :
- (RawBlock (Format "html")
- ( end_header )
- ) : purgePara(paraF) : firstPara(blocks)
- ) ++ [ (RawBlock (Format "html")
- (end_article) )
- ])
- where start_header = "<header>"
- end_header = "</header><section class=\"entry-content clearfix\" >"
- end_intro = ""
- end_article = "</section>"
-
-
-
-transformBlock _ x = return x
-
-
-bar :: Pandoc -> IO Pandoc
-bar x = do cnt <- newId
- bottomUpM (transformBlock cnt) x
-
-main :: IO()
-main = toJSONFilter bar
-
-
--- vim:set et:
diff --git a/src/titleFilter.hs b/src/titleFilter.hs
deleted file mode 100644
index c215253..0000000
--- a/src/titleFilter.hs
+++ /dev/null
@@ -1,36 +0,0 @@
-import Text.Pandoc
-import Text.Pandoc.JSON
-
-{-
- - Écrit par HĂ©dy GIRAUDEAU
- - 27/07/17
--}
-
-
-{- Convertit une liste de Inline (sorte de span, contie du formatage légé de
- - texte) vers une chaine de caractĂšre normal -}
-
-toString :: [Inline] -> String
-toString [] = ""
-toString inls@((Str f):tl) = f ++ (toString tl)
-toString inls@((Space):tl) = " " ++ (toString tl)
-toString inls@((Emph inls2):tl) = (toString inls2) ++ (toString tl)
-toString inls@((SmallCaps inls2):tl) = (toString inls2) ++ (toString tl)
-toString inls@((Strong inls2):tl) = (toString inls2) ++ (toString tl)
-toString (_:tl) = (toString tl)
-
-
-transformBlock :: [Block] -> [Block]
-transformBlock ( hdF@(Header 1 _ inlines) : _ ) = [(Plain [(Str (toString inlines))])]
-
-transformBlock x = x
-
-
-bar :: Pandoc -> Pandoc
-bar x = bottomUp transformBlock x
-
-main :: IO()
-main = toJSONFilter bar
-
-
--- vim:set et: