Skip to content

Commit

Permalink
Merge pull request #3341 from pzinn/main
Browse files Browse the repository at this point in the history
Format better "about" output
  • Loading branch information
DanGrayson authored Jul 3, 2024
2 parents 0b4b16d + f1079ef commit 2595a73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions M2/Macaulay2/m2/document.m2
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ makeDocumentTag String := opts -> key -> (
then error ("mismatching packages ", pkg, " and ", toString opts#Package, " specified for key ", key);
if pkg === null then pkg = opts#Package;
(makeDocumentTag' new OptionTable from {Package => pkg}) key)
makeDocumentTag TOH := opts -> first

-- before creating links, we recreate the document tag as a hack to
-- correct its package, if it is incorrect (e.g. truncate, quotient)
Expand Down
9 changes: 6 additions & 3 deletions M2/Macaulay2/m2/help.m2
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ about Symbol :=
about Function := o -> f -> about("\\b" | toString f | "\\b", o)
about String := o -> re -> lastabout = (
packagesSeen := new MutableHashTable;
NumberedVerticalList sort join(
NumberedVerticalList apply(sort join(
flatten for pkg in loadedPackages list (
pkgname := pkg#"pkgname";
if packagesSeen#?pkgname then continue else packagesSeen#pkgname = 1;
Expand All @@ -574,7 +574,7 @@ about String := o -> re -> lastabout = (
matchfun_re if o.Body then pkg#rawKeyDB),
select(keys pkg#"raw documentation",
matchfun_re if o.Body then pkg#"raw documentation"));
apply(keyList, key -> pkgname | "::" | key)),
apply(keyList, key -> (pkgname,key))),
flatten for pkg in getPackageInfoList() list (
pkgname := pkg#"name";
if packagesSeen#?pkgname then continue else packagesSeen#pkgname = 1;
Expand All @@ -583,7 +583,10 @@ about String := o -> re -> lastabout = (
db := if o.Body then openDatabase dbname;
keyList := select(dbkeys, matchfun_re db);
if o.Body then close db;
apply(keyList, key -> pkgname | "::" | key))))
apply(keyList, key -> (pkgname,key)))
),(pkgname,key) -> SPAN { pkgname, " ", TOH {pkgname | "::" | key} }
)
)

-- TODO: should this go to system?
pager = x -> if height stdio > 0
Expand Down

0 comments on commit 2595a73

Please sign in to comment.