marxup 3.1.0.0 → 3.1.1.0
raw patch · 7 files changed
+52/−21 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- MarXup.Beamer: enumerat :: [Tex ()] -> Tex ()
- MarXup.Beamer: itemiz :: [Tex ()] -> Tex ()
+ MarXup.Latex: newpage :: TeX
+ MarXup.Latex: rawMath :: Verbatim a -> Tex ()
+ MarXup.Latex: table :: TeX -> TeX -> Tex SortedLabel
+ MarXup.PrettyPrint.Core: instance GHC.Base.Semigroup MarXup.PrettyPrint.Core.Doc
+ MarXup.Tex: ACMArt :: ClassFile
+ MarXup.Tex: instance GHC.Base.Semigroup MarXup.Tex.TeX
- MarXup: class Element a where type Target a where {
+ MarXup: class Element a where {
- MarXup.Beamer: frame :: Tex a1 -> Tex a -> Tex a
+ MarXup.Beamer: frame :: () => Tex a1 -> Tex a2 -> Tex a2
- MarXup.Beamer: framesubtitle :: Tex a -> Tex a
+ MarXup.Beamer: framesubtitle :: () => Tex a -> Tex a
- MarXup.Beamer: hide :: Tex a -> Tex a
+ MarXup.Beamer: hide :: () => Tex a -> Tex a
- MarXup.Beamer: note :: Tex a -> Tex a
+ MarXup.Beamer: note :: () => Tex a -> Tex a
- MarXup.LineUp.Haskell: haskellCust :: ParseMode -> (PrintTok) -> Verbatim a -> Tex ()
+ MarXup.LineUp.Haskell: haskellCust :: ParseMode -> PrintTok -> Verbatim a -> Tex ()
- MarXup.LineUp.Haskell: haskellInlineCust :: ParseMode -> (PrintTok) -> Verbatim a -> Tex ()
+ MarXup.LineUp.Haskell: haskellInlineCust :: ParseMode -> PrintTok -> Verbatim a -> Tex ()
- MarXup.Math: parp :: Ord a1 => a1 -> a1 -> Tex a -> Tex a
+ MarXup.Math: parp :: Ord a1 => a1 -> a1 -> Tex a2 -> Tex a2
Files
- MarXup/Beamer.hs +0/−2
- MarXup/Latex.hs +29/−6
- MarXup/Latex/Math.hs +2/−1
- MarXup/LineUp/Haskell.hs +8/−4
- MarXup/PrettyPrint/Core.hs +2/−1
- MarXup/Tex.hs +10/−6
- marxup.cabal +1/−1
MarXup/Beamer.hs view
@@ -14,8 +14,6 @@ bod framesubtitle = cmd "framesubtitle"-itemiz xs = itemize $ mconcat $ fmap (item <>) xs-enumerat xs = enumerate $ mconcat $ fmap (item <>) xs note = cmd "note"
MarXup/Latex.hs view
@@ -5,8 +5,7 @@ import MarXup.Verbatim import Control.Monad (forM_,when,forM) import MarXup.Tex-import Data.List (intersperse,groupBy,elemIndex,nub,intercalate)-import Data.Monoid+import Data.List (intersperse,groupBy,elemIndex,nub) import Data.Function (on) -- | Separate the arguments with '\\'@@ -35,17 +34,21 @@ -- | author info as triplets name, institution, email authorinfo' :: AuthorInfoStyle -> [AuthorInfo] -> TeX+authorinfo' ACMArt as = forM_ (groupBy ((==) `on` authorInst) as) $ \ (g@((AuthorInfo _ _ institution):_)) -> do+ let names = map authorName g+ forM_ names $ \n -> cmd "author" $ textual n+ cmd "affiliation" $ do+ cmd "institution" $ textual institution authorinfo' LNCS as = do cmd "author" $ mconcat $ intersperse (cmd0 "and") $ map oneauthor as cmd "institute" $ mconcat $ intersperse (cmd0 "and") $ map textual $ insts where oneauthor AuthorInfo{..} = textual authorName <> (if length insts > 1 then cmd "inst" (textual $ show $ 1 + instIdx) else mempty) where Just instIdx = elemIndex authorInst insts insts = nub $ map authorInst as- authorinfo' SIGPlan as = forM_ (groupBy ((==) `on` authorInst) as) $ \ (g@((AuthorInfo _ _ institution):_)) -> do let names = map authorName g emails = mconcat $ intersperse (cmd0 "and") $ map (textual . authorEmail) g- cmdn "authorinfo" [mconcat $ intersperse (cmd0 "and") $ map textual names, textual institution, emails]+ _ <- cmdn "authorinfo" [mconcat $ intersperse (cmd0 "and") $ map textual names, textual institution, emails] return () authorinfo' EPTCS as = mconcat $ intersperse and' $ flip map (groupBy ((==) `on` authorInst) as) $ \ (g@((AuthorInfo _ _ institution):_)) -> do@@ -109,7 +112,16 @@ newcol = tex "&" newpara :: Tex () newpara = texLn "\\par"+newpage :: TeX+newpage = cmd0 "newpage" +rawMath :: Verbatim a -> Tex ()+rawMath x = do+ tex "$"+ tex $ fromVerbatim x+ tex "$"+ return ()+ maketitle :: Tex () maketitle = cmd "maketitle" $ return () @@ -125,8 +137,10 @@ color :: String -> Tex a -> Tex a color col bod = do- [_,x] <- cmdn' "textcolor" [] [tex col >> return undefined, bod]- return x+ xs <- cmdn' "textcolor" [] [tex col >> return undefined, bod]+ case xs of+ [_,x] -> return x+ _ -> error "MarXup.Tex.color: the impossible happened" ---------------- -- Preamble stuff@@ -155,8 +169,11 @@ -- Lists {-# DEPRECATED item, enumerate, itemize "Since Aug 2015. Use itemList, enumList, descList instead "#-}+item :: Tex () item = cmd0 "item"+enumerate :: Tex a -> Tex a enumerate = env "enumerate"+itemize :: Tex a -> Tex a itemize = env "itemize" itemList :: [TeX] -> TeX@@ -201,6 +218,12 @@ body cmd "caption" caption label "Fig."++table :: TeX -> TeX -> Tex SortedLabel+table caption body = env "table" $ do+ cmd "caption" caption+ body+ MarXup.Tex.label "Table" ---------- -- Fonts
MarXup/Latex/Math.hs view
@@ -61,8 +61,9 @@ -- Environement of name @nv@, which should be refered as @referent@. deflike :: String -> String -> String -> TeX -> TeX -> Tex SortedLabel deflike referent nv header name statement = do- newtheorem nv header cls <- askClass+ unless (cls == ACMArt && nv `elem` ["theorem","lemma"]) $ do+ newtheorem nv header unless (cls == LNCS) $ usepkg "amsthm" 100 [] let envir body = case cls of SIGPlan -> env'' nv [name] [] (hspace "0cm" >> body)
MarXup/LineUp/Haskell.hs view
@@ -36,10 +36,14 @@ ParseFailed location err -> textual (show location ++ show err) splitTok :: String -> (String, Maybe String)-splitTok input = (reverse prefix ++ primes, if null numbers then Nothing else Just (reverse numbers))- where (numbers,prefix) = span isDigit revNonPrimes- (primes,revNonPrimes) = span (== '\'') revIn- revIn = reverse input+splitTok input = (reverse rev3 ++ primes, if null subscript then Nothing else Just (reverse subscript))+ where (explicitSubscript,rev3) = case break (== '_') rev2 of+ (everything,"") -> ("",everything)+ (suff,'_':pref) -> (suff,pref)+ (numbers,rev2) = span isDigit rev1+ (primes,rev1) = span (== '\'') rev0+ rev0 = reverse input+ subscript = explicitSubscript ++ numbers printTok :: PrintTok printTok t = let s = textual $ showToken t
MarXup/PrettyPrint/Core.hs view
@@ -38,7 +38,8 @@ instance Monoid Doc where mempty = Empty- mappend = Cat+instance Semigroup Doc where+ (<>) = Cat group :: Doc -> Doc group x = Union (flatten x) x
MarXup/Tex.hs view
@@ -14,20 +14,20 @@ import qualified Data.Map as Map import Graphics.Diagrams.Core (BoxSpec (..)) -data ClassFile = Plain | LNCS | SIGPlan | IEEE | EPTCS | Beamer+data ClassFile = ACMArt | Plain | LNCS | SIGPlan | IEEE | EPTCS | Beamer deriving Eq ------------------------------------ -- MetaData -data Key = PreClass String | PrePackage Int String | PreTheorem String String -- priority+data Key = PreClass String | PrePackage Int {- priority -} String | PreTheorem String String deriving (Ord,Eq) newtheorem :: String -> String -> TeX newtheorem ident txt = do sty <- askClass- unless ((sty == LNCS || sty == Beamer) && ident `elem` ["theorem", "corollary", "lemma", "definition", "proposition"]) $ do+ unless ((sty == LNCS || sty == Beamer || sty == ACMArt) && ident `elem` ["theorem", "corollary", "lemma", "definition", "proposition"]) $ do Tex $ metaData (PreTheorem ident txt) "" usepkg :: String -> Int -> [String] -> TeX@@ -90,8 +90,10 @@ instance Monoid (TeX) where mempty = tex ""- mappend = (>>) +instance Semigroup (TeX) where+ (<>) = (>>)+ instance IsString (TeX) where fromString = textual @@ -125,8 +127,10 @@ -- | Command with options cmd' :: String -> [String] -> Tex b -> Tex b cmd' cmd options arg = do- [x] <- cmdn' cmd options [arg]- return x+ xs <- cmdn' cmd options [arg]+ case xs of+ [x] -> return x+ _ -> error "MarXup.Tex: cmd': the impossible happened" -- | Command with options and many arguments cmdn' :: String -> [String] -> [Tex a] -> Tex [a]
marxup.cabal view
@@ -1,5 +1,5 @@ name: marxup-version: 3.1.0.0+version: 3.1.1.0 category: Text synopsis: Markup language preprocessor for Haskell description: