Re: [racket-dev] Scribble: feature request - module paths for image

2013-02-15 Thread Sam Tobin-Hochstadt
On Fri, Feb 15, 2013 at 3:36 PM, David Van Horn  wrote:
> On 2/15/13 3:34 PM, Matthew Flatt wrote:
>>
>> #lang scribble/base
>>
>>   @(define (fig name)
>>  (collection-file-path name "book" "figures"))
>>
>>   @image[#:suffixes '(".png" ".pdf") (fig "quick-lists1")]
>
>
> Excellent!  Thank you, this works (I figured I was making things worse than
> they had to be, but man is it intimidating when you start reading about
> paths in the docs).

If this works, then the docs need some clarification. I'm not exactly
sure what, or I'd do it, but the docs for `image` say: "The path
argument also can be a result of path->main-collects-relative."

Sam
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Scribble: feature request - module paths for image

2013-02-15 Thread David Van Horn

On 2/15/13 3:34 PM, Matthew Flatt wrote:

#lang scribble/base

  @(define (fig name)
 (collection-file-path name "book" "figures"))

  @image[#:suffixes '(".png" ".pdf") (fig "quick-lists1")]


Excellent!  Thank you, this works (I figured I was making things worse 
than they had to be, but man is it intimidating when you start reading 
about paths in the docs).


David

_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] Scribble: feature request - module paths for image

2013-02-15 Thread Matthew Flatt
Does `collection-file-path' work?

Here's a small example:

 #lang scribble/base

 @image[(collection-file-path "heart.png" "icons")]


I think this is closer to your example (but untested):

 #lang scribble/base

 @(define (fig name)
(collection-file-path name "book" "figures"))

 @image[#:suffixes '(".png" ".pdf") (fig "quick-lists1")]


At Fri, 15 Feb 2013 15:19:29 -0500, David Van Horn wrote:
> On 2/15/13 10:47 AM, Jay McCarthy wrote:
> > Does define-runtime-path work?
> 
> Yes, for some value of "yes".
> 
> This works (specific to my context, but easy to generalize):
> 
> #lang scribble/base
> @(require racket/runtime-path)
> @(require (for-syntax racket/base))
> 
> @(define-runtime-module-path-index id 'book)
> @(define (fig name)
>(path->string
> (resolved-module-path-name
>  (module-path-index-resolve
>   (module-path-index-join (format "figures/~a" name) id)
> 
> @image[#:suffixes '(".png" ".pdf")]{@fig{quick-lists1}}
> 
> 
> So for now my problem is solved, but
> 
> a) am I making this more complicated than needed?
> b) if not, should it really be this complicated?
> 
> Thanks,
> David

_
  Racket Developers list:
  http://lists.racket-lang.org/dev


Re: [racket-dev] Scribble: feature request - module paths for image

2013-02-15 Thread David Van Horn

On 2/15/13 10:47 AM, Jay McCarthy wrote:

Does define-runtime-path work?


Yes, for some value of "yes".

This works (specific to my context, but easy to generalize):

#lang scribble/base
@(require racket/runtime-path)
@(require (for-syntax racket/base))

@(define-runtime-module-path-index id 'book)
@(define (fig name)
  (path->string
   (resolved-module-path-name
(module-path-index-resolve
 (module-path-index-join (format "figures/~a" name) id)

@image[#:suffixes '(".png" ".pdf")]{@fig{quick-lists1}}


So for now my problem is solved, but

a) am I making this more complicated than needed?
b) if not, should it really be this complicated?

Thanks,
David


_
 Racket Developers list:
 http://lists.racket-lang.org/dev


Re: [racket-dev] Scribble: feature request - module paths for image

2013-02-15 Thread Jay McCarthy
Does define-runtime-path work? Should it?

On Fri, Feb 15, 2013 at 8:42 AM, David Van Horn  wrote:
> I have a scribble document that is built from two distinct locations, which
> makes using the Scribble image form nearly impossible since it takes a path
> relative to the build location.  (My work around is symbolic links in the
> file system.)
>
> What would solve my problem is the ability to pass a module-path prefix,
> e.g. (image 'foo/bar/baz "some-image.png").
>
> Does this seem like a sensible thing to add?
>
> (BTW, the collects option doesn't help me because I need to reference module
> locations that are not in the main collection.)
>
> David
> _
>  Racket Developers list:
>  http://lists.racket-lang.org/dev



--
Jay McCarthy 
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] Scribble: feature request - module paths for image

2013-02-15 Thread David Van Horn
I have a scribble document that is built from two distinct locations, 
which makes using the Scribble image form nearly impossible since it 
takes a path relative to the build location.  (My work around is 
symbolic links in the file system.)


What would solve my problem is the ability to pass a module-path prefix, 
e.g. (image 'foo/bar/baz "some-image.png").


Does this seem like a sensible thing to add?

(BTW, the collects option doesn't help me because I need to reference 
module locations that are not in the main collection.)


David
_
 Racket Developers list:
 http://lists.racket-lang.org/dev