git.iko.soy/typeable/pandoc
on master help sign in
Changed § to % in operators from Odt.Arrows.Utils.
317d9eeJohn MacFarlane
src/Text/Pandoc/Readers/Odt/Arrows/Utils.hs+19−20
@@ -129,24 +129,23 @@ joinOn :: (Arrow a) => (x -> y -> z) -> a (x,y) z
129joinOn = arr.uncurry
129joinOn = arr.uncurry
130
130
131-- | Applies a function to the uncurried result-pair of an arrow-application.
131-- | Applies a function to the uncurried result-pair of an arrow-application.
132−-- (The §-symbol was chosen to evoke an association with pairs through the
132+-- (The %-symbol was chosen to evoke an association with pairs.)
133−-- shared first character)
134−(>>§) :: (Arrow a) => a x (b,c) -> (b -> c -> d) -> a x d
133+(>>%) :: (Arrow a) => a x (b,c) -> (b -> c -> d) -> a x d
135−a >>§ f = a >>^ uncurry f
134+a >>% f = a >>^ uncurry f
136
135
137−-- | '(>>§)' with its arguments flipped
136+-- | '(>>%)' with its arguments flipped
138−(§<<) :: (Arrow a) => (b -> c -> d) -> a x (b,c) -> a x d
137+(%<<) :: (Arrow a) => (b -> c -> d) -> a x (b,c) -> a x d
139−(§<<) = flip (>>§)
138+(%<<) = flip (>>%)
140
139
141-- | Precomposition with an uncurried function
140-- | Precomposition with an uncurried function
142−(§>>) :: (Arrow a) => (b -> c -> d) -> a d r -> a (b,c) r
141+(%>>) :: (Arrow a) => (b -> c -> d) -> a d r -> a (b,c) r
143−f §>> a = uncurry f ^>> a
142+f %>> a = uncurry f ^>> a
144
143
145-- | Precomposition with an uncurried function (right to left variant)
144-- | Precomposition with an uncurried function (right to left variant)
146−(<<§) :: (Arrow a) => a d r -> (b -> c -> d) -> a (b,c) r
145+(<<%) :: (Arrow a) => a d r -> (b -> c -> d) -> a (b,c) r
147−(<<§) = flip (§>>)
146+(<<%) = flip (%>>)
148
147
149−infixr 2 >>§, §<<, §>>, <<§
148+infixr 2 >>%, %<<, %>>, <<%
150
149
151
150
152-- | Duplicate a value and apply an arrow to the second instance.
151-- | Duplicate a value and apply an arrow to the second instance.
@@ -271,7 +270,7 @@ newtype ParallelArrow a b c = CoEval { evalParallelArrow :: a b c }
271
270
272instance (Arrow a, Monoid m) => Monoid (ParallelArrow a b m) where
271instance (Arrow a, Monoid m) => Monoid (ParallelArrow a b m) where
273 mempty = CoEval $ returnV mempty
272 mempty = CoEval $ returnV mempty
274− (CoEval a) `mappend` (CoEval ~b) = CoEval $ a &&& b >>§ mappend
273+ (CoEval a) `mappend` (CoEval ~b) = CoEval $ a &&& b >>% mappend
275
274
276-- | Evaluates a collection of arrows in a parallel fashion.
275-- | Evaluates a collection of arrows in a parallel fashion.
277--
276--
@@ -433,29 +432,29 @@ a ^>>?^? f = a ^>> Left ^|||^ f
433a >>?! f = a >>> right f
432a >>?! f = a >>> right f
434
433
435---
434---
436−(>>?§) :: (ArrowChoice a, Monoid f)
435+(>>?%) :: (ArrowChoice a, Monoid f)
437 => FallibleArrow a x f (b,b')
436 => FallibleArrow a x f (b,b')
438 -> (b -> b' -> c)
437 -> (b -> b' -> c)
439 -> FallibleArrow a x f c
438 -> FallibleArrow a x f c
440−a >>?§ f = a >>?^ (uncurry f)
439+a >>?% f = a >>?^ (uncurry f)
441
440
442---
441---
443−(^>>?§) :: (ArrowChoice a, Monoid f)
442+(^>>?%) :: (ArrowChoice a, Monoid f)
444 => (x -> Either f (b,b'))
443 => (x -> Either f (b,b'))
445 -> (b -> b' -> c)
444 -> (b -> b' -> c)
446 -> FallibleArrow a x f c
445 -> FallibleArrow a x f c
447−a ^>>?§ f = arr a >>?^ (uncurry f)
446+a ^>>?% f = arr a >>?^ (uncurry f)
448
447
449---
448---
450−(>>?§?) :: (ArrowChoice a, Monoid f)
449+(>>?%?) :: (ArrowChoice a, Monoid f)
451 => FallibleArrow a x f (b,b')
450 => FallibleArrow a x f (b,b')
452 -> (b -> b' -> (Either f c))
451 -> (b -> b' -> (Either f c))
453 -> FallibleArrow a x f c
452 -> FallibleArrow a x f c
454−a >>?§? f = a >>?^? (uncurry f)
453+a >>?%? f = a >>?^? (uncurry f)
455
454
456infixr 1 >>?, >>?^, >>?^?
455infixr 1 >>?, >>?^, >>?^?
457infixr 1 ^>>?, ^>>?^, ^>>?^?, >>?!
456infixr 1 ^>>?, ^>>?^, ^>>?^?, >>?!
458−infixr 1 >>?§, ^>>?§, >>?§?
457+infixr 1 >>?%, ^>>?%, >>?%?
459
458
460-- | Keep values that are Right, replace Left values by a constant.
459-- | Keep values that are Right, replace Left values by a constant.
461ifFailedUse :: (ArrowChoice a) => v -> a (Either f v) v
460ifFailedUse :: (ArrowChoice a) => v -> a (Either f v) v
src/Text/Pandoc/Readers/Odt/ContentReader.hs+6−6
@@ -145,7 +145,7 @@ type OdtReaderSafe a b = XMLReaderSafe ReaderState a b
145fromStyles :: (a -> Styles -> b) -> OdtReaderSafe a b
145fromStyles :: (a -> Styles -> b) -> OdtReaderSafe a b
146fromStyles f = keepingTheValue
146fromStyles f = keepingTheValue
147 (getExtraState >>^ styleSet)
147 (getExtraState >>^ styleSet)
148− >>§ f
148+ >>% f
149
149
150--
150--
151getStyleByName :: OdtReader StyleName Style
151getStyleByName :: OdtReader StyleName Style
@@ -162,7 +162,7 @@ lookupListStyle = fromStyles lookupListStyleByName >>^ maybeToChoice
162--
162--
163switchCurrentListStyle :: OdtReaderSafe (Maybe ListStyle) (Maybe ListStyle)
163switchCurrentListStyle :: OdtReaderSafe (Maybe ListStyle) (Maybe ListStyle)
164switchCurrentListStyle = keepingTheValue getExtraState
164switchCurrentListStyle = keepingTheValue getExtraState
165− >>§ swapCurrentListStyle
165+ >>% swapCurrentListStyle
166 >>> first setExtraState
166 >>> first setExtraState
167 >>^ snd
167 >>^ snd
168
168
@@ -170,7 +170,7 @@ switchCurrentListStyle = keepingTheValue getExtraState
170pushStyle :: OdtReaderSafe Style Style
170pushStyle :: OdtReaderSafe Style Style
171pushStyle = keepingTheValue (
171pushStyle = keepingTheValue (
172 ( keepingTheValue getExtraState
172 ( keepingTheValue getExtraState
173− >>§ pushStyle'
173+ >>% pushStyle'
174 )
174 )
175 >>> setExtraState
175 >>> setExtraState
176 )
176 )
@@ -470,7 +470,7 @@ matchingElement :: (Monoid e)
470matchingElement ns name reader = (ns, name, asResultAccumulator reader)
470matchingElement ns name reader = (ns, name, asResultAccumulator reader)
471 where
471 where
472 asResultAccumulator :: (ArrowChoice a, Monoid m) => a m m -> a m (Fallible m)
472 asResultAccumulator :: (ArrowChoice a, Monoid m) => a m m -> a m (Fallible m)
473− asResultAccumulator a = liftAsSuccess $ keepingTheValue a >>§ (<>)
473+ asResultAccumulator a = liftAsSuccess $ keepingTheValue a >>% (<>)
474
474
475--
475--
476matchChildContent' :: (Monoid result)
476matchChildContent' :: (Monoid result)
@@ -497,14 +497,14 @@ matchChildContent ls fallback = returnV mempty >>> matchContent ls fallback
497--
497--
498-- | Open Document allows several consecutive spaces if they are marked up
498-- | Open Document allows several consecutive spaces if they are marked up
499read_plain_text :: OdtReaderSafe (Inlines, XML.Content) Inlines
499read_plain_text :: OdtReaderSafe (Inlines, XML.Content) Inlines
500−read_plain_text = fst ^&&& read_plain_text' >>§ recover
500+read_plain_text = fst ^&&& read_plain_text' >>% recover
501 where
501 where
502 -- fallible version
502 -- fallible version
503 read_plain_text' :: OdtReader (Inlines, XML.Content) Inlines
503 read_plain_text' :: OdtReader (Inlines, XML.Content) Inlines
504 read_plain_text' = ( second ( arr extractText )
504 read_plain_text' = ( second ( arr extractText )
505 >>^ spreadChoice >>?! second text
505 >>^ spreadChoice >>?! second text
506 )
506 )
507− >>?§ (<>)
507+ >>?% (<>)
508 --
508 --
509 extractText :: XML.Content -> Fallible String
509 extractText :: XML.Content -> Fallible String
510 extractText (XML.Text cData) = succeedWith (XML.cdData cData)
510 extractText (XML.Text cData) = succeedWith (XML.cdData cData)
src/Text/Pandoc/Readers/Odt/Generic/XMLConverter.hs+14−14
@@ -331,7 +331,7 @@ convertingExtraState v a = withSubStateF setVAsExtraState modifyWithA
331 where
331 where
332 setVAsExtraState = liftAsSuccess $ extractFromState id >>^ replaceExtraState v
332 setVAsExtraState = liftAsSuccess $ extractFromState id >>^ replaceExtraState v
333 modifyWithA = keepingTheValue (moreState ^>> a)
333 modifyWithA = keepingTheValue (moreState ^>> a)
334− >>^ spreadChoice >>?§ flip replaceExtraState
334+ >>^ spreadChoice >>?% flip replaceExtraState
335
335
336-- | First sets the extra state to the new value. Then produces a new
336-- | First sets the extra state to the new value. Then produces a new
337-- extra state with a converter that uses the new state. Finally, the
337-- extra state with a converter that uses the new state. Finally, the
@@ -413,14 +413,14 @@ elemName :: (NameSpaceID nsID)
413 -> XMLConverter nsID extraState x XML.QName
413 -> XMLConverter nsID extraState x XML.QName
414elemName nsID name = lookupNSiri nsID
414elemName nsID name = lookupNSiri nsID
415 &&& lookupNSprefix nsID
415 &&& lookupNSprefix nsID
416− >>§ XML.QName name
416+ >>% XML.QName name
417
417
418-- | Checks if a given element matches both a specified namespace id
418-- | Checks if a given element matches both a specified namespace id
419-- and a specified element name
419-- and a specified element name
420elemNameIs :: (NameSpaceID nsID)
420elemNameIs :: (NameSpaceID nsID)
421 => nsID -> ElementName
421 => nsID -> ElementName
422 -> XMLConverter nsID extraState XML.Element Bool
422 -> XMLConverter nsID extraState XML.Element Bool
423−elemNameIs nsID name = keepingTheValue (lookupNSiri nsID) >>§ hasThatName
423+elemNameIs nsID name = keepingTheValue (lookupNSiri nsID) >>% hasThatName
424 where hasThatName e iri = let elName = XML.elName e
424 where hasThatName e iri = let elName = XML.elName e
425 in XML.qName elName == name
425 in XML.qName elName == name
426 && XML.qURI elName == iri
426 && XML.qURI elName == iri
@@ -461,8 +461,8 @@ currentElemIs'' nsID name = ( (getCurrentElement >>^ XML.elName >>>
461 (XML.qName >>^ (&&).(== name) )
461 (XML.qName >>^ (&&).(== name) )
462 ^&&&^
462 ^&&&^
463 (XML.qIRI >>^ (==) )
463 (XML.qIRI >>^ (==) )
464− ) >>§ (.)
464+ ) >>% (.)
465− ) &&& lookupNSiri nsID >>§ ($)
465+ ) &&& lookupNSiri nsID >>% ($)
466-}
466-}
467
467
468--
468--
@@ -487,7 +487,7 @@ findChildren :: (NameSpaceID nsID)
487 -> XMLConverter nsID extraState x [XML.Element]
487 -> XMLConverter nsID extraState x [XML.Element]
488findChildren nsID name = elemName nsID name
488findChildren nsID name = elemName nsID name
489 &&& getCurrentElement
489 &&& getCurrentElement
490− >>§ XML.findChildren
490+ >>% XML.findChildren
491
491
492--
492--
493filterChildren :: (XML.Element -> Bool)
493filterChildren :: (XML.Element -> Bool)
@@ -508,7 +508,7 @@ findChild' :: (NameSpaceID nsID)
508 -> XMLConverter nsID extraState x (Maybe XML.Element)
508 -> XMLConverter nsID extraState x (Maybe XML.Element)
509findChild' nsID name = elemName nsID name
509findChild' nsID name = elemName nsID name
510 &&& getCurrentElement
510 &&& getCurrentElement
511− >>§ XML.findChild
511+ >>% XML.findChild
512
512
513--
513--
514findChild :: (NameSpaceID nsID)
514findChild :: (NameSpaceID nsID)
@@ -596,7 +596,7 @@ isThatTheAttrValue :: (NameSpaceID nsID)
596isThatTheAttrValue nsID attrName
596isThatTheAttrValue nsID attrName
597 = keepingTheValue
597 = keepingTheValue
598 (findAttr nsID attrName)
598 (findAttr nsID attrName)
599− >>§ right.(==)
599+ >>% right.(==)
600
600
601-- | Lookup value in a dictionary, fail if no attribute found or value
601-- | Lookup value in a dictionary, fail if no attribute found or value
602-- not in dictionary
602-- not in dictionary
@@ -669,7 +669,7 @@ findAttr' :: (NameSpaceID nsID)
669 -> XMLConverter nsID extraState x (Maybe AttributeValue)
669 -> XMLConverter nsID extraState x (Maybe AttributeValue)
670findAttr' nsID attrName = elemName nsID attrName
670findAttr' nsID attrName = elemName nsID attrName
671 &&& getCurrentElement
671 &&& getCurrentElement
672− >>§ XML.findAttr
672+ >>% XML.findAttr
673
673
674-- | Return value as string or fail
674-- | Return value as string or fail
675findAttr :: (NameSpaceID nsID)
675findAttr :: (NameSpaceID nsID)
@@ -787,7 +787,7 @@ prepareIteration :: (NameSpaceID nsID)
787 -> XMLConverter nsID extraState b [(b, XML.Element)]
787 -> XMLConverter nsID extraState b [(b, XML.Element)]
788prepareIteration nsID name = keepingTheValue
788prepareIteration nsID name = keepingTheValue
789 (findChildren nsID name)
789 (findChildren nsID name)
790− >>§ distributeValue
790+ >>% distributeValue
791
791
792-- | Applies a converter to every child element of a specific type.
792-- | Applies a converter to every child element of a specific type.
793-- Collects results in a 'Monoid'.
793-- Collects results in a 'Monoid'.
@@ -877,9 +877,9 @@ makeMatcherE nsID name c = ( second (
877 elemNameIs nsID name
877 elemNameIs nsID name
878 >>^ bool Nothing (Just tryC)
878 >>^ bool Nothing (Just tryC)
879 )
879 )
880− >>§ (<|>)
880+ >>% (<|>)
881 ) &&&^ snd
881 ) &&&^ snd
882− where tryC = (fst ^&&& executeThere c >>§ recover) &&&^ snd
882+ where tryC = (fst ^&&& executeThere c >>% recover) &&&^ snd
883
883
884-- Helper function: The @c@ is actually a converter that is to be selected by
884-- Helper function: The @c@ is actually a converter that is to be selected by
885-- matching XML content to the first two parameters.
885-- matching XML content to the first two parameters.
@@ -899,14 +899,14 @@ makeMatcherC nsID name c = ( second ( contentToElem
899 >>^ bool Nothing (Just cWithJump)
899 >>^ bool Nothing (Just cWithJump)
900 )
900 )
901 )
901 )
902− >>§ (<|>)
902+ >>% (<|>)
903 ) &&&^ snd
903 ) &&&^ snd
904 where cWithJump = ( fst
904 where cWithJump = ( fst
905 ^&&& ( second contentToElem
905 ^&&& ( second contentToElem
906 >>> spreadChoice
906 >>> spreadChoice
907 ^>>? executeThere c
907 ^>>? executeThere c
908 )
908 )
909− >>§ recover)
909+ >>% recover)
910 &&&^ snd
910 &&&^ snd
911 contentToElem :: FallibleXMLConverter nsID extraState XML.Content XML.Element
911 contentToElem :: FallibleXMLConverter nsID extraState XML.Content XML.Element
912 contentToElem = arr $ \e -> case e of
912 contentToElem = arr $ \e -> case e of
src/Text/Pandoc/Readers/Odt/Namespaces.hs+1−1
@@ -107,4 +107,4 @@ nsIDs = [
107 ("http://www.w3.org/1999/xhtml" , NsXHtml ),
107 ("http://www.w3.org/1999/xhtml" , NsXHtml ),
108 ("http://www.w3.org/2002/xforms" , NsXForms ),
108 ("http://www.w3.org/2002/xforms" , NsXForms ),
109 ("http://www.w3.org/1999/xlink" , NsXLink )
109 ("http://www.w3.org/1999/xlink" , NsXLink )
110− ]
110+ ]
src/Text/Pandoc/Readers/Odt/StyleReader.hs+2−2
@@ -174,7 +174,7 @@ findPitch :: XMLReaderSafe FontPitches _x (Maybe FontPitch)
174findPitch = ( lookupAttr NsStyle "font-pitch"
174findPitch = ( lookupAttr NsStyle "font-pitch"
175 `ifFailedDo` findAttr NsStyle "font-name"
175 `ifFailedDo` findAttr NsStyle "font-name"
176 >>? ( keepingTheValue getExtraState
176 >>? ( keepingTheValue getExtraState
177− >>§ M.lookup
177+ >>% M.lookup
178 >>^ maybeToChoice
178 >>^ maybeToChoice
179 )
179 )
180 )
180 )
@@ -447,7 +447,7 @@ readAllStyles :: StyleReader _x Styles
447readAllStyles = ( readFontPitches
447readAllStyles = ( readFontPitches
448 >>?! ( readAutomaticStyles
448 >>?! ( readAutomaticStyles
449 &&& readStyles ))
449 &&& readStyles ))
450− >>?§? chooseMax
450+ >>?%? chooseMax
451 -- all top elements are always on the same hierarchy level
451 -- all top elements are always on the same hierarchy level
452
452
453--
453--