summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pandoc.cabal26
-rw-r--r--src/Text/Pandoc/Readers.hs6
-rw-r--r--src/Text/Pandoc/Readers/ODT.hs (renamed from src/Text/Pandoc/Readers/Odt.hs)36
-rw-r--r--src/Text/Pandoc/Readers/ODT/Arrows/State.hs (renamed from src/Text/Pandoc/Readers/Odt/Arrows/State.hs)8
-rw-r--r--src/Text/Pandoc/Readers/ODT/Arrows/Utils.hs (renamed from src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs)8
-rw-r--r--src/Text/Pandoc/Readers/ODT/Base.hs (renamed from src/Text/Pandoc/Readers/Odt/Base.hs)10
-rw-r--r--src/Text/Pandoc/Readers/ODT/ContentReader.hs (renamed from src/Text/Pandoc/Readers/Odt/ContentReader.hs)96
-rw-r--r--src/Text/Pandoc/Readers/ODT/Generic/Fallible.hs (renamed from src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs)4
-rw-r--r--src/Text/Pandoc/Readers/ODT/Generic/Namespaces.hs (renamed from src/Text/Pandoc/Readers/Odt/Generic/Namespaces.hs)4
-rw-r--r--src/Text/Pandoc/Readers/ODT/Generic/SetMap.hs (renamed from src/Text/Pandoc/Readers/Odt/Generic/SetMap.hs)4
-rw-r--r--src/Text/Pandoc/Readers/ODT/Generic/Utils.hs (renamed from src/Text/Pandoc/Readers/Odt/Generic/Utils.hs)4
-rw-r--r--src/Text/Pandoc/Readers/ODT/Generic/XMLConverter.hs (renamed from src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs)14
-rw-r--r--src/Text/Pandoc/Readers/ODT/Namespaces.hs (renamed from src/Text/Pandoc/Readers/Odt/Namespaces.hs)6
-rw-r--r--src/Text/Pandoc/Readers/ODT/StyleReader.hs (renamed from src/Text/Pandoc/Readers/Odt/StyleReader.hs)18
-rw-r--r--test/Tests/Readers/ODT.hs (renamed from test/Tests/Readers/Odt.hs)30
-rw-r--r--test/test-pandoc.hs4
16 files changed, 139 insertions, 139 deletions
diff --git a/pandoc.cabal b/pandoc.cabal
index 983326a41..186634b9d 100644
--- a/pandoc.cabal
+++ b/pandoc.cabal
@@ -569,7 +569,7 @@ library
Text.Pandoc.Readers.TikiWiki,
Text.Pandoc.Readers.Txt2Tags,
Text.Pandoc.Readers.Docx,
- Text.Pandoc.Readers.Odt,
+ Text.Pandoc.Readers.ODT,
Text.Pandoc.Readers.EPUB,
Text.Pandoc.Readers.Muse,
Text.Pandoc.Readers.Man,
@@ -675,17 +675,17 @@ library
Text.Pandoc.Readers.LaTeX.Parsing,
Text.Pandoc.Readers.LaTeX.SIunitx,
Text.Pandoc.Readers.LaTeX.Table,
- Text.Pandoc.Readers.Odt.Base,
- Text.Pandoc.Readers.Odt.Namespaces,
- Text.Pandoc.Readers.Odt.StyleReader,
- Text.Pandoc.Readers.Odt.ContentReader,
- Text.Pandoc.Readers.Odt.Generic.Fallible,
- Text.Pandoc.Readers.Odt.Generic.SetMap,
- Text.Pandoc.Readers.Odt.Generic.Utils,
- Text.Pandoc.Readers.Odt.Generic.Namespaces,
- Text.Pandoc.Readers.Odt.Generic.XMLConverter,
- Text.Pandoc.Readers.Odt.Arrows.State,
- Text.Pandoc.Readers.Odt.Arrows.Utils,
+ Text.Pandoc.Readers.ODT.Base,
+ Text.Pandoc.Readers.ODT.Namespaces,
+ Text.Pandoc.Readers.ODT.StyleReader,
+ Text.Pandoc.Readers.ODT.ContentReader,
+ Text.Pandoc.Readers.ODT.Generic.Fallible,
+ Text.Pandoc.Readers.ODT.Generic.SetMap,
+ Text.Pandoc.Readers.ODT.Generic.Utils,
+ Text.Pandoc.Readers.ODT.Generic.Namespaces,
+ Text.Pandoc.Readers.ODT.Generic.XMLConverter,
+ Text.Pandoc.Readers.ODT.Arrows.State,
+ Text.Pandoc.Readers.ODT.Arrows.Utils,
Text.Pandoc.Readers.Org.BlockStarts,
Text.Pandoc.Readers.Org.Blocks,
Text.Pandoc.Readers.Org.DocumentTree,
@@ -787,7 +787,7 @@ test-suite test-pandoc
Tests.Readers.RST
Tests.Readers.RTF
Tests.Readers.Docx
- Tests.Readers.Odt
+ Tests.Readers.ODT
Tests.Readers.Txt2Tags
Tests.Readers.EPUB
Tests.Readers.Muse
diff --git a/src/Text/Pandoc/Readers.hs b/src/Text/Pandoc/Readers.hs
index 61f7326ac..2c9dee416 100644
--- a/src/Text/Pandoc/Readers.hs
+++ b/src/Text/Pandoc/Readers.hs
@@ -26,7 +26,7 @@ module Text.Pandoc.Readers
Reader (..)
, readers
, readDocx
- , readOdt
+ , readODT
, readMarkdown
, readCommonMark
, readCreole
@@ -93,7 +93,7 @@ import Text.Pandoc.Readers.LaTeX
import Text.Pandoc.Readers.MediaWiki
import Text.Pandoc.Readers.Muse
import Text.Pandoc.Readers.Native
-import Text.Pandoc.Readers.Odt
+import Text.Pandoc.Readers.ODT
import Text.Pandoc.Readers.OPML
import Text.Pandoc.Readers.Org
import Text.Pandoc.Readers.RST
@@ -145,7 +145,7 @@ readers = [("native" , TextReader readNative)
,("twiki" , TextReader readTWiki)
,("tikiwiki" , TextReader readTikiWiki)
,("docx" , ByteStringReader readDocx)
- ,("odt" , ByteStringReader readOdt)
+ ,("odt" , ByteStringReader readODT)
,("t2t" , TextReader readTxt2Tags)
,("epub" , ByteStringReader readEPUB)
,("muse" , TextReader readMuse)
diff --git a/src/Text/Pandoc/Readers/Odt.hs b/src/Text/Pandoc/Readers/ODT.hs
index c274b6fd4..4139c35be 100644
--- a/src/Text/Pandoc/Readers/Odt.hs
+++ b/src/Text/Pandoc/Readers/ODT.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
{- |
- Module : Text.Pandoc.Reader.Odt
+ Module : Text.Pandoc.Reader.ODT
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -11,7 +11,7 @@
Entry point to the odt reader.
-}
-module Text.Pandoc.Readers.Odt ( readOdt ) where
+module Text.Pandoc.Readers.ODT ( readODT ) where
import Codec.Archive.Zip
import Text.Pandoc.XML.Light
@@ -32,41 +32,41 @@ import Text.Pandoc.MediaBag
import Text.Pandoc.Options
import qualified Text.Pandoc.UTF8 as UTF8
-import Text.Pandoc.Readers.Odt.ContentReader
-import Text.Pandoc.Readers.Odt.StyleReader
+import Text.Pandoc.Readers.ODT.ContentReader
+import Text.Pandoc.Readers.ODT.StyleReader
-import Text.Pandoc.Readers.Odt.Generic.Fallible
-import Text.Pandoc.Readers.Odt.Generic.XMLConverter
+import Text.Pandoc.Readers.ODT.Generic.Fallible
+import Text.Pandoc.Readers.ODT.Generic.XMLConverter
import Text.Pandoc.Shared (filteredFilesFromArchive)
-readOdt :: PandocMonad m
+readODT :: PandocMonad m
=> ReaderOptions
-> B.ByteString
-> m Pandoc
-readOdt opts bytes = case readOdt' opts bytes of
+readODT opts bytes = case readODT' opts bytes of
Right (doc, mb) -> do
P.setMediaBag mb
return doc
Left e -> throwError e
--
-readOdt' :: ReaderOptions
+readODT' :: ReaderOptions
-> B.ByteString
-> Either PandocError (Pandoc, MediaBag)
-readOdt' _ bytes = bytesToOdt bytes-- of
+readODT' _ bytes = bytesToODT bytes-- of
-- Right (pandoc, mediaBag) -> Right (pandoc , mediaBag)
-- Left err -> Left err
--
-bytesToOdt :: B.ByteString -> Either PandocError (Pandoc, MediaBag)
-bytesToOdt bytes = case toArchiveOrFail bytes of
- Right archive -> archiveToOdt archive
+bytesToODT :: B.ByteString -> Either PandocError (Pandoc, MediaBag)
+bytesToODT bytes = case toArchiveOrFail bytes of
+ Right archive -> archiveToODT archive
Left err -> Left $ PandocParseError
$ "Could not unzip ODT: " <> T.pack err
--
-archiveToOdt :: Archive -> Either PandocError (Pandoc, MediaBag)
-archiveToOdt archive = do
+archiveToODT :: Archive -> Either PandocError (Pandoc, MediaBag)
+archiveToODT archive = do
let onFailure msg Nothing = Left $ PandocParseError msg
onFailure _ (Just x) = Right x
contentEntry <- onFailure "Could not find content.xml"
@@ -79,11 +79,11 @@ archiveToOdt archive = do
(\_ -> Left $ PandocParseError "Could not read styles")
Right
(chooseMax (readStylesAt stylesElem ) (readStylesAt contentElem))
- let filePathIsOdtMedia :: FilePath -> Bool
- filePathIsOdtMedia fp =
+ let filePathIsODTMedia :: FilePath -> Bool
+ filePathIsODTMedia fp =
let (dir, name) = splitFileName fp
in (dir == "Pictures/") || (dir /= "./" && name == "content.xml")
- let media = filteredFilesFromArchive archive filePathIsOdtMedia
+ let media = filteredFilesFromArchive archive filePathIsODTMedia
let startState = readerState styles media
either (\_ -> Left $ PandocParseError "Could not convert opendocument") Right
(runConverter' read_body startState contentElem)
diff --git a/src/Text/Pandoc/Readers/Odt/Arrows/State.hs b/src/Text/Pandoc/Readers/ODT/Arrows/State.hs
index 96515bf56..742f6e9ee 100644
--- a/src/Text/Pandoc/Readers/Odt/Arrows/State.hs
+++ b/src/Text/Pandoc/Readers/ODT/Arrows/State.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TupleSections #-}
{- |
- Module : Text.Pandoc.Readers.Odt.Arrows.State
+ Module : Text.Pandoc.Readers.ODT.Arrows.State
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -17,14 +17,14 @@ Most of these might be implemented without access to innards, but it's much
faster and easier to implement this way.
-}
-module Text.Pandoc.Readers.Odt.Arrows.State where
+module Text.Pandoc.Readers.ODT.Arrows.State where
import Control.Arrow
import qualified Control.Category as Cat
import Control.Monad
import Data.List (foldl')
-import Text.Pandoc.Readers.Odt.Arrows.Utils
-import Text.Pandoc.Readers.Odt.Generic.Fallible
+import Text.Pandoc.Readers.ODT.Arrows.Utils
+import Text.Pandoc.Readers.ODT.Generic.Fallible
newtype ArrowState state a b = ArrowState
diff --git a/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs b/src/Text/Pandoc/Readers/ODT/Arrows/Utils.hs
index 45e5a525c..339bff1cb 100644
--- a/src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs
+++ b/src/Text/Pandoc/Readers/ODT/Arrows/Utils.hs
@@ -1,5 +1,5 @@
{- |
- Module : Text.Pandoc.Readers.Odt.Arrows.Utils
+ Module : Text.Pandoc.Readers.ODT.Arrows.Utils
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -19,14 +19,14 @@ with an equivalent return value.
-}
-- We export everything
-module Text.Pandoc.Readers.Odt.Arrows.Utils where
+module Text.Pandoc.Readers.ODT.Arrows.Utils where
import Prelude hiding (Applicative(..))
import Control.Arrow
import Control.Monad (join)
-import Text.Pandoc.Readers.Odt.Generic.Fallible
-import Text.Pandoc.Readers.Odt.Generic.Utils
+import Text.Pandoc.Readers.ODT.Generic.Fallible
+import Text.Pandoc.Readers.ODT.Generic.Utils
and2 :: (Arrow a) => a b c -> a b c' -> a b (c,c')
and2 = (&&&)
diff --git a/src/Text/Pandoc/Readers/Odt/Base.hs b/src/Text/Pandoc/Readers/ODT/Base.hs
index 2c07b1c11..4a99f5ad6 100644
--- a/src/Text/Pandoc/Readers/Odt/Base.hs
+++ b/src/Text/Pandoc/Readers/ODT/Base.hs
@@ -1,5 +1,5 @@
{- |
- Module : Text.Pandoc.Readers.Odt.Base
+ Module : Text.Pandoc.Readers.ODT.Base
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -10,12 +10,12 @@
Core types of the odt reader.
-}
-module Text.Pandoc.Readers.Odt.Base where
+module Text.Pandoc.Readers.ODT.Base where
-import Text.Pandoc.Readers.Odt.Generic.XMLConverter
-import Text.Pandoc.Readers.Odt.Namespaces
+import Text.Pandoc.Readers.ODT.Generic.XMLConverter
+import Text.Pandoc.Readers.ODT.Namespaces
-type OdtConverterState s = XMLConverterState Namespace s
+type ODTConverterState s = XMLConverterState Namespace s
type XMLReader s a b = FallibleXMLConverter Namespace s a b
diff --git a/src/Text/Pandoc/Readers/Odt/ContentReader.hs b/src/Text/Pandoc/Readers/ODT/ContentReader.hs
index 77324ac2f..0e44b01a3 100644
--- a/src/Text/Pandoc/Readers/Odt/ContentReader.hs
+++ b/src/Text/Pandoc/Readers/ODT/ContentReader.hs
@@ -8,7 +8,7 @@
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE OverloadedStrings #-}
{- |
- Module : Text.Pandoc.Readers.Odt.ContentReader
+ Module : Text.Pandoc.Readers.ODT.ContentReader
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -19,7 +19,7 @@
The core of the odt reader that converts odt features into Pandoc types.
-}
-module Text.Pandoc.Readers.Odt.ContentReader
+module Text.Pandoc.Readers.ODT.ContentReader
( readerState
, read_body
) where
@@ -46,15 +46,15 @@ import Text.Pandoc.Shared
import Text.Pandoc.Extensions (extensionsFromList, Extension(..))
import qualified Text.Pandoc.UTF8 as UTF8
-import Text.Pandoc.Readers.Odt.Base
-import Text.Pandoc.Readers.Odt.Namespaces
-import Text.Pandoc.Readers.Odt.StyleReader
+import Text.Pandoc.Readers.ODT.Base
+import Text.Pandoc.Readers.ODT.Namespaces
+import Text.Pandoc.Readers.ODT.StyleReader
-import Text.Pandoc.Readers.Odt.Arrows.State (foldS)
-import Text.Pandoc.Readers.Odt.Arrows.Utils
-import Text.Pandoc.Readers.Odt.Generic.Fallible
-import Text.Pandoc.Readers.Odt.Generic.Utils
-import Text.Pandoc.Readers.Odt.Generic.XMLConverter
+import Text.Pandoc.Readers.ODT.Arrows.State (foldS)
+import Text.Pandoc.Readers.ODT.Arrows.Utils
+import Text.Pandoc.Readers.ODT.Generic.Fallible
+import Text.Pandoc.Readers.ODT.Generic.Utils
+import Text.Pandoc.Readers.ODT.Generic.XMLConverter
import Network.URI (parseRelativeReference, URI(uriPath))
import qualified Data.Set as Set
@@ -146,37 +146,37 @@ insertMedia' (fp, bs) state@ReaderState{..}
-- Reader type and associated tools
--------------------------------------------------------------------------------
-type OdtReader a b = XMLReader ReaderState a b
+type ODTReader a b = XMLReader ReaderState a b
-type OdtReaderSafe a b = XMLReaderSafe ReaderState a b
+type ODTReaderSafe a b = XMLReaderSafe ReaderState a b
-- | Extract something from the styles
-fromStyles :: (a -> Styles -> b) -> OdtReaderSafe a b
+fromStyles :: (a -> Styles -> b) -> ODTReaderSafe a b
fromStyles f = keepingTheValue
(getExtraState >>^ styleSet)
>>% f
--
-getStyleByName :: OdtReader StyleName Style
+getStyleByName :: ODTReader StyleName Style
getStyleByName = fromStyles lookupStyle >>^ maybeToChoice
--
-findStyleFamily :: OdtReader Style StyleFamily
+findStyleFamily :: ODTReader Style StyleFamily
findStyleFamily = fromStyles getStyleFamily >>^ maybeToChoice
--
-lookupListStyle :: OdtReader StyleName ListStyle
+lookupListStyle :: ODTReader StyleName ListStyle
lookupListStyle = fromStyles lookupListStyleByName >>^ maybeToChoice
--
-switchCurrentListStyle :: OdtReaderSafe (Maybe ListStyle) (Maybe ListStyle)
+switchCurrentListStyle :: ODTReaderSafe (Maybe ListStyle) (Maybe ListStyle)
switchCurrentListStyle = keepingTheValue getExtraState
>>% swapCurrentListStyle
>>> first setExtraState
>>^ snd
--
-pushStyle :: OdtReaderSafe Style Style
+pushStyle :: ODTReaderSafe Style Style
pushStyle = keepingTheValue (
( keepingTheValue getExtraState
>>% pushStyle'
@@ -186,7 +186,7 @@ pushStyle = keepingTheValue (
>>^ fst
--
-popStyle :: OdtReaderSafe x x
+popStyle :: ODTReaderSafe x x
popStyle = keepingTheValue (
getExtraState
>>> arr popStyle'
@@ -195,11 +195,11 @@ popStyle = keepingTheValue (
>>^ fst
--
-getCurrentListLevel :: OdtReaderSafe _x ListLevel
+getCurrentListLevel :: ODTReaderSafe _x ListLevel
getCurrentListLevel = getExtraState >>^ currentListLevel
--
-updateMediaWithResource :: OdtReaderSafe (FilePath, B.ByteString) (FilePath, B.ByteString)
+updateMediaWithResource :: ODTReaderSafe (FilePath, B.ByteString) (FilePath, B.ByteString)
updateMediaWithResource = keepingTheValue (
(keepingTheValue getExtraState
>>% insertMedia'
@@ -208,7 +208,7 @@ updateMediaWithResource = keepingTheValue (
)
>>^ fst
-lookupResource :: OdtReaderSafe FilePath (FilePath, B.ByteString)
+lookupResource :: ODTReaderSafe FilePath (FilePath, B.ByteString)
lookupResource = proc target -> do
state <- getExtraState -< ()
case lookup target (getMediaEnv state) of
@@ -232,7 +232,7 @@ uniqueIdentFrom baseIdent usedIdents =
-- | First argument: basis for a new "pretty" anchor if none exists yet
-- Second argument: a key ("ugly" anchor)
-- Returns: saved "pretty" anchor or created new one
-getPrettyAnchor :: OdtReaderSafe (AnchorPrefix, Anchor) Anchor
+getPrettyAnchor :: ODTReaderSafe (AnchorPrefix, Anchor) Anchor
getPrettyAnchor = proc (baseIdent, uglyAnchor) -> do
state <- getExtraState -< ()
case lookupPrettyAnchor uglyAnchor state of
@@ -243,7 +243,7 @@ getPrettyAnchor = proc (baseIdent, uglyAnchor) -> do
-- | Input: basis for a new header anchor
-- Output: saved new anchor
-getHeaderAnchor :: OdtReaderSafe Inlines Anchor
+getHeaderAnchor :: ODTReaderSafe Inlines Anchor
getHeaderAnchor = proc title -> do
state <- getExtraState -< ()
let exts = extensionsFromList [Ext_auto_identifiers]
@@ -257,7 +257,7 @@ getHeaderAnchor = proc title -> do
--------------------------------------------------------------------------------
--
-readStyleByName :: OdtReader _x (StyleName, Style)
+readStyleByName :: ODTReader _x (StyleName, Style)
readStyleByName =
findAttr NsText "style-name" >>? keepingTheValue getStyleByName >>^ liftE
where
@@ -266,11 +266,11 @@ readStyleByName =
liftE (_, Left v) = Left v
--
-isStyleToTrace :: OdtReader Style Bool
+isStyleToTrace :: ODTReader Style Bool
isStyleToTrace = findStyleFamily >>?^ (==FaText)
--
-withNewStyle :: OdtReaderSafe x Inlines -> OdtReaderSafe x Inlines
+withNewStyle :: ODTReaderSafe x Inlines -> ODTReaderSafe x Inlines
withNewStyle a = proc x -> do
fStyle <- readStyleByName -< ()
case fStyle of
@@ -404,7 +404,7 @@ getParaModifier Style{..} | Just props <- paraProperties styleProperties
= False
--
-constructPara :: OdtReaderSafe Blocks Blocks -> OdtReaderSafe Blocks Blocks
+constructPara :: ODTReaderSafe Blocks Blocks -> ODTReaderSafe Blocks Blocks
constructPara reader = proc blocks -> do
fStyle <- readStyleByName -< blocks
case fStyle of
@@ -459,7 +459,7 @@ getListConstructor ListLevelStyle{..} =
-- state must be switched before and after the call to the child converter
-- while in the latter the child converter can be called directly.
-- If anything goes wrong, a default ordered-list-constructor is used.
-constructList :: OdtReaderSafe x [Blocks] -> OdtReaderSafe x Blocks
+constructList :: ODTReaderSafe x [Blocks] -> ODTReaderSafe x Blocks
constructList reader = proc x -> do
modifyExtraState (shiftListLevel 1) -< ()
listLevel <- getCurrentListLevel -< ()
@@ -502,7 +502,7 @@ constructList reader = proc x -> do
-- Readers
--------------------------------------------------------------------------------
-type ElementMatcher result = (Namespace, ElementName, OdtReader result result)
+type ElementMatcher result = (Namespace, ElementName, ODTReader result result)
type InlineMatcher = ElementMatcher Inlines
@@ -517,7 +517,7 @@ firstMatch = FirstMatch . Alt . Just
--
matchingElement :: (Monoid e)
=> Namespace -> ElementName
- -> OdtReaderSafe e e
+ -> ODTReaderSafe e e
-> ElementMatcher e
matchingElement ns name reader = (ns, name, asResultAccumulator reader)
where
@@ -527,14 +527,14 @@ matchingElement ns name reader = (ns, name, asResultAccumulator reader)
--
matchChildContent' :: (Monoid result)
=> [ElementMatcher result]
- -> OdtReaderSafe _x result
+ -> ODTReaderSafe _x result
matchChildContent' ls = returnV mempty >>> matchContent' ls
--
matchChildContent :: (Monoid result)
=> [ElementMatcher result]
- -> OdtReaderSafe (result, XML.Content) result
- -> OdtReaderSafe _x result
+ -> ODTReaderSafe (result, XML.Content) result
+ -> ODTReaderSafe _x result
matchChildContent ls fallback = returnV mempty >>> matchContent ls fallback
--------------------------------------------
@@ -547,11 +547,11 @@ matchChildContent ls fallback = returnV mempty >>> matchContent ls fallback
--
-- | Open Document allows several consecutive spaces if they are marked up
-read_plain_text :: OdtReaderSafe (Inlines, XML.Content) Inlines
+read_plain_text :: ODTReaderSafe (Inlines, XML.Content) Inlines
read_plain_text = fst ^&&& read_plain_text' >>% recover
where
-- fallible version
- read_plain_text' :: OdtReader (Inlines, XML.Content) Inlines
+ read_plain_text' :: ODTReader (Inlines, XML.Content) Inlines
read_plain_text' = ( second ( arr extractText )
>>^ spreadChoice >>?! second text
)
@@ -784,7 +784,7 @@ read_frame = matchingElement NsDraw "frame"
>>> foldS read_frame_child
>>> arr fold
-read_frame_child :: OdtReaderSafe XML.Element (FirstMatch Inlines)
+read_frame_child :: ODTReaderSafe XML.Element (FirstMatch Inlines)
read_frame_child =
proc child -> case elName child of
"image" -> read_frame_img -< child
@@ -792,7 +792,7 @@ read_frame_child =
"text-box" -> read_frame_text_box -< child
_ -> returnV mempty -< ()
-read_frame_img :: OdtReaderSafe XML.Element (FirstMatch Inlines)
+read_frame_img :: ODTReaderSafe XML.Element (FirstMatch Inlines)
read_frame_img =
proc img -> do
src <- executeIn (findAttr' NsXLink "href") -< img
@@ -820,7 +820,7 @@ image_attributes x y =
dim name (Just v) = [(name, v)]
dim _ Nothing = []
-read_frame_mathml :: OdtReaderSafe XML.Element (FirstMatch Inlines)
+read_frame_mathml :: ODTReaderSafe XML.Element (FirstMatch Inlines)
read_frame_mathml =
proc obj -> do
src <- executeIn (findAttr' NsXLink "href") -< obj
@@ -834,7 +834,7 @@ read_frame_mathml =
Left _ -> returnV mempty -< ()
Right exps -> arr (firstMatch . displayMath . writeTeX) -< exps
-read_frame_text_box :: OdtReaderSafe XML.Element (FirstMatch Inlines)
+read_frame_text_box :: ODTReaderSafe XML.Element (FirstMatch Inlines)
read_frame_text_box = proc box -> do
paragraphs <- executeIn (matchChildContent' [ read_paragraph ]) -< box
arr read_img_with_caption -< toList paragraphs
@@ -857,19 +857,19 @@ _ANCHOR_PREFIX_ :: T.Text
_ANCHOR_PREFIX_ = "anchor"
--
-readAnchorAttr :: OdtReader _x Anchor
+readAnchorAttr :: ODTReader _x Anchor
readAnchorAttr = findAttrText NsText "name"
-- | Beware: may fail
-findAnchorName :: OdtReader AnchorPrefix Anchor
+findAnchorName :: ODTReader AnchorPrefix Anchor
findAnchorName = ( keepingTheValue readAnchorAttr
>>^ spreadChoice
) >>?! getPrettyAnchor
--
-maybeAddAnchorFrom :: OdtReader Inlines AnchorPrefix
- -> OdtReaderSafe Inlines Inlines
+maybeAddAnchorFrom :: ODTReader Inlines AnchorPrefix
+ -> ODTReaderSafe Inlines Inlines
maybeAddAnchorFrom anchorReader =
keepingTheValue (anchorReader >>? findAnchorName >>?^ toAnchorElem)
>>>
@@ -898,14 +898,14 @@ read_reference_start = matchingElement NsText "reference-mark-start"
$ maybeAddAnchorFrom readAnchorAttr
-- | Beware: may fail
-findAnchorRef :: OdtReader _x Anchor
+findAnchorRef :: ODTReader _x Anchor
findAnchorRef = ( findAttrText NsText "ref-name"
>>?^ (_ANCHOR_PREFIX_,)
) >>?! getPrettyAnchor
--
-maybeInAnchorRef :: OdtReaderSafe Inlines Inlines
+maybeInAnchorRef :: ODTReaderSafe Inlines Inlines
maybeInAnchorRef = proc inlines -> do
fRef <- findAnchorRef -< ()
case fRef of
@@ -933,7 +933,7 @@ read_reference_ref = matchingElement NsText "reference-ref"
-- Entry point
----------------------
-read_text :: OdtReaderSafe _x Pandoc
+read_text :: ODTReaderSafe _x Pandoc
read_text = matchChildContent' [ read_header
, read_paragraph
, read_list
@@ -950,7 +950,7 @@ post_process' (Table attr _ specs th tb tf : Div ("", ["caption"], _) blks : xs)
= Table attr (Caption Nothing blks) specs th tb tf : post_process' xs
post_process' bs = bs
-read_body :: OdtReader _x (Pandoc, MediaBag)
+read_body :: ODTReader _x (Pandoc, MediaBag)
read_body = executeInSub NsOffice "body"
$ executeInSub NsOffice "text"
$ liftAsSuccess
diff --git a/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs b/src/Text/Pandoc/Readers/ODT/Generic/Fallible.hs
index 1902259c4..c6f45ced1 100644
--- a/src/Text/Pandoc/Readers/Odt/Generic/Fallible.hs
+++ b/src/Text/Pandoc/Readers/ODT/Generic/Fallible.hs
@@ -1,5 +1,5 @@
{- |
- Module : Text.Pandoc.Readers.Odt.Generic.Fallible
+ Module : Text.Pandoc.Readers.ODT.Generic.Fallible
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -17,7 +17,7 @@ compatible instances of "ArrowChoice".
-}
-- We export everything
-module Text.Pandoc.Readers.Odt.Generic.Fallible where
+module Text.Pandoc.Readers.ODT.Generic.Fallible where
-- | Default for now. Will probably become a class at some point.
type Failure = ()
diff --git a/src/Text/Pandoc/Readers/Odt/Generic/Namespaces.hs b/src/Text/Pandoc/Readers/ODT/Generic/Namespaces.hs
index 78a7fc0b2..d7310d2e5 100644
--- a/src/Text/Pandoc/Readers/Odt/Generic/Namespaces.hs
+++ b/src/Text/Pandoc/Readers/ODT/Generic/Namespaces.hs
@@ -1,5 +1,5 @@
{- |
- Module : Text.Pandoc.Readers.Odt.Generic.Namespaces
+ Module : Text.Pandoc.Readers.ODT.Generic.Namespaces
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -11,7 +11,7 @@ A class containing a set of namespace identifiers. Used to convert between
typesafe Haskell namespace identifiers and unsafe "real world" namespaces.
-}
-module Text.Pandoc.Readers.Odt.Generic.Namespaces where
+module Text.Pandoc.Readers.ODT.Generic.Namespaces where
import qualified Data.Map as M
import Data.Text (Text)
diff --git a/src/Text/Pandoc/Readers/Odt/Generic/SetMap.hs b/src/Text/Pandoc/Readers/ODT/Generic/SetMap.hs
index 0e4fa0990..be586803b 100644
--- a/src/Text/Pandoc/Readers/Odt/Generic/SetMap.hs
+++ b/src/Text/Pandoc/Readers/ODT/Generic/SetMap.hs
@@ -1,5 +1,5 @@
{- |
- Module : Text.Pandoc.Readers.Odt.Generic.SetMap
+ Module : Text.Pandoc.Readers.ODT.Generic.SetMap
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -10,7 +10,7 @@
A map of values to sets of values.
-}
-module Text.Pandoc.Readers.Odt.Generic.SetMap where
+module Text.Pandoc.Readers.ODT.Generic.SetMap where
import qualified Data.Map as M
import qualified Data.Set as S
diff --git a/src/Text/Pandoc/Readers/Odt/Generic/Utils.hs b/src/Text/Pandoc/Readers/ODT/Generic/Utils.hs
index edefe3c70..fe85ef6f2 100644
--- a/src/Text/Pandoc/Readers/Odt/Generic/Utils.hs
+++ b/src/Text/Pandoc/Readers/ODT/Generic/Utils.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE ViewPatterns #-}
{- |
- Module : Text.Pandoc.Reader.Odt.Generic.Utils
+ Module : Text.Pandoc.Reader.ODT.Generic.Utils
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -11,7 +11,7 @@
General utility functions for the odt reader.
-}
-module Text.Pandoc.Readers.Odt.Generic.Utils
+module Text.Pandoc.Readers.ODT.Generic.Utils
( uncurry3
, uncurry4
, uncurry5
diff --git a/src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs b/src/Text/Pandoc/Readers/ODT/Generic/XMLConverter.hs
index 551279cf6..fc0cd21e5 100644
--- a/src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs
+++ b/src/Text/Pandoc/Readers/ODT/Generic/XMLConverter.hs
@@ -4,7 +4,7 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE PatternGuards #-}
{- |
- Module : Text.Pandoc.Readers.Odt.Generic.XMLConverter
+ Module : Text.Pandoc.Readers.ODT.Generic.XMLConverter
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -17,7 +17,7 @@ It might be sufficient to define this reader as a comonad, but there is
not a lot of use in trying.
-}
-module Text.Pandoc.Readers.Odt.Generic.XMLConverter
+module Text.Pandoc.Readers.ODT.Generic.XMLConverter
( ElementName
, XMLConverterState
, XMLConverter
@@ -68,11 +68,11 @@ import Data.List (foldl')
import qualified Text.Pandoc.XML.Light as XML
-import Text.Pandoc.Readers.Odt.Arrows.State
-import Text.Pandoc.Readers.Odt.Arrows.Utils
-import Text.Pandoc.Readers.Odt.Generic.Namespaces
-import Text.Pandoc.Readers.Odt.Generic.Utils
-import Text.Pandoc.Readers.Odt.Generic.Fallible
+import Text.Pandoc.Readers.ODT.Arrows.State
+import Text.Pandoc.Readers.ODT.Arrows.Utils
+import Text.Pandoc.Readers.ODT.Generic.Namespaces
+import Text.Pandoc.Readers.ODT.Generic.Utils
+import Text.Pandoc.Readers.ODT.Generic.Fallible
--------------------------------------------------------------------------------
-- Basis types for readability
diff --git a/src/Text/Pandoc/Readers/Odt/Namespaces.hs b/src/Text/Pandoc/Readers/ODT/Namespaces.hs
index 70741c28d..77ca21165 100644
--- a/src/Text/Pandoc/Readers/Odt/Namespaces.hs
+++ b/src/Text/Pandoc/Readers/ODT/Namespaces.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
{- |
- Module : Text.Pandoc.Reader.Odt.Namespaces
+ Module : Text.Pandoc.Reader.ODT.Namespaces
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -11,14 +11,14 @@
Namespaces used in odt files.
-}
-module Text.Pandoc.Readers.Odt.Namespaces ( Namespace (..)
+module Text.Pandoc.Readers.ODT.Namespaces ( Namespace (..)
) where
import qualified Data.Map as M (empty, insert)
import Data.Maybe (fromMaybe, listToMaybe)
import Data.Text (Text)
import qualified Data.Text as T
-import Text.Pandoc.Readers.Odt.Generic.Namespaces
+import Text.Pandoc.Readers.ODT.Generic.Namespaces
instance NameSpaceID Namespace where
diff --git a/src/Text/Pandoc/Readers/Odt/StyleReader.hs b/src/Text/Pandoc/Readers/ODT/StyleReader.hs
index 7337194cb..dadd37dcc 100644
--- a/src/Text/Pandoc/Readers/Odt/StyleReader.hs
+++ b/src/Text/Pandoc/Readers/ODT/StyleReader.hs
@@ -4,7 +4,7 @@
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE OverloadedStrings #-}
{- |
- Module : Text.Pandoc.Readers.Odt.StyleReader
+ Module : Text.Pandoc.Readers.ODT.StyleReader
Copyright : Copyright (C) 2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -15,7 +15,7 @@
Reader for the style information in an odt document.
-}
-module Text.Pandoc.Readers.Odt.StyleReader
+module Text.Pandoc.Readers.ODT.StyleReader
( Style (..)
, StyleName
, StyleFamily (..)
@@ -56,15 +56,15 @@ import qualified Text.Pandoc.XML.Light as XML
import Text.Pandoc.Shared (safeRead, tshow)
-import Text.Pandoc.Readers.Odt.Arrows.Utils
+import Text.Pandoc.Readers.ODT.Arrows.Utils
-import Text.Pandoc.Readers.Odt.Generic.Fallible
-import qualified Text.Pandoc.Readers.Odt.Generic.SetMap as SM
-import Text.Pandoc.Readers.Odt.Generic.Utils
-import Text.Pandoc.Readers.Odt.Generic.XMLConverter
+import Text.Pandoc.Readers.ODT.Generic.Fallible
+import qualified Text.Pandoc.Readers.ODT.Generic.SetMap as SM
+import Text.Pandoc.Readers.ODT.Generic.Utils
+import Text.Pandoc.Readers.ODT.Generic.XMLConverter
-import Text.Pandoc.Readers.Odt.Base
-import Text.Pandoc.Readers.Odt.Namespaces
+import Text.Pandoc.Readers.ODT.Base
+import Text.Pandoc.Readers.ODT.Namespaces
readStylesAt :: XML.Element -> Fallible Styles
readStylesAt e = runConverter' readAllStyles mempty e
diff --git a/test/Tests/Readers/Odt.hs b/test/Tests/Readers/ODT.hs
index 8dcd7b29b..ce107af69 100644
--- a/test/Tests/Readers/Odt.hs
+++ b/test/Tests/Readers/ODT.hs
@@ -1,6 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
{- |
- Module : Tests.Readers.Odt
+ Module : Tests.Readers.ODT
Copyright : © 2015-2022 John MacFarlane
2015 Martin Linnemann
License : GNU GPL, version 2 or above
@@ -11,7 +11,7 @@
Tests for the ODT reader.
-}
-module Tests.Readers.Odt (tests) where
+module Tests.Readers.ODT (tests) where
import Control.Monad (liftM)
import qualified Data.ByteString as BS
@@ -33,21 +33,21 @@ tests = testsComparingToMarkdown ++ testsComparingToNative
testsComparingToMarkdown :: [TestTree]
testsComparingToMarkdown = map nameToTest namesOfTestsComparingToMarkdown
where nameToTest name = createTest
- compareOdtToMarkdown
+ compareODTToMarkdown
name
- (toOdtPath name)
+ (toODTPath name)
(toMarkdownPath name)
- toOdtPath name = "odt/odt/" ++ name ++ ".odt"
+ toODTPath name = "odt/odt/" ++ name ++ ".odt"
toMarkdownPath name = "odt/markdown/" ++ name ++ ".md"
testsComparingToNative :: [TestTree]
testsComparingToNative = map nameToTest namesOfTestsComparingToNative
where nameToTest name = createTest
- compareOdtToNative
+ compareODTToNative
name
- (toOdtPath name)
+ (toODTPath name)
(toNativePath name)
- toOdtPath name = "odt/odt/" ++ name ++ ".odt"
+ toODTPath name = "odt/odt/" ++ name ++ ".odt"
toNativePath name = "odt/native/" ++ name ++ ".native"
@@ -73,22 +73,22 @@ type TestCreator = ReaderOptions
-> FilePath -> FilePath
-> IO (NoNormPandoc, NoNormPandoc)
-compareOdtToNative :: TestCreator
-compareOdtToNative opts odtPath nativePath = do
+compareODTToNative :: TestCreator
+compareODTToNative opts odtPath nativePath = do
nativeFile <- UTF8.toText <$> BS.readFile nativePath
odtFile <- B.readFile odtPath
native <- getNoNormVia id "native" <$> runIO (readNative def nativeFile)
- odt <- getNoNormVia id "odt" <$> runIO (readOdt opts odtFile)
+ odt <- getNoNormVia id "odt" <$> runIO (readODT opts odtFile)
return (odt,native)
-compareOdtToMarkdown :: TestCreator
-compareOdtToMarkdown opts odtPath markdownPath = do
+compareODTToMarkdown :: TestCreator
+compareODTToMarkdown opts odtPath markdownPath = do
markdownFile <- UTF8.toText <$> BS.readFile markdownPath
odtFile <- B.readFile odtPath
markdown <- getNoNormVia id "markdown" <$>
runIO (readMarkdown def{ readerExtensions = pandocExtensions }
markdownFile)
- odt <- getNoNormVia id "odt" <$> runIO (readOdt opts odtFile)
+ odt <- getNoNormVia id "odt" <$> runIO (readODT opts odtFile)
return (odt,markdown)
@@ -125,7 +125,7 @@ compareMediaPathIO mediaPath mediaBag odtPath = do
compareMediaBagIO :: FilePath -> IO Bool
compareMediaBagIO odtFile = do
df <- B.readFile odtFile
- let (_, mb) = readOdt def df
+ let (_, mb) = readODT def df
bools <- mapM
(\(fp, _, _) -> compareMediaPathIO fp mb odtFile)
(mediaDirectory mb)
diff --git a/test/test-pandoc.hs b/test/test-pandoc.hs
index 678d534dd..d4e069739 100644
--- a/test/test-pandoc.hs
+++ b/test/test-pandoc.hs
@@ -23,7 +23,7 @@ import qualified Tests.Readers.Jira
import qualified Tests.Readers.LaTeX
import qualified Tests.Readers.Markdown
import qualified Tests.Readers.Muse
-import qualified Tests.Readers.Odt
+import qualified Tests.Readers.ODT
import qualified Tests.Readers.Org
import qualified Tests.Readers.RST
import qualified Tests.Readers.RTF
@@ -89,7 +89,7 @@ tests pandocPath = testGroup "pandoc tests"
, testGroup "RST" Tests.Readers.RST.tests
, testGroup "RTF" Tests.Readers.RTF.tests
, testGroup "Docx" Tests.Readers.Docx.tests
- , testGroup "Odt" Tests.Readers.Odt.tests
+ , testGroup "ODT" Tests.Readers.ODT.tests
, testGroup "Txt2Tags" Tests.Readers.Txt2Tags.tests
, testGroup "EPUB" Tests.Readers.EPUB.tests
, testGroup "Muse" Tests.Readers.Muse.tests