[racket] Scribble HTML preview tool

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Jun 10 09:27:59 EDT 2014

On Jun 9, 2014, at 9:20 PM, Matthew Butterick <mb at mbtype.com> wrote:

>> 2. I had a minor problem with the pollen 'server'. I run scribble to document code with for-label imports. I get this right with roughly this script, a poor man's pollen: 
>> 
>>> scribble --html ++xref-in setup/xref load-collections-xref \
>>>          --dest Tmp/ \
>>>          $1.scrbl 
>>> open ~/0Unison/0Web/OnHtDP/Source/Tmp/$1.html
>> 
>> But with raco pollen I get cross references underlined in red. Is there a file (.pollenrc?) where I can specify scribble options? 
>> 
>> My quick read of the pollen docs didn't get me an answer. 
> 
> 
> Right, there's nothing in the docs about that, because so far, I'm not exposing any configuration options for the Scribble rendering. 
> 
> I could, however. Under the hood, I'm just using (dynamic-require 'scribble/render 'render) to create the output, which is where those command-line options ultimately end up. [1]
> 
> If you want to show me the .pollenrc you'd ideally be able to write, I can try adding this capability.
> 
> 
> 
> [1] http://docs.racket-lang.org/scribble/renderer.html?q=render#%28def._%28%28lib._scribble%2Frender..rkt%29._render%29%29


Here is the relevant fragment from my own script that I have used for years to render HtDP/2e. I think you want to figure out how to invoke render here and what to give it as options: 

;; String String Boolean String[URL] { [Class -> Class] } -> Void 
;; the render-mixin implements render<%> 
(define (scribble-it stem destination draft? redirect? (renderer render-mixin))
  (define stem.scrbl (string-append stem ".scrbl"))
  (define stem.html  (string-append stem ".html"))
  ((dynamic-require "shared.ss" 'is-draft?) draft?)
  (define stem.doc (dynamic-require stem.scrbl 'doc))
  (render (list stem.doc) (list stem)
          #:render-mixin renderer
	  #:dest-dir destination
	  #:xrefs (list (load-collections-xref))
          #:quiet? #false
	  #:redirect-main redirect?)
  ;; ---
  (parameterize ([current-directory destination])
    (cleanup)
    (send-url/file (if (file-exists? stem.html) stem.html (build-path stem "index.html")))))


Ultimately you want a specification language that matches your Pollen language design and whatever people specify should end up in this call. 

BTW, instead of a .pollenrc file you probably want to run the server with a command-line flag where it absorbs the call. 

Thanks -- Matthias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4463 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20140610/0e47fbd2/attachment.p7s>

Posted on the users mailing list.