Removed Text.Pandoc.Definition, bump version to 1.7.
We now get Text.Pandoc.Definition from the new pandoc-types package. This will make it possible for other programs to supply output in Pandoc format, without depending on the whole pandoc package.
This commit is contained in:
parent
5871c4d51f
commit
db03741847
2 changed files with 3 additions and 168 deletions
|
@ -1,5 +1,5 @@
|
||||||
Name: pandoc
|
Name: pandoc
|
||||||
Version: 1.6.1
|
Version: 1.7
|
||||||
Cabal-Version: >= 1.2
|
Cabal-Version: >= 1.2
|
||||||
Build-Type: Custom
|
Build-Type: Custom
|
||||||
License: GPL
|
License: GPL
|
||||||
|
@ -158,7 +158,8 @@ Library
|
||||||
bytestring >= 0.9, zip-archive >= 0.1.1.4,
|
bytestring >= 0.9, zip-archive >= 0.1.1.4,
|
||||||
utf8-string >= 0.3, old-time >= 1,
|
utf8-string >= 0.3, old-time >= 1,
|
||||||
HTTP >= 4000.0.5, texmath >= 0.4, xml >= 1.3.5 && < 1.4,
|
HTTP >= 4000.0.5, texmath >= 0.4, xml >= 1.3.5 && < 1.4,
|
||||||
random, extensible-exceptions
|
random, extensible-exceptions,
|
||||||
|
pandoc-types == 1.7.*
|
||||||
if impl(ghc >= 6.10)
|
if impl(ghc >= 6.10)
|
||||||
Build-depends: base >= 4 && < 5, syb
|
Build-depends: base >= 4 && < 5, syb
|
||||||
else
|
else
|
||||||
|
@ -180,7 +181,6 @@ Library
|
||||||
|
|
||||||
Exposed-Modules: Text.Pandoc,
|
Exposed-Modules: Text.Pandoc,
|
||||||
Text.Pandoc.Blocks,
|
Text.Pandoc.Blocks,
|
||||||
Text.Pandoc.Definition,
|
|
||||||
Text.Pandoc.CharacterReferences,
|
Text.Pandoc.CharacterReferences,
|
||||||
Text.Pandoc.Shared,
|
Text.Pandoc.Shared,
|
||||||
Text.Pandoc.Parsing,
|
Text.Pandoc.Parsing,
|
||||||
|
|
|
@ -1,165 +0,0 @@
|
||||||
{-# OPTIONS_GHC -fglasgow-exts #-} -- for deriving Typeable
|
|
||||||
{-
|
|
||||||
Copyright (C) 2006-2010 John MacFarlane <jgm@berkeley.edu>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
-}
|
|
||||||
|
|
||||||
{- |
|
|
||||||
Module : Text.Pandoc.Definition
|
|
||||||
Copyright : Copyright (C) 2006-2010 John MacFarlane
|
|
||||||
License : GNU GPL, version 2 or above
|
|
||||||
|
|
||||||
Maintainer : John MacFarlane <jgm@berkeley.edu>
|
|
||||||
Stability : alpha
|
|
||||||
Portability : portable
|
|
||||||
|
|
||||||
Definition of 'Pandoc' data structure for format-neutral representation
|
|
||||||
of documents.
|
|
||||||
-}
|
|
||||||
module Text.Pandoc.Definition where
|
|
||||||
|
|
||||||
import Data.Generics
|
|
||||||
|
|
||||||
data Pandoc = Pandoc Meta [Block] deriving (Eq, Ord, Read, Show, Typeable, Data)
|
|
||||||
|
|
||||||
-- | Bibliographic information for the document: title, authors, date.
|
|
||||||
data Meta = Meta { docTitle :: [Inline]
|
|
||||||
, docAuthors :: [[Inline]]
|
|
||||||
, docDate :: [Inline] }
|
|
||||||
deriving (Eq, Ord, Show, Read, Typeable, Data)
|
|
||||||
|
|
||||||
-- | Alignment of a table column.
|
|
||||||
data Alignment = AlignLeft
|
|
||||||
| AlignRight
|
|
||||||
| AlignCenter
|
|
||||||
| AlignDefault deriving (Eq, Ord, Show, Read, Typeable, Data)
|
|
||||||
|
|
||||||
-- | List attributes.
|
|
||||||
type ListAttributes = (Int, ListNumberStyle, ListNumberDelim)
|
|
||||||
|
|
||||||
-- | Style of list numbers.
|
|
||||||
data ListNumberStyle = DefaultStyle
|
|
||||||
| Example
|
|
||||||
| Decimal
|
|
||||||
| LowerRoman
|
|
||||||
| UpperRoman
|
|
||||||
| LowerAlpha
|
|
||||||
| UpperAlpha deriving (Eq, Ord, Show, Read, Typeable, Data)
|
|
||||||
|
|
||||||
-- | Delimiter of list numbers.
|
|
||||||
data ListNumberDelim = DefaultDelim
|
|
||||||
| Period
|
|
||||||
| OneParen
|
|
||||||
| TwoParens deriving (Eq, Ord, Show, Read, Typeable, Data)
|
|
||||||
|
|
||||||
-- | Attributes: identifier, classes, key-value pairs
|
|
||||||
type Attr = (String, [String], [(String, String)])
|
|
||||||
|
|
||||||
-- | Block element.
|
|
||||||
data Block
|
|
||||||
= Plain [Inline] -- ^ Plain text, not a paragraph
|
|
||||||
| Para [Inline] -- ^ Paragraph
|
|
||||||
| CodeBlock Attr String -- ^ Code block (literal) with attributes
|
|
||||||
| RawHtml String -- ^ Raw HTML block (literal)
|
|
||||||
| BlockQuote [Block] -- ^ Block quote (list of blocks)
|
|
||||||
| OrderedList ListAttributes [[Block]] -- ^ Ordered list (attributes
|
|
||||||
-- and a list of items, each a list of blocks)
|
|
||||||
| BulletList [[Block]] -- ^ Bullet list (list of items, each
|
|
||||||
-- a list of blocks)
|
|
||||||
| DefinitionList [([Inline],[[Block]])] -- ^ Definition list
|
|
||||||
-- Each list item is a pair consisting of a
|
|
||||||
-- term (a list of inlines) and one or more
|
|
||||||
-- definitions (each a list of blocks)
|
|
||||||
| Header Int [Inline] -- ^ Header - level (integer) and text (inlines)
|
|
||||||
| HorizontalRule -- ^ Horizontal rule
|
|
||||||
| Table [Inline] [Alignment] [Double] [[Block]] [[[Block]]] -- ^ Table,
|
|
||||||
-- with caption, column alignments,
|
|
||||||
-- relative column widths (0 = default),
|
|
||||||
-- column headers (each a list of blocks), and
|
|
||||||
-- rows (each a list of lists of blocks)
|
|
||||||
| Null -- ^ Nothing
|
|
||||||
deriving (Eq, Ord, Read, Show, Typeable, Data)
|
|
||||||
|
|
||||||
-- | Type of quotation marks to use in Quoted inline.
|
|
||||||
data QuoteType = SingleQuote | DoubleQuote deriving (Show, Eq, Ord, Read, Typeable, Data)
|
|
||||||
|
|
||||||
-- | Link target (URL, title).
|
|
||||||
type Target = (String, String)
|
|
||||||
|
|
||||||
-- | Type of math element (display or inline).
|
|
||||||
data MathType = DisplayMath | InlineMath deriving (Show, Eq, Ord, Read, Typeable, Data)
|
|
||||||
|
|
||||||
-- | Inline elements.
|
|
||||||
data Inline
|
|
||||||
= Str String -- ^ Text (string)
|
|
||||||
| Emph [Inline] -- ^ Emphasized text (list of inlines)
|
|
||||||
| Strong [Inline] -- ^ Strongly emphasized text (list of inlines)
|
|
||||||
| Strikeout [Inline] -- ^ Strikeout text (list of inlines)
|
|
||||||
| Superscript [Inline] -- ^ Superscripted text (list of inlines)
|
|
||||||
| Subscript [Inline] -- ^ Subscripted text (list of inlines)
|
|
||||||
| SmallCaps [Inline] -- ^ Small caps text (list of inlines)
|
|
||||||
| Quoted QuoteType [Inline] -- ^ Quoted text (list of inlines)
|
|
||||||
| Cite [Citation] [Inline] -- ^ Citation (list of inlines)
|
|
||||||
| Code String -- ^ Inline code (literal)
|
|
||||||
| Space -- ^ Inter-word space
|
|
||||||
| EmDash -- ^ Em dash
|
|
||||||
| EnDash -- ^ En dash
|
|
||||||
| Apostrophe -- ^ Apostrophe
|
|
||||||
| Ellipses -- ^ Ellipses
|
|
||||||
| LineBreak -- ^ Hard line break
|
|
||||||
| Math MathType String -- ^ TeX math (literal)
|
|
||||||
| TeX String -- ^ LaTeX code (literal)
|
|
||||||
| HtmlInline String -- ^ HTML code (literal)
|
|
||||||
| Link [Inline] Target -- ^ Hyperlink: text (list of inlines), target
|
|
||||||
| Image [Inline] Target -- ^ Image: alt text (list of inlines), target
|
|
||||||
-- and target
|
|
||||||
| Note [Block] -- ^ Footnote or endnote
|
|
||||||
deriving (Show, Eq, Ord, Read, Typeable, Data)
|
|
||||||
|
|
||||||
data Citation = Citation { citationId :: String
|
|
||||||
, citationPrefix :: String
|
|
||||||
, citationLocator :: String
|
|
||||||
, citationNoteNum :: Int
|
|
||||||
, citationAutOnly :: Bool
|
|
||||||
, citationNoAut :: Bool
|
|
||||||
, citationHash :: Int
|
|
||||||
}
|
|
||||||
deriving (Show, Ord, Read, Typeable, Data)
|
|
||||||
|
|
||||||
instance Eq Citation where
|
|
||||||
(==) (Citation _ _ _ _ _ _ ha)
|
|
||||||
(Citation _ _ _ _ _ _ hb) = ha == hb
|
|
||||||
|
|
||||||
-- | Applies a transformation on @a@s to matching elements in a @b@.
|
|
||||||
processWith :: (Data a, Data b) => (a -> a) -> b -> b
|
|
||||||
processWith f = everywhere (mkT f)
|
|
||||||
|
|
||||||
-- | Like 'processWith', but with monadic transformations.
|
|
||||||
processWithM :: (Monad m, Data a, Data b) => (a -> m a) -> b -> m b
|
|
||||||
processWithM f = everywhereM (mkM f)
|
|
||||||
|
|
||||||
-- | Runs a query on matching @a@ elements in a @c@.
|
|
||||||
queryWith :: (Data a, Data c) => (a -> [b]) -> c -> [b]
|
|
||||||
queryWith f = everything (++) ([] `mkQ` f)
|
|
||||||
|
|
||||||
{-# DEPRECATED processPandoc "Use processWith instead" #-}
|
|
||||||
processPandoc :: Data a => (a -> a) -> Pandoc -> Pandoc
|
|
||||||
processPandoc = processWith
|
|
||||||
|
|
||||||
{-# DEPRECATED queryPandoc "Use queryWith instead" #-}
|
|
||||||
queryPandoc :: Data a => (a -> [b]) -> Pandoc -> [b]
|
|
||||||
queryPandoc = queryWith
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue