Open sorawee opened 2 years ago
How about (or/c string? (listof (or/c string? <something that indicates a link>)))
?
How does this fit with the index
function?
I didn't modify that at all, so they are completely unaffected.
An index-element
consists of tag
, plain-seq
, entry-seq
, and desc
. This PR does not modify this structure, but it creates a new kind of desc
to replace form-index-desc
, procedure-index-desc
, and thing-index-desc
. Other desc
s like tech
(produced by deftech
), (part-index-desc)
(produced by section
), and #f
(probably produced by index
) are left untouched.
How about (define kind/c (listof (or/c string? (list/c 'code string?))))
?
I don't want to or/c
with string?
at the outermost level. It's already too complicated.
Oh, another possibility is to create exported-index-desc*
and replace all existing form-index-desc
, procedure-index-desc
, and thing-index-desc
with exported-index-desc*
. That way, we only need to create one more struct, not three.
I think if we're now using the desc
in more ways, we want to provide control over it from functions like index
.
Are you thinking about making the below search result show more information?
I agree that could be helpful, but my opinion is that it is out of scope for this PR. This current PR is already large. I'd deal with index
/ deftech
/ section
/ etc. separately.
By the way, I switched to exported-index-desc*
as I mentioned above. I think it's an improvement, but it also lost some useful information (though this information is currently not utilized anyway). Let me know if you have a better idea.
It is already the case that kind
can be any content?
according to the doc of defproc
, so restricting it to string?
or (listof (or/c string? (list/c 'code string?)))
doesn't seem to be a good idea.
I'm thinking that I'd like the new index entries I added for match (eg app) to mention match in the search results.
Perhaps we want to keep track of three information:
kind
: this is a content?
that will appear directly in the box.kind-detail
: this is a content?
that will appear as a search entry. The intention is that it is as detailed as kind
, if not more.kind-id
: probably a string, though a symbol could work as well. The intention is that this will be used programmatically for recognization.For example, a method would have kind
being "method"
, kind-detail
being "method of dc%"
, and kind-id
being "method"
(or something similar to this).
By default, kind-detail
is kind
, and kind-id
is (content->string kind)
.
This pull request has been mentioned on Racket Discussions. There might be relevant details there:
https://racket.discourse.group/t/rfc-hash-table-pattern-matching/1686/59
This PR creates a new index description
exported-index-desc*
that contain the kind information. This allows e.g. the search page to display or refine the query based on the information.To maintain backward compatibility, the kind information is not added to any existing structs. Instead, a new index type is created.
The contract for the kind field is
(listof string? (list/c 'code string?))
. This rich encoding allows typesetting search results like https://docs.racket-lang.org/search/index.html?q=get-adminAlso bump the version, to be used for
#:version
in otherinfo.rkt
Original PR description is preserved here: