On Wed, May 13, 2009 at 13:35:53 +1000, Trent W.Buck wrote: > UI issue: after saying "y" to the last question, darcs send printed > "skipped 1 patch" or something, but of course I didn't see it because > the next thing it does is open up the editor to add a comment.
Is something like this on the bugtracker? Does it need to be? > Sat May 9 20:49:17 EST 2009 Trent W. Buck <[email protected]> > * Module haddock for English. > > Sun May 10 00:42:21 EST 2009 Trent W. Buck <[email protected]> > * Teach src/English to generate a natural list from a Haskell list. > > Sun May 10 00:43:02 EST 2009 Trent W. Buck <[email protected]> > * Naturalize some lists used in docs. > > Wed May 13 11:30:15 EST 2009 Trent W. Buck <[email protected]> > * Teach preproc how to find the environment variable help. > Hooray, now I can actually start populating environmentHelp, and the > information will show up in the user manual, manpage *and* darcs help. All applied, thanks! Minor comments below. Module haddock for English. --------------------------- > Trent W. Buck <[email protected]>**20090509104917 > Ignore-this: 3f885d00551dd03a522fcc281ee5c659 > ] hunk ./src/English.hs 18 > -- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, > -- Boston, MA 02110-1301, USA. > > +-- | This modules provides rudimentary natural language generation > +-- (NLG) utilities. That is, generating natural language from a > +-- machine representation. Initially, only English is supported at > +-- all. Representations are implemented for: > +-- > +-- * countable nouns (plurality). > module English where > > import Data.List (isSuffixOf) Grumble :-) More on this later. Teach src/English to generate a natural list from a Haskell list. ----------------------------------------------------------------- > Trent W. Buck <[email protected]>**20090509144221 > Ignore-this: 68e7f2e584d5089f9bf3326d6af7e27f > ] hunk ./src/English.hs 23 > +-- | Given a list of things, combine them thusly: > +-- > +-- > orClauses ["foo", "bar", "baz"] == "foo, bar or baz" > +andClauses, orClauses :: [String] -> String > +andClauses = intersperseLast ", " " and " > +orClauses = intersperseLast ", " " or " Does this do what you expect in the haddock? And do you really mean clauses, here? > +-- | As 'intersperse', with a different separator for the last > +-- | interspersal. > +intersperseLast :: String -> String -> [String] -> String > +intersperseLast _ _ [] = "" > +intersperseLast _ _ [clause] = clause > +intersperseLast sep sepLast clauses = > + concat (intersperse sep $ init clauses) ++ sepLast ++ last clauses Naturalize some lists used in docs. ----------------------------------- * Module haddock for English. I don't think this was a necessary dependency for this patch * Teach src/English to generate a natural list from a Haskell list. > > hunk ./src/Darcs/Commands/Help.lhs 39 > import Darcs.Utils ( withCurrentDirectory, environmentHelpPager ) > import Data.Char ( isAlphaNum, toLower ) > import Data.List (groupBy) > +import English ( andClauses ) > import Printer ( text ) > import System.Exit ( ExitCode(..), exitWith ) > import ThisVersion ( darcs_version ) > hunk ./src/Darcs/Commands/Help.lhs 121 > helpOnEnvironment = > "Environment Variables\n" ++ > "=====================\n\n" ++ > - unlines [unwords ks ++ ":\n" ++ > + unlines [andClauses ks ++ ":\n" ++ > (unlines $ map (" " ++) ds) > | (ks, ds) <- environmentHelp] > > hunk ./src/Darcs/Commands/Help.lhs 253 > > environment :: [String] > environment = ".SH ENVIRONMENT" : concat > - [(".SS \"" ++ unwords ks ++ "\"") : ds > + [(".SS \"" ++ andClauses ks ++ "\"") : ds > | (ks, ds) <- environmentHelp] > > \end{code} > hunk ./src/Darcs/Commands/SetPref.lhs 35 > import Darcs.Patch ( changepref ) > import Darcs.Ordered ( FL(..) ) > import Darcs.Repository.Prefs ( get_prefval, change_prefval, ) > +import English ( orClauses ) > #include "impossible.h" > > -- | A list of all valid preferences for @_darcs/prefs/pr...@. > hunk ./src/Darcs/Commands/SetPref.lhs 50 > valid_prefs = map fst valid_pref_data > > setpref_description :: String > -setpref_description = "Set the value of a preference (" ++ ps ++ ")." > - where ps = iter valid_prefs > - iter [x] = x > - iter [x,y] = x ++ " or " ++ y > - iter (x:xs) = x ++ ", " ++ (iter xs) > - iter [] = "" -- impossible, but keeps -Wall happy > +setpref_description = > + "Set the value of a preference (" ++ orClauses valid_prefs ++ ")." > > setpref_help :: String > setpref_help = Teach preproc how to find the environment variable help. -------------------------------------------------------- > Trent W. Buck <[email protected]>**20090513013015 > Ignore-this: 14e495936cfb9740f04b6c6d11640fa7 > Hooray, now I can actually start populating environmentHelp, and the > information will show up in the user manual, manpage *and* darcs help. > ] hunk ./src/Darcs/Commands/Help.lhs 24 > \begin{code} > module Darcs.Commands.Help ( > help_cmd, > - command_control_list, > + command_control_list, environmentHelp, -- these are for preproc.hs > print_version, > list_available_commands ) where > > hunk ./src/Darcs/Commands/Help.lhs 38 > import Darcs.Repository.Prefs ( binaries_file_help, environmentHelpHome ) > import Darcs.Utils ( withCurrentDirectory, environmentHelpPager ) > import Data.Char ( isAlphaNum, toLower ) > -import Data.List (groupBy) > +import Data.List ( groupBy ) > import English ( andClauses ) > import Printer ( text ) > import System.Exit ( ExitCode(..), exitWith ) > hunk ./src/preproc.hs 27 > command_description), > extract_commands ) > import Darcs.Arguments ( options_latex ) > -import Darcs.Commands.Help ( command_control_list ) > +import Darcs.Commands.Help ( command_control_list, environmentHelp ) > +import English ( andClauses ) > import ThisVersion ( darcs_version ) > > the_commands :: [DarcsCommand] > hunk ./src/preproc.hs 86 > return $ darcs_version:rest > preproc (s:ss) = do > rest <- preproc ss > - let rx = mkRegex "^\\\\(input|darcsCommand)\\{(.+)\\}$" > + let rx = mkRegex "^\\\\(input|darcs(Command|Env))\\{(.+)\\}$" > case matchRegex rx s of > hunk ./src/preproc.hs 88 > - Just ["input", path] -> > + Just ["input", _, path] -> > do cs <- readFile $ "src" </> path -- ratify readFile: not part of > darcs executable > this <- preproc $ lines cs > return $ this ++ rest > hunk ./src/preproc.hs 92 > - Just ["darcsCommand", command] -> > + Just ["darcsCommand", _, command] -> > return $ (gh command++get_options command++gd command):rest > hunk ./src/preproc.hs 94 > + Just ["darcsEnv", _, variable] -> > + return $ envHelp variable : 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. > hunk ./src/preproc.hs 144 > gd :: String -> String > gd = command_property command_description the_commands > > +envHelp :: String -> String > +envHelp var = unlines $ render $ entry environmentHelp > + where render (ks, ds) = > + ("\\paragraph{" ++ escape_latex_specials (andClauses ks) ++ > "}") : > + ("\\label{env:" ++ var ++ "}") : > + map escape_latex_specials ds > + entry [] = undefined > + entry (x:xs) | elem var $ fst x = x > + | otherwise = entry xs > + > -- | LaTeX treats a number of characters or sequences specially. > -- Therefore when including ordinary help text in a LaTeX document, it > -- is necessary to escape these characters in the way LaTeX expects. > -- Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow> PGP Key ID: 08AC04F9
pgpstNMWUhqqz.pgp
Description: PGP signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
