Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package texmath for openSUSE:Factory checked in at 2025-05-12 20:19:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/texmath (Old) and /work/SRC/openSUSE:Factory/.texmath.new.30101 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "texmath" Mon May 12 20:19:08 2025 rev:65 rq:1276606 version:0.12.10 Changes: -------- --- /work/SRC/openSUSE:Factory/texmath/texmath.changes 2025-03-25 22:21:29.833202857 +0100 +++ /work/SRC/openSUSE:Factory/.texmath.new.30101/texmath.changes 2025-05-12 20:19:09.822154492 +0200 @@ -1,0 +2,20 @@ +Tue Apr 29 21:50:43 UTC 2025 - Peter Simons <psim...@suse.com> + +- Update texmath to version 0.12.10. + texmath (0.12.10) + + * texmath-server: + + + Change endpoints: `/convert` to root, and `/convert-batch` to `/batch`. + + Allow running as CGI if renamed pandoc-server.cgi. In this mode it + accepts JSON content with POST requests or parameters with GET requests, + just like pandoc-server itself. + + * TeX reader: + + + Fix parsing bug with comment at beginning of braced (#258). + + Support negative numbers in `\hspace` (#259). + + Allow decimals in `\hspace` (#259). + + Support `\quad` in `\text` (#260). + +------------------------------------------------------------------- Old: ---- texmath-0.12.9.tar.gz New: ---- texmath-0.12.10.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ texmath.spec ++++++ --- /var/tmp/diff_new_pack.AtIjYm/_old 2025-05-12 20:19:10.422179694 +0200 +++ /var/tmp/diff_new_pack.AtIjYm/_new 2025-05-12 20:19:10.422179694 +0200 @@ -20,7 +20,7 @@ %global pkgver %{pkg_name}-%{version} %bcond_with tests Name: %{pkg_name} -Version: 0.12.9 +Version: 0.12.10 Release: 0 Summary: Conversion between math formats License: GPL-2.0-or-later ++++++ texmath-0.12.9.tar.gz -> texmath-0.12.10.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texmath-0.12.9/README.md new/texmath-0.12.10/README.md --- old/texmath-0.12.9/README.md 2001-09-09 03:46:40.000000000 +0200 +++ new/texmath-0.12.10/README.md 2001-09-09 03:46:40.000000000 +0200 @@ -42,8 +42,6 @@ `texmath` will behave as a CGI script when called under the name `texmath-cgi` (e.g. through a symbolic link). -The file `cgi/texmath.html` contains an example of how it can -be used. But it is also possible to compile a full webserver with a JSON API. To do this, set the `server` cabal flag, e.g. @@ -57,7 +55,7 @@ Sample of use, with `httpie`: ``` -% http --verbose localhost:3000/convert text='2^2' from=tex to=mathml display:=false Accept:'text/plain' +% http --verbose localhost:3000 text='2^2' from=tex to=mathml display:=false Accept:'text/plain' POST /convert HTTP/1.1 Accept: text/plain Accept-Encoding: gzip, deflate @@ -90,12 +88,15 @@ ``` Possible values for `from` are `tex`, `mathml`, and `omml`. -Possible values for `to` are `tex`, `mathml`, `omml`, `eqn`, and -`pandoc` (JSON-encoded Pandoc). +Possible values for `to` are `tex`, `mathml`, `omml`, `eqn`, +`typst` and `pandoc` (JSON-encoded Pandoc). -Alternatively, you can use the `convert-batch` endpoint to pass -in a JSON-encoded list of conversions and get back a JSON-encoded -list of results. +Alternatively, you can use the `/batch` endpoint, passing +in in a JSON-encoded list of conversions and getting back a +JSON-encoded list of results. + +If you rename `pandoc-server` to `pandoc-server.cgi`, it will +function as a CGI program that accepts POST requests. # Generating lookup tables diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texmath-0.12.9/changelog.md new/texmath-0.12.10/changelog.md --- old/texmath-0.12.9/changelog.md 2001-09-09 03:46:40.000000000 +0200 +++ new/texmath-0.12.10/changelog.md 2001-09-09 03:46:40.000000000 +0200 @@ -1,3 +1,19 @@ +texmath (0.12.10) + + * texmath-server: + + + Change endpoints: `/convert` to root, and `/convert-batch` to `/batch`. + + Allow running as CGI if renamed pandoc-server.cgi. In this mode it + accepts JSON content with POST requests or parameters with GET requests, + just like pandoc-server itself. + + * TeX reader: + + + Fix parsing bug with comment at beginning of braced (#258). + + Support negative numbers in `\hspace` (#259). + + Allow decimals in `\hspace` (#259). + + Support `\quad` in `\text` (#260). + texmath (0.12.9) * Better handling of primes in eqn, typst, and tex writers. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texmath-0.12.9/server/Main.hs new/texmath-0.12.10/server/Main.hs --- old/texmath-0.12.9/server/Main.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/texmath-0.12.10/server/Main.hs 2001-09-09 03:46:40.000000000 +0200 @@ -6,8 +6,10 @@ {-# LANGUAGE OverloadedStrings #-} module Main where -import Network.Wai.Handler.Warp +import qualified Network.Wai.Handler.Warp as Warp import Network.Wai.Logger (withStdoutLogger) +import qualified Network.Wai.Handler.CGI as CGI +import Network.Wai.Middleware.Timeout (timeout) import Data.Aeson import Data.Aeson.TH import Data.Maybe (fromMaybe) @@ -19,6 +21,7 @@ import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Encoding as TLE import Text.XML.Light (ppElement) +import System.Environment (getProgName) import Options.Applicative import Safe (readMay) @@ -76,25 +79,32 @@ main :: IO () main = do - let options = info (optsSpec <**> helper) - ( fullDesc - <> progDesc "Run a server for texmath" - <> header "texmath-server - an HTTP server for texmath" ) - opts <- execParser options - putStrLn $ "Starting server on port " <> show (port opts) - withStdoutLogger $ \logger -> do - let settings = setPort (port opts) $ setLogger logger defaultSettings - runSettings settings app --- This is the API. The "/convert" endpoint takes a request body + prg <- getProgName + case prg of + "texmath-server.cgi" -> CGI.run (timeout 2 app) + _ -> do + let options = info (optsSpec <**> helper) + ( fullDesc + <> progDesc "Run a server for texmath" + <> header "texmath-server - an HTTP server for texmath" ) + opts <- execParser options + putStrLn $ "Starting server on port " <> show (port opts) + withStdoutLogger $ \logger -> do + let settings = Warp.setPort (port opts) $ Warp.setLogger logger Warp.defaultSettings + Warp.runSettings settings app + +-- This is the API. The root endpoint takes a request body -- consisting of a JSON-encoded Params structure and responds to -- Get requests with either plain text or JSON, depending on the --- Accept header. +-- Accept header. Alternatively, the "/batch" endpoint may be +-- used, accepting a JSON-encoded array of Params and returning +-- an array of results. type API = - "convert" :> ReqBody '[JSON] Params :> Post '[PlainText, JSON] Text + ReqBody '[JSON] Params :> Post '[PlainText, JSON] Text :<|> - "convert" :> QueryParam "text" Text :> QueryParam "from" Format :> QueryParam "to" Format :> QueryFlag "display" :> Get '[PlainText] Text + QueryParam "text" Text :> QueryParam "from" Format :> QueryParam "to" Format :> QueryFlag "display" :> Get '[PlainText] Text :<|> - "convert-batch" :> ReqBody '[JSON] [Params] :> Post '[JSON] [Text] + "batch" :> ReqBody '[JSON] [Params] :> Post '[JSON] [Text] app :: Application app = serve api server @@ -133,4 +143,3 @@ handleErr (Right t) = return t handleErr (Left err) = throwError $ err500 { errBody = TLE.encodeUtf8 $ TL.fromStrict err } - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texmath-0.12.9/server/texmath.html new/texmath-0.12.10/server/texmath.html --- old/texmath-0.12.9/server/texmath.html 2001-09-09 03:46:40.000000000 +0200 +++ new/texmath-0.12.10/server/texmath.html 2001-09-09 03:46:40.000000000 +0200 @@ -10,7 +10,7 @@ <script> var postConvert = function(body, onSuccess, onError) { var xhr = new XMLHttpRequest(); - xhr.open('POST', '/texmath/convert', true); + xhr.open('POST', 'https://texmath.johnmacfarlane.net/', true); xhr.setRequestHeader('Accept', 'application/json'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onreadystatechange = function () { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texmath-0.12.9/src/Text/TeXMath/Readers/TeX.hs new/texmath-0.12.10/src/Text/TeXMath/Readers/TeX.hs --- old/texmath-0.12.9/src/Text/TeXMath/Readers/TeX.hs 2001-09-09 03:46:40.000000000 +0200 +++ new/texmath-0.12.10/src/Text/TeXMath/Readers/TeX.hs 2001-09-09 03:46:40.000000000 +0200 @@ -31,6 +31,7 @@ import qualified Data.Map as M import qualified Data.Text as T import Data.Text (Text) +import Data.Ratio ((%)) import Data.Maybe (catMaybes, fromJust, mapMaybe) import Text.Parsec hiding (label) import Text.Parsec.Error @@ -358,7 +359,7 @@ many1Exp = manyExp' True inbraces :: TP Exp -inbraces = braces (manyExp expr) +inbraces = braces (ignorable *> manyExp expr) texToken :: TP Exp texToken = texSymbol <|> inbraces <|> texChar @@ -718,17 +719,28 @@ _ -> mzero xspace "\\hspace" = do braces $ do - len <- many1 digit - scaleFactor <- + neg <- option 1 $ (-1) <$ char '-' + as <- option "" $ many1 digit + bs <- option "" $ char '.' *> many1 digit + let denominator = 10^(length bs) + as' <- if null as then pure 0 else stringToInteger as + bs' <- if null bs then pure 0 else stringToInteger bs + let numerator = (as' * denominator) + bs' + let n = neg * (numerator % denominator) + scaleFactor <- lexeme $ 1 <$ (string "em") <|> (1/12) <$ (string "pt") <|> 6 <$ (string "in") <|> (50/21) <$ (string "cm") - case reads len of - ((n :: Integer,[]):_) -> return $ ESpace (fromIntegral n * scaleFactor) - _ -> mzero + return $ ESpace (n * scaleFactor) xspace _ = mzero +stringToInteger :: String -> TP Integer +stringToInteger s = + case reads s of + ((n :: Integer, []):_) -> pure n + _ -> fail $ "Could not read " <> s <> " as Integer." + mathop :: Text -> TP Exp mathop c = case c of @@ -993,6 +1005,7 @@ , ("\\v", option "v" $ try $ hacek <$> tok) , ("\\u", option "u" $ try $ breve <$> tok) , ("\\ ", return " ") + , ("\\quad", return "\x2000") ] parseC :: TP Text diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texmath-0.12.9/test/regression/258.test new/texmath-0.12.10/test/regression/258.test --- old/texmath-0.12.9/test/regression/258.test 1970-01-01 01:00:00.000000000 +0100 +++ new/texmath-0.12.10/test/regression/258.test 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,13 @@ +<<< tex +e^{ + % below is the complex part: + \sum_i^n i^2 } +>>> native +[ ESuper + (EIdentifier "e") + (EGrouped + [ EUnderover + True (ESymbol Op "\8721") (EIdentifier "i") (EIdentifier "n") + , ESuper (EIdentifier "i") (ENumber "2") + ]) +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texmath-0.12.9/test/regression/259.test new/texmath-0.12.10/test/regression/259.test --- old/texmath-0.12.9/test/regression/259.test 1970-01-01 01:00:00.000000000 +0100 +++ new/texmath-0.12.10/test/regression/259.test 2001-09-09 03:46:40.000000000 +0200 @@ -0,0 +1,4 @@ +<<< tex +\hspace{-1.2em} +>>> native +[ ESpace ((-6) % 5) ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/texmath-0.12.9/texmath.cabal new/texmath-0.12.10/texmath.cabal --- old/texmath-0.12.9/texmath.cabal 2001-09-09 03:46:40.000000000 +0200 +++ new/texmath-0.12.10/texmath.cabal 2001-09-09 03:46:40.000000000 +0200 @@ -1,5 +1,5 @@ Name: texmath -Version: 0.12.9 +Version: 0.12.10 Cabal-Version: >= 1.10 Build-type: Simple Synopsis: Conversion between math formats. @@ -155,6 +155,7 @@ , servant-server , wai , wai-logger + , wai-extra , warp , optparse-applicative , safe