Re: [racket-users] Can scribble/lp2 typeset comments within chunks?
I've adjusted `chunk` to strip away `code:comment`, etc., and so it now works with `scribble/comment-reader`. A better approach in the future might be to add a `chunk` variant that's based on `codeblock` instead of `racketblock`, but I didn't try that. At Fri, 18 Dec 2015 12:20:13 -0800, Matthew Butterick wrote: > First try: seemingly not, because this file does not render to HTML with > comments: > > ;;; > #lang scribble/lp2 > > @chunk[<*> >(define (f x) ; not g > ;; amazing computation > (* x x))] > ;;; > > In HTML it becomes this: > > <*> ::= > (define (f x) > > (* x x)) > > > Second try: Docs suggest use of CHUNK + UNSYNTAX [1] but this next try fails > with "UNSYNTAX: unbound identifier" > > ;;; > #lang scribble/lp2 > > @CHUNK[<*> >(define (f x) ; not g > @UNSYNTAX{;; amazing computation} > (* x x))] > ;;; > > > Third try: also tried scribble/comment-reader [2] but this doesn't work > (apparently because `racketblock` knows about `code:comment` but `chunk` does > not: > > ;;; > #lang scribble/lp2 > > @#reader scribble/comment-reader > (chunk <*> > (define (f x) ; not g > ;; amazing computation > (* x x))) > ;;; > > [1] > http://docs.racket-lang.org/scribble/lp.html?q=CHUNK#%28form._%28%28lib._scribb > le%2Flp..rkt%29._.C.H.U.N.K%29%29 > > [2] > http://docs.racket-lang.org/scribble/scribble_manual_code.html?q=comment-reader > #%28mod-path._scribble%2Fcomment-reader%29 > > > -- > 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. -- 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] Can scribble/lp2 typeset comments within chunks?
They aren't actually converted to whitespace, instead, the layout algorithm looks at the source location information and renders things where they were in the original file, the presence of the comments basically makes a jump in the line numbers. I do think it would be nice to just convert them to comments, but I wanted to point out that currently the body of the chunk is basically `read`. Jay On Tue, Dec 22, 2015 at 9:00 PM, Matthew Butterickwrote: > I'm a scribble/lp2 noob for sure, but why not eliminate the need for > `code:comment` within a `chunk`? > > Because I find this curious: when the `chunk` is typeset in documentation > mode, scribble/lp2 is apparently parsing the comments, because they get > converted to whitespace. So ... instead of converting them to whitespace, why > not just typeset them literally? > > Noob question complete > > > On Dec 22, 2015, at 2:45 PM, Asumu Takikawa wrote: > >> On 2015-12-18 12:20:13 -0800, Matthew Butterick wrote: >>> Third try: also tried scribble/comment-reader [2] but this doesn't work >>> (apparently because `racketblock` knows about `code:comment` but `chunk` >>> does >>> not: >> >> I think things like `code:comment` are intended to work, but don't because >> they're >> not bound to anything within chunk blocks. For example, this works: >> >> #lang scribble/lp2 >> >> @chunk[prologue >> (define code:comment 3)] >> >> @CHUNK[<*> >> prologue >> (define (f x) ; not g >> (code:comment "foo") >> (* x x))] >> >> But this typesets the silly definition of `code:comment` too. Maybe the >> scribble/lp2 language should bind these forms in chunk blocks. (UNSYNTAX >> doesn't work for the same reason) >> >> Cheers, >> Asumu > > -- > 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. -- Jay McCarthy Associate Professor PLT @ CS @ UMass Lowell http://jeapostrophe.github.io "Wherefore, be not weary in well-doing, for ye are laying the foundation of a great work. And out of small things proceedeth that which is great." - D 64:33 -- 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] Can scribble/lp2 typeset comments within chunks?
On 2015-12-18 12:20:13 -0800, Matthew Butterick wrote: > Third try: also tried scribble/comment-reader [2] but this doesn't work > (apparently because `racketblock` knows about `code:comment` but `chunk` does > not: I think things like `code:comment` are intended to work, but don't because they're not bound to anything within chunk blocks. For example, this works: #lang scribble/lp2 @chunk[prologue (define code:comment 3)] @CHUNK[<*> prologue (define (f x) ; not g (code:comment "foo") (* x x))] But this typesets the silly definition of `code:comment` too. Maybe the scribble/lp2 language should bind these forms in chunk blocks. (UNSYNTAX doesn't work for the same reason) Cheers, Asumu -- 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] Can scribble/lp2 typeset comments within chunks?
I'm a scribble/lp2 noob for sure, but why not eliminate the need for `code:comment` within a `chunk`? Because I find this curious: when the `chunk` is typeset in documentation mode, scribble/lp2 is apparently parsing the comments, because they get converted to whitespace. So ... instead of converting them to whitespace, why not just typeset them literally? Noob question complete On Dec 22, 2015, at 2:45 PM, Asumu Takikawawrote: > On 2015-12-18 12:20:13 -0800, Matthew Butterick wrote: >> Third try: also tried scribble/comment-reader [2] but this doesn't work >> (apparently because `racketblock` knows about `code:comment` but `chunk` does >> not: > > I think things like `code:comment` are intended to work, but don't because > they're > not bound to anything within chunk blocks. For example, this works: > > #lang scribble/lp2 > > @chunk[prologue > (define code:comment 3)] > > @CHUNK[<*> > prologue > (define (f x) ; not g > (code:comment "foo") > (* x x))] > > But this typesets the silly definition of `code:comment` too. Maybe the > scribble/lp2 language should bind these forms in chunk blocks. (UNSYNTAX > doesn't work for the same reason) > > Cheers, > Asumu -- 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] Can scribble/lp2 typeset comments within chunks?
First try: seemingly not, because this file does not render to HTML with comments: ;;; #lang scribble/lp2 @chunk[<*> (define (f x) ; not g ;; amazing computation (* x x))] ;;; In HTML it becomes this: <*> ::= (define (f x) (* x x)) Second try: Docs suggest use of CHUNK + UNSYNTAX [1] but this next try fails with "UNSYNTAX: unbound identifier" ;;; #lang scribble/lp2 @CHUNK[<*> (define (f x) ; not g @UNSYNTAX{;; amazing computation} (* x x))] ;;; Third try: also tried scribble/comment-reader [2] but this doesn't work (apparently because `racketblock` knows about `code:comment` but `chunk` does not: ;;; #lang scribble/lp2 @#reader scribble/comment-reader (chunk <*> (define (f x) ; not g ;; amazing computation (* x x))) ;;; [1] http://docs.racket-lang.org/scribble/lp.html?q=CHUNK#%28form._%28%28lib._scribble%2Flp..rkt%29._.C.H.U.N.K%29%29 [2] http://docs.racket-lang.org/scribble/scribble_manual_code.html?q=comment-reader#%28mod-path._scribble%2Fcomment-reader%29 -- 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.