pandoc-types 1.7 → 1.8
raw patch · 3 files changed
+32/−21 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Text.Pandoc.Builder: htmlInline :: String -> Inlines
- Text.Pandoc.Builder: rawHtml :: String -> Blocks
- Text.Pandoc.Builder: tex :: String -> Inlines
- Text.Pandoc.Definition: HtmlInline :: String -> Inline
- Text.Pandoc.Definition: RawHtml :: String -> Block
- Text.Pandoc.Definition: TeX :: String -> Inline
+ Text.Pandoc.Builder: codeWith :: Attr -> String -> Inlines
+ Text.Pandoc.Builder: rawBlock :: Format -> String -> Blocks
+ Text.Pandoc.Builder: rawInline :: Format -> String -> Inlines
+ Text.Pandoc.Definition: RawBlock :: Format -> String -> Block
+ Text.Pandoc.Definition: RawInline :: Format -> String -> Inline
+ Text.Pandoc.Definition: nullAttr :: Attr
+ Text.Pandoc.Definition: type Format = String
- Text.Pandoc.Definition: Code :: String -> Inline
+ Text.Pandoc.Definition: Code :: Attr -> String -> Inline
Files
- Text/Pandoc/Builder.hs +21/−16
- Text/Pandoc/Definition.hs +9/−4
- pandoc-types.cabal +2/−1
Text/Pandoc/Builder.hs view
@@ -106,6 +106,7 @@ , singleQuoted , doubleQuoted , cite+ , codeWith , code , space , emdash@@ -114,8 +115,7 @@ , linebreak , math , displayMath- , tex- , htmlInline+ , rawInline , link , image , note@@ -124,7 +124,7 @@ , plain , codeBlockWith , codeBlock- , rawHtml+ , rawBlock , blockQuote , bulletList , orderedListWith@@ -143,7 +143,6 @@ import Data.Sequence (Seq, fromList, singleton, empty, (><)) import Data.Foldable (Foldable, toList) import Data.List (groupBy)-import Data.Char (isSpace) import Control.Arrow ((***)) type Inlines = Seq Inline@@ -181,10 +180,14 @@ text :: String -> Inlines text = fromList . map conv . breakBySpaces where breakBySpaces = groupBy sameCategory- sameCategory x y = (isSpace x && isSpace y) ||- not (isSpace x || isSpace y)- conv xs | all isSpace xs = Space+ sameCategory x y = (is_space x && is_space y) ||+ (not $ is_space x || is_space y)+ conv xs | all is_space xs = Space conv xs = Str xs+ is_space ' ' = True+ is_space '\n' = True+ is_space '\t' = True+ is_space _ = False str :: String -> Inlines str = singleton . Str@@ -219,8 +222,13 @@ cite :: [Citation] -> Inlines -> Inlines cite cts = singleton . Cite cts . toList +-- | Inline code with attributes.+codeWith :: Attr -> String -> Inlines+codeWith attrs = singleton . Code attrs++-- | Plain inline code. code :: String -> Inlines-code = singleton . Code+code = codeWith nullAttr space :: Inlines space = singleton Space@@ -248,11 +256,8 @@ displayMath :: String -> Inlines displayMath = singleton . Math DisplayMath -tex :: String -> Inlines-tex = singleton . TeX--htmlInline :: String -> Inlines-htmlInline = singleton . HtmlInline+rawInline :: Format -> String -> Inlines+rawInline format = singleton . RawInline format link :: String -- ^ URL -> String -- ^ Title@@ -283,10 +288,10 @@ -- | A plain code block. codeBlock :: String -> Blocks-codeBlock = codeBlockWith ("",[],[])+codeBlock = codeBlockWith nullAttr -rawHtml :: String -> Blocks-rawHtml = singleton . RawHtml+rawBlock :: Format -> String -> Blocks+rawBlock format = singleton . RawBlock format blockQuote :: Blocks -> Blocks blockQuote = singleton . BlockQuote . toList
Text/Pandoc/Definition.hs view
@@ -69,15 +69,21 @@ -- | Attributes: identifier, classes, key-value pairs type Attr = (String, [String], [(String, String)]) +nullAttr :: Attr+nullAttr = ("",[],[])+ -- | Table cells are list of Blocks type TableCell = [Block] +-- | Formats for raw blocks+type Format = 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)+ | RawBlock Format String -- ^ Raw block | BlockQuote [Block] -- ^ Block quote (list of blocks) | OrderedList ListAttributes [[Block]] -- ^ Ordered list (attributes -- and a list of items, each a list of blocks)@@ -117,7 +123,7 @@ | 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)+ | Code Attr String -- ^ Inline code (literal) | Space -- ^ Inter-word space | EmDash -- ^ Em dash | EnDash -- ^ En dash@@ -125,8 +131,7 @@ | Ellipses -- ^ Ellipses | LineBreak -- ^ Hard line break | Math MathType String -- ^ TeX math (literal)- | TeX String -- ^ LaTeX code (literal)- | HtmlInline String -- ^ HTML code (literal)+ | RawInline Format String -- ^ Raw inline | Link [Inline] Target -- ^ Hyperlink: text (list of inlines), target | Image [Inline] Target -- ^ Image: alt text (list of inlines), target -- and target
pandoc-types.cabal view
@@ -1,5 +1,5 @@ Name: pandoc-types-Version: 1.7+Version: 1.8 Synopsis: Types for representing a structured document Description: This package contains definitions for the 'Pandoc' data structure, which is used by pandoc to represent@@ -21,6 +21,7 @@ License-file: COPYING Author: John MacFarlane Maintainer: jgm@berkeley.edu+Bug-Reports: http://code.google.com/p/pandoc/issues/list Copyright: (c) 2006-2010 John MacFarlane Category: Text Build-type: Simple