Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix documentation of shared symbols #2263

Merged
merged 1 commit into from
Nov 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions M2/Macaulay2/m2/document.m2
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ makeDocumentTag String := opts -> key -> (
-- correct its package, if it is incorrect (e.g. truncate, quotient)
-- TODO: can this be modified to fix the tag in-place? then we would only need to
-- fix the tag in (validate, TO), rather than also in (info, TO) and (html, TO).
fixup DocumentTag := DocumentTag => tag -> makeDocumentTag(
if instance(key := tag.Key, String) then return tag else key, Package => package key)
fixup DocumentTag := DocumentTag => tag -> (
if (rawdoc := fetchAnyRawDocumentation tag) =!= null then rawdoc.DocumentTag else tag)

-----------------------------------------------------------------------------
-- formatting document tags
Expand Down
37 changes: 9 additions & 28 deletions M2/Macaulay2/m2/help.m2
Original file line number Diff line number Diff line change
Expand Up @@ -387,37 +387,18 @@ getBody := (key, tag, rawdoc) -> (

-- TODO: help symbol% before Macaulay2Doc is installed doesn't work
help = method(Dispatch => Thing)
-- overview nodes and formatted documentation keys
help String := key -> (
rawdoc := fetchAnyRawDocumentation makeDocumentTag key;
tag := getOption(rawdoc, symbol DocumentTag);
if tag.?Key and tag.Key =!= key then help tag.Key
else if isGlobalSymbol key then help getGlobalSymbol key
else getBody(key, tag, rawdoc))
help DocumentTag := tag -> (
rawdoc := fetchAnyRawDocumentation tag;
tag = if rawdoc =!= null then rawdoc.DocumentTag else tag;
getBody(tag.Key, tag, rawdoc))

-- Methods
help Sequence := key -> (
if key === () then return if inDebugger then debuggerUsageMessage else help "initial help";
-- TODO: make this work with hook strategies; e.g. (foo, ZZ, Strategy => Default)
if lookup key === null then error("expected ", toString key, " to be a method");
rawdoc := fetchAnyRawDocumentation makeDocumentTag key;
tag := getOption(rawdoc, symbol DocumentTag);
getBody(key, tag, rawdoc))

-- Options
help Array := key -> (
verifyKey key;
rawdoc := fetchAnyRawDocumentation makeDocumentTag key;
tag := getOption(rawdoc, symbol DocumentTag);
getBody(key, tag, rawdoc))

-- everything else: Symbols, Types, ScriptedFunctors, Functions, Keywords, and Packages
help Symbol := key -> (
rawdoc := fetchAnyRawDocumentation makeDocumentTag key;
tag := getOption(rawdoc, symbol DocumentTag);
getBody(key, tag, rawdoc))
if key =!= () then help makeDocumentTag key else
if inDebugger then debuggerUsageMessage else help "initial help")

help DocumentTag := tag -> help tag.Key
help String :=
help Symbol :=
help Array :=
help Thing := x -> help makeDocumentTag x
help List := l -> DIV between(HR{}, help \ l)
help ZZ := i -> seeAbout(help, i)
Expand Down