Re: [racket-users] scribble newbie, myfunctionname undefined

2017-10-01 Thread Geoffrey Knauth
Here's a workflow that is working well for me, now that things have settled.

In a Racket window, I have my package foo's scribble source file open:  
/Users/username/github/foo/scribblings/foo.scrbl

I have the Package Manager open, and I keep it open, with the checkbox 
checked "Updates can replace existing installations," and with Package 
Source set to:  ~/github/foo/

I make a little change to my .scrbl file, Cmd-S to save, Cmd-R to run, 
basically to make sure Racket is happy with the syntax.  If all goes well, 
I press the Update button in the Package Manager, and it rebuilds just the 
code & docs particular to my package.

In my browser window, I keep 
open:  file:///Users/username/github/foo/doc/foo/index.html

I hit refresh in the browser window and see that my documentation change 
looks the way I want it to.


-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] scribble newbie, myfunctionname undefined

2017-09-29 Thread Geoffrey Knauth
Jack, following your advice, I did need one additional change.

Previously I had:

  @(define my-eval (make-base-eval))
  @example-eval[#:eval my-eval (require foo)]

Using scribble/example instead of scribble/eval, this additional change 
made things work:

  @(define my-eval (make-base-eval `(require foo)))

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] scribble newbie, myfunctionname undefined

2017-09-29 Thread Geoffrey Knauth
Jack, thanks, what you write makes a whole lot more sense and fits with 
what I remember of scribble from the last time I scribbled, which was years 
ago.  I am delighted to find that scribble has many more interesting 
features these days.  My answers below:

On Friday, September 29, 2017 at 6:56:13 PM UTC-4, Jack Firth wrote:
>
> - The `scribble/example` library is meant to replace the legacy 
> `scribble/eval` library, as the `examples` form provided by 
> `scribble/example` will make documentation building fail if example code 
> throws an unexpected error.
>

Thanks, I'm doing that now.
 

> - Did you add a `scribblings` field to your package's `info.rkt` module? 
> If so just running `raco setup` from anywhere will render your docs; no 
> need to `cd` into the right directory and fiddle with the scribble CLI. 
> Unless you're doing that on purpose, in which case I'm curious why.
>

I didn't, but it's there, because `raco pkg new` did that for me.  As for 
`raco setup`, it does do a lot, but I just noticed it didn't regenerate my 
docs when I changed my scribblings/foo.scrbl file.  I'm currently trying to 
figure out how to do just that with resorting to my old contortions.  As 
for why I was doing things the contorted way I was, there was/is one 
benefit, quick turnaround when I make a small change to the foo.scrbl file 
and want to see the result immediately.
 

> - It's simpler for package scribblings to import the package 
> implementation module via its name instead of a relative path, e.g. 
> `(require foo)` instead of `(require "../main.rkt")`. This means you don't 
> have to worry about breaking relative paths when moving your documentation 
> files around, and in particular it makes it easier to extract documentation 
> into a separate `foo-doc` package if you find you want to do that.
>

I'm doing that now, I figured that out last night, and it does seem much 
more sane.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] scribble newbie, myfunctionname undefined

2017-09-29 Thread Jack Firth
A few other notes / tips:

- The `scribble/example` library is meant to replace the legacy 
`scribble/eval` library, as the `examples` form provided by 
`scribble/example` will make documentation building fail if example code 
throws an unexpected error.
- Did you add a `scribblings` field to your package's `info.rkt` module? If 
so just running `raco setup` from anywhere will render your docs; no need 
to `cd` into the right directory and fiddle with the scribble CLI. Unless 
you're doing that on purpose, in which case I'm curious why.
- It's simpler for package scribblings to import the package implementation 
module via its name instead of a relative path, e.g. `(require foo)` 
instead of `(require "../main.rkt")`. This means you don't have to worry 
about breaking relative paths when moving your documentation files around, 
and in particular it makes it easier to extract documentation into a 
separate `foo-doc` package if you find you want to do that.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] scribble newbie, myfunctionname undefined

2017-09-29 Thread Geoffrey Knauth
On Thursday, September 28, 2017 at 3:04:46 PM UTC-4, Ben Greenman wrote:
>
> Try adding `#:eval foo-eval` to `interaction`. (I'm guessing that would 
> work.)
>

To close the loop, Ben, yes this also did work.  Thanks! 

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] scribble newbie, myfunctionname undefined

2017-09-28 Thread Ben Greenman
Try adding `#:eval foo-eval` to `interaction`. (I'm guessing that would
work.)


I'm more sure this will work:

  #lang scribble/manual
  @(require scribble/example "../main.rkt")
  ...
  @(define foo-eval (make-base-eval '(require "../main.rkt")))
  @examples[#:eval foo-eval #:label #f
  (magic)
  ]

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] scribble newbie, myfunctionname undefined

2017-09-28 Thread Geoffrey Knauth
I hope this is an easy question for someone.  I started a new foo package:

  raco pkg new foo

I put my functions in foo/main.rkt.  I saw a foo/scribblings/ dir, so I 
created a file foo/scribblings/foo.scribl.  I've got a nice little doc file 
in there, which I can preview using:

  cd scribblings
  scribble --html ++xref-in setup/ref load-collections-xref foo.scrbl

I thought I'd be nice and add examples, e.g., (magic) -> 42
Let's just pretend main.rkt has a magic function that produces 42.

My foo/scribblings/foo.scrbl file contains:

  #lang scribble/manual
  @(require scribble/eval "../main.rkt")
  ...
  @(define foo-eval (make-base-eval))
  @interaction-eval[#:eval foo-eval (require "../main.rkt")]
  @interaction[
  (magic)
  ]

I was hoping to see, in the documentation produced, that (magic) produces 
42, but instead I got, in red:

  |  > (magic)
  |  magic: undefined;
  |   cannot reference undefined identifier

I did provide magic in main.rkt, so I'm wondering what I did wrong.

Geoff

-- 
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.
For more options, visit https://groups.google.com/d/optout.