texmath 0.3.1.4 → 0.3.1.5
raw patch · 4 files changed
+7/−9 lines, 4 files
Files
- Text/TeXMath/Macros.hs +3/−6
- cgi/texmath-cgi.hs +2/−1
- texmath.cabal +1/−1
- texmath.hs +1/−1
Text/TeXMath/Macros.hs view
@@ -44,15 +44,12 @@ -- | Applies a list of macros to a string recursively until a fixed -- point is reached. If there are several macros in the list with the--- same name, later ones will shadow earlier ones.+-- same name, earlier ones will shadow later ones. applyMacros :: [Macro] -> String -> String applyMacros [] = id-applyMacros ms = iterateToFixedPoint ((2 * length ms) + 1) $- applyMacrosOnce $ reverse ms -- we reverse so that the most recently- -- defined macros will be applied first- -- and shadow others with the same name+applyMacros ms = iterateToFixedPoint ((2 * length ms) + 1) $ applyMacrosOnce ms -------------------------------------------------------------------------------------+------------------------------------------------------------------------------ iterateToFixedPoint :: Eq a => Int -> (a -> a) -> a -> a iterateToFixedPoint 0 _ _ = error $
cgi/texmath-cgi.hs view
@@ -24,7 +24,8 @@ case parse pMacros "macros" (rawMacros ++ "\n") of Left err -> toJSObject [("success", JSBool False) ,("error", JSString $ toJSString (show err))]- Right ms -> case texMathToMathML DisplayBlock (applyMacros ms latexFormula) of+ Right ms -> case texMathToMathML DisplayBlock+ (applyMacros (reverse ms) latexFormula) of Left e -> toJSObject [("success", JSBool False) , ("error", JSString $ toJSString e)] Right v -> toJSObject [("success", JSBool True)
texmath.cabal view
@@ -1,5 +1,5 @@ Name: texmath-Version: 0.3.1.4+Version: 0.3.1.5 Cabal-version: >= 1.2 Build-type: Custom Synopsis: Conversion of LaTeX math formulas to MathML.
texmath.hs view
@@ -20,7 +20,7 @@ stripMacroDefs = do macros <- many (try $ pSkipSpaceComments >> pMacroDefinition) rest <- getInput- return (macros, rest)+ return (reverse macros, rest) -- reversed so later ones will shadow earlier main :: IO () main = do