[darcs-users] darcs patch: Make am_html less stupid. (and 2 more)
Eric Kow
kowey at darcs.net
Sun May 10 01:40:41 UTC 2009
On Sat, May 09, 2009 at 20:28:08 +1000, Trent W.Buck wrote:
> I cleaned up src/preproc.hs a little, because it makes it easier to
> extend (in a larger bundle I'm still working on). Even if that larger
> bundle stalls or is rejected, I think these could/should be applied.
>
> Sat May 9 18:36:59 EST 2009 Trent W. Buck <trentbuck at gmail.com>
> * Make am_html less stupid.
>
> Sat May 9 19:22:42 EST 2009 Trent W. Buck <trentbuck at gmail.com>
> * Remove obsolete \example{} support from preproc.
>
> Sat May 9 20:25:11 EST 2009 Trent W. Buck <trentbuck at gmail.com>
> * Refactor preproc to remove cascade.
Applied, thanks!
I've only skimmed the last patch, so I'm just being trusting and
applying it on the basis of its description.
Refactor preproc to remove cascade.
-----------------------------------
> Trent W. Buck <trentbuck at gmail.com>**20090509102511
> Ignore-this: 6f8f196c41bfeb21b600090e8ed8eede
> ] hunk ./src/preproc.hs 59
> -- document in LaTeX. The pseudo-LaTeX lines are replaced, other
> -- lines are used unmodified.
> preproc :: [String] -> IO [String]
> +preproc [] = return [] -- Empty input, empty output.
> preproc ("\\usepackage{html}":ss) = -- only use html package with latex2html
> do rest <- preproc ss
> ah <- am_html
> hunk ./src/preproc.hs 81
> ah <- am_html
> if ah then return $ "</div>" : "\\end{rawhtml}" : rest
> else return $ "\\end{Verbatim}" : rest
> +preproc ("\\darcsVersion":ss) = do
> + rest <- preproc ss
> + return $ darcs_version:rest
> preproc (s:ss) = do
> rest <- preproc ss
> hunk ./src/preproc.hs 86
> - case matchRegex (mkRegex "^\\\\input\\{(.+)\\}$") s of
> - Just (fn:_) -> do cs <- readFile $ "src" </> fn -- ratify readFile: not part of
> - -- darcs executable
> - this <- preproc $ lines cs
> - return $ this ++ rest
> - _ -> if isJust $ matchRegex (mkRegex "\\\\darcsVersion") s
> - then return $ darcs_version:rest
> - else
> - case matchRegex (mkRegex "^\\\\darcsCommand\\{(.+)\\}$") s of
> - Just (cn:_) ->
> - return $ (gh cn++get_options cn++gd cn):rest
> - _ -> return $ s : rest
> -
> -preproc [] = return []
> + let rx = mkRegex "^\\\\(input|darcsCommand)\\{(.+)\\}$"
> + case matchRegex rx s of
> + Just ["input", path] ->
> + do cs <- readFile $ "src" </> path -- ratify readFile: not part of darcs executable
> + this <- preproc $ lines cs
> + return $ this ++ rest
> + Just ["darcsCommand", command] ->
> + return $ (gh command++get_options command++gd command):rest
> + -- The base case for the whole preproc function. Nothing to
> + -- mangle, so this is an ordinary line of TeX, and we append it to
> + -- the result unmodified.
> + _ -> return $ s : rest
>
> get_options :: String -> String
> get_options comm = get_com_options $ get_c names the_commands
>
--
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20090509/0dd483c0/attachment.pgp>
More information about the darcs-users
mailing list