Re: [racket-users] Creating links to Racket docs for functions in user-scope packages

2020-07-29 Thread 'Joel Dueck' via Racket Users
On Friday, July 24, 2020 at 11:15:54 AM UTC-5 Matthew Flatt wrote:

> A solution might use something like `path->pkg+subpath+collect+scope`, 
> where a 'user result for the scope triggers a different path 
> calculation.


For my application, I was able to use this info to make a function that 
*seems* reliable for user-scope packages (at least, the ones I have tested 
with so far):

https://github.com/otherjoel/cookbook-pollen/compare/f5a07f237c...92bbd9d616

I will attempt something more robust (along the lines of your suggestion) 
for the pull request though.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/57b618d3-8894-4081-87e2-bf36880d5fcbn%40googlegroups.com.


Re: [racket-users] Creating links to Racket docs for functions in user-scope packages

2020-07-24 Thread Matthew Flatt
Hi Joel,

At Tue, 21 Jul 2020 09:25:03 -0700 (PDT), "'Joel Dueck' via Racket Users" wrote:
> It looks like the problem might be in this function 
>  er.rkt#L440-L459> 
> where it always constructs a path that is relative to (find-doc-dir).
> 
> Would it make sense instead to have it check the dest against all the paths 
> returned by (get-doc-search-dirs) and just use the first one that matches? 
> If so maybe I’ll try doing a pull request to that effect.

I don't think that specific approach is going to work. Packages
installed in user scope render documentation within the collections'
directories, and those directories are not included in the result of
`(get-doc-search-dirs)`.

A solution might use something like `path->pkg+subpath+collect+scope`,
where a 'user result for the scope triggers a different path
calculation. For user-scope packages, ocumentation is rendered within
the collection in a "doc" subdirectory, instead of in a common "doc"
directory. Probably the content of the individual "doc" directories
mirrors the main "doc" directory, in which case the relative-path
calculation would be the same, but I may have forgotten a difference.

Matthew

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200724101549.c4%40sirmail.smtp.cs.utah.edu.


Re: [racket-users] Creating links to Racket docs for functions in user-scope packages

2020-07-21 Thread 'Joel Dueck' via Racket Users
It looks like the problem might be in this function 

 
where it always constructs a path that is relative to (find-doc-dir).

Would it make sense instead to have it check the dest against all the paths 
returned by (get-doc-search-dirs) and just use the first one that matches? 
If so maybe I’ll try doing a pull request to that effect.

Sorry I’m tiptoeing here, I haven’t contributed to Scribble before.

On Monday, July 13, 2020 at 11:02:17 AM UTC-5 Joel Dueck wrote:

>
> On Monday, July 13, 2020 at 8:37:52 AM UTC-5, Matthew Flatt wrote:
>>
>> It might end up being about the same implementation effort to improve the
>> error message or to make the function work on user-scope packages
>>
>
> That was my sense as well...I will try taking a look at this, maybe I can 
> contribute.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/f9e4366b-0db3-45b6-9a59-04292d3edcf1n%40googlegroups.com.


Re: [racket-users] Creating links to Racket docs for functions in user-scope packages

2020-07-13 Thread 'Joel Dueck' via Racket Users

On Monday, July 13, 2020 at 8:37:52 AM UTC-5, Matthew Flatt wrote:
>
> It might end up being about the same implementation effort to improve the
> error message or to make the function work on user-scope packages
>

That was my sense as well...I will try taking a look at this, maybe I can 
contribute.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/79eb227e-7fb8-40af-82ea-fee0d5bc2617o%40googlegroups.com.


Re: [racket-users] Creating links to Racket docs for functions in user-scope packages

2020-07-13 Thread Matthew Flatt
It's currently not intended to work for packages installed in user
scope --- only for packages in the main installation --- although
probably it shouldn't report a path error for a user-scope package.

I'm not sure how difficult it would be to make redirection work on a
user-scope package's documentation. The function doesn't "just work"
for user-scope, because the location where documentation is rendered is
different for user-scope packages and installation-scope packages. It
might end up being about the same implementation effort to improve the
error message or to make the function work on user-scope packages,
though.

At Sun, 12 Jul 2020 15:16:37 -0700 (PDT), "'Joel Dueck' via Racket Users" wrote:
> Trying to generate URLs for linking into the Racket docs. I get the error 
> below, but only when the package/identifier combo in question are installed 
> in user scope, and only when using the `#:external-root-url` keyword 
> argument:
> 
> > (define x (xref-binding->definition-tag (load-collections-xref) 
> '(deta/query lookup) 0))
> > x
> '(def ((lib "deta/query.rkt") lookup))
> 
> ;; works good:
> > (xref-tag->path+anchor (load-collections-xref) x)
> #
> "(def._((lib._deta/query..rkt)._lookup))"
> 
> > (xref-tag->path+anchor (load-collections-xref) x #:external-root-url 
> "http://docs.racket-lang.org/;)
> . . ../../../../../../Applications/Racket 
> v7.7/collects/racket/private/kw.rkt:1393:47: path-element->string: contract 
> violation
> expected: path?
> given: 'up
> 
> Is this a bug? Or is there a way to make this work for user-scope packages 
> as well?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20200713073746.2ce%40sirmail.smtp.cs.utah.edu.


[racket-users] Creating links to Racket docs for functions in user-scope packages

2020-07-12 Thread 'Joel Dueck' via Racket Users
Trying to generate URLs for linking into the Racket docs. I get the error 
below, but only when the package/identifier combo in question are installed 
in user scope, and only when using the `#:external-root-url` keyword 
argument:

> (define x (xref-binding->definition-tag (load-collections-xref) 
'(deta/query lookup) 0))
> x
'(def ((lib "deta/query.rkt") lookup))

;; works good:
> (xref-tag->path+anchor (load-collections-xref) x)
#
"(def._((lib._deta/query..rkt)._lookup))"

> (xref-tag->path+anchor (load-collections-xref) x #:external-root-url 
"http://docs.racket-lang.org/;)
. . ../../../../../../Applications/Racket 
v7.7/collects/racket/private/kw.rkt:1393:47: path-element->string: contract 
violation
expected: path?
given: 'up

Is this a bug? Or is there a way to make this work for user-scope packages 
as well?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/71d95883-84a8-4ad2-b4b5-e04c1e11c42co%40googlegroups.com.