Re: [racket-users] Using GraphViz inside of Scribble?

2021-01-28 Thread 'William J. Bowman' via Racket Users
I realized I forgot to include this stub:

> (define (run-dot str format)
>   (define cmd (string-append "dot -y -T" format))
>   (match (process cmd)
> [(list stdout stdin pid stderr ctl)
>  (write-string str stdin)
>  (newline stdin)
>  (close-output-port stdin)
>  (cond [(eq? (ctl 'status) 'done-error) (error (port->string stderr))]
>[else stdout])]))

On Wed, Jan 27, 2021 at 09:42:16PM -0800, 'William J. Bowman' via Racket Users 
wrote:
> I've been using graphviz inside Scribble for a bit.
> I found the package a bit inflexible and didn't produce output to my liking, 
> so
> I just rolled my own 'dot->svg' for HTML output:
> 
> > (require (only-in xml cdata)
> >  scribble/html-properties)
> > (define (dot->svg . rest)
> >   (elem #:style
> > (style #f
> >(list
> > (xexpr-property
> >  (cdata #f #f (apply string-append (drop (port->lines 
> > (run-dot (apply string-append rest) "svg")) 3)))
> >  (cdata #f #f ""))
> 
> Example:
> > @dot->svg{
> > digraph {
> > 
> > node [ shape="box" ]
> > 
> > /* The Languages */
> > 
> > L0 [label="x64"];
> > L1 [label="elf64"];
> > 
> > /* The Passes */
> > 
> > edge [fontname="Courier"]
> > 
> > L0 -> L1 [label="nasm"];
> > }
> > }
> 
> --
> William J. Bowman
> 
> On Wed, Jan 27, 2021 at 09:37:51PM -0800, Sorawee Porncharoenwase wrote:
> > Here’s how to add graphviz to Pollen
> > . The same technique
> > can be used for Scribble, but you would want to use image
> > 
> > as the tag function. You might also need to use define-runtime-path
> > 
> > .
> > 
> > On Wed, Jan 27, 2021 at 9:23 PM Tim Meehan  wrote:
> > 
> > > IMHO, Racket's documentation is the gold standard. I tell everyone I work
> > > with that we should document things this well.
> > > Until now, I haven't seen any room for potential improvements.
> > >
> > > Now, I like ASCII art as much as the next person, but when I was reading
> > > the documentation for the GUI class hierarchy, I remembered that there was
> > > a graphviz  package for
> > > Racket now.
> > > I'm no good with Scribble, but I bet that someone clever could add some
> > > automatic graphs to it without much trouble.
> > >
> > > I'm not much good at GraphViz either, but here is my take on the first two
> > > ASCII art diagrams. I just used "dot -Tpdf" to make the tests.
> > >
> > > --
> > > 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/CACgrOxKkeVxdMq9-94%2BX87oCmBKaY0XHg-Sq4yj-fPLy%2B6MYyg%40mail.gmail.com
> > > 
> > > .
> > >
> > 
> > -- 
> > 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/CADcuegstUJsYGjcm5C7_Hniw_%3DTvb69FyQa820JN4vP0kChD%2BA%40mail.gmail.com.
> 
> -- 
> 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/YBJOuMD2v2n29%2BpY%40williamjbowman.com.

-- 
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/YBNXArD5HRuk%2BSeL%40williamjbowman.com.


Re: [racket-users] Using GraphViz inside of Scribble?

2021-01-28 Thread Tim Meehan
Thanks for the ideas 

On Wed, Jan 27, 2021 at 11:42 PM William J. Bowman 
wrote:

> I've been using graphviz inside Scribble for a bit.
> I found the package a bit inflexible and didn't produce output to my
> liking, so
> I just rolled my own 'dot->svg' for HTML output:
>
> > (require (only-in xml cdata)
> >  scribble/html-properties)
> > (define (dot->svg . rest)
> >   (elem #:style
> > (style #f
> >(list
> > (xexpr-property
> >  (cdata #f #f (apply string-append (drop (port->lines
> (run-dot (apply string-append rest) "svg")) 3)))
> >  (cdata #f #f ""))
>
> Example:
> > @dot->svg{
> > digraph {
> >
> > node [ shape="box" ]
> >
> > /* The Languages */
> >
> > L0 [label="x64"];
> > L1 [label="elf64"];
> >
> > /* The Passes */
> >
> > edge [fontname="Courier"]
> >
> > L0 -> L1 [label="nasm"];
> > }
> > }
>
> --
> William J. Bowman
>
> On Wed, Jan 27, 2021 at 09:37:51PM -0800, Sorawee Porncharoenwase wrote:
> > Here’s how to add graphviz to Pollen
> > . The same
> technique
> > can be used for Scribble, but you would want to use image
> > <
> https://docs.racket-lang.org/scribble/base.html?q=image#%28def._%28%28lib._scribble%2Fbase..rkt%29._image%29%29
> >
> > as the tag function. You might also need to use define-runtime-path
> > <
> https://docs.racket-lang.org/reference/Filesystem.html?q=define-runtime-path#%28form._%28%28lib._racket%2Fruntime-path..rkt%29._define-runtime-path%29%29
> >
> > .
> >
> > On Wed, Jan 27, 2021 at 9:23 PM Tim Meehan  wrote:
> >
> > > IMHO, Racket's documentation is the gold standard. I tell everyone I
> work
> > > with that we should document things this well.
> > > Until now, I haven't seen any room for potential improvements.
> > >
> > > Now, I like ASCII art as much as the next person, but when I was
> reading
> > > the documentation for the GUI class hierarchy, I remembered that there
> was
> > > a graphviz  package for
> > > Racket now.
> > > I'm no good with Scribble, but I bet that someone clever could add some
> > > automatic graphs to it without much trouble.
> > >
> > > I'm not much good at GraphViz either, but here is my take on the first
> two
> > > ASCII art diagrams. I just used "dot -Tpdf" to make the tests.
> > >
> > > --
> > > 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/CACgrOxKkeVxdMq9-94%2BX87oCmBKaY0XHg-Sq4yj-fPLy%2B6MYyg%40mail.gmail.com
> > > <
> https://groups.google.com/d/msgid/racket-users/CACgrOxKkeVxdMq9-94%2BX87oCmBKaY0XHg-Sq4yj-fPLy%2B6MYyg%40mail.gmail.com?utm_medium=email_source=footer
> >
> > > .
> > >
> >
> > --
> > 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/CADcuegstUJsYGjcm5C7_Hniw_%3DTvb69FyQa820JN4vP0kChD%2BA%40mail.gmail.com
> .
>

-- 
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/CACgrOxLWf0-TsvwxmQEMaRSWZNG%2BmqndF%2BnaqLqxRtUrPuQqHA%40mail.gmail.com.


Re: [racket-users] Using GraphViz inside of Scribble?

2021-01-27 Thread 'William J. Bowman' via Racket Users
I've been using graphviz inside Scribble for a bit.
I found the package a bit inflexible and didn't produce output to my liking, so
I just rolled my own 'dot->svg' for HTML output:

> (require (only-in xml cdata)
>  scribble/html-properties)
> (define (dot->svg . rest)
>   (elem #:style
> (style #f
>(list
> (xexpr-property
>  (cdata #f #f (apply string-append (drop (port->lines 
> (run-dot (apply string-append rest) "svg")) 3)))
>  (cdata #f #f ""))

Example:
> @dot->svg{
> digraph {
> 
> node [ shape="box" ]
> 
> /* The Languages */
> 
> L0 [label="x64"];
> L1 [label="elf64"];
> 
> /* The Passes */
> 
> edge [fontname="Courier"]
> 
> L0 -> L1 [label="nasm"];
> }
> }

--
William J. Bowman

On Wed, Jan 27, 2021 at 09:37:51PM -0800, Sorawee Porncharoenwase wrote:
> Here’s how to add graphviz to Pollen
> . The same technique
> can be used for Scribble, but you would want to use image
> 
> as the tag function. You might also need to use define-runtime-path
> 
> .
> 
> On Wed, Jan 27, 2021 at 9:23 PM Tim Meehan  wrote:
> 
> > IMHO, Racket's documentation is the gold standard. I tell everyone I work
> > with that we should document things this well.
> > Until now, I haven't seen any room for potential improvements.
> >
> > Now, I like ASCII art as much as the next person, but when I was reading
> > the documentation for the GUI class hierarchy, I remembered that there was
> > a graphviz  package for
> > Racket now.
> > I'm no good with Scribble, but I bet that someone clever could add some
> > automatic graphs to it without much trouble.
> >
> > I'm not much good at GraphViz either, but here is my take on the first two
> > ASCII art diagrams. I just used "dot -Tpdf" to make the tests.
> >
> > --
> > 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/CACgrOxKkeVxdMq9-94%2BX87oCmBKaY0XHg-Sq4yj-fPLy%2B6MYyg%40mail.gmail.com
> > 
> > .
> >
> 
> -- 
> 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/CADcuegstUJsYGjcm5C7_Hniw_%3DTvb69FyQa820JN4vP0kChD%2BA%40mail.gmail.com.

-- 
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/YBJOuMD2v2n29%2BpY%40williamjbowman.com.


Re: [racket-users] Using GraphViz inside of Scribble?

2021-01-27 Thread Sorawee Porncharoenwase
Here’s how to add graphviz to Pollen
. The same technique
can be used for Scribble, but you would want to use image

as the tag function. You might also need to use define-runtime-path

.

On Wed, Jan 27, 2021 at 9:23 PM Tim Meehan  wrote:

> IMHO, Racket's documentation is the gold standard. I tell everyone I work
> with that we should document things this well.
> Until now, I haven't seen any room for potential improvements.
>
> Now, I like ASCII art as much as the next person, but when I was reading
> the documentation for the GUI class hierarchy, I remembered that there was
> a graphviz  package for
> Racket now.
> I'm no good with Scribble, but I bet that someone clever could add some
> automatic graphs to it without much trouble.
>
> I'm not much good at GraphViz either, but here is my take on the first two
> ASCII art diagrams. I just used "dot -Tpdf" to make the tests.
>
> --
> 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/CACgrOxKkeVxdMq9-94%2BX87oCmBKaY0XHg-Sq4yj-fPLy%2B6MYyg%40mail.gmail.com
> 
> .
>

-- 
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/CADcuegstUJsYGjcm5C7_Hniw_%3DTvb69FyQa820JN4vP0kChD%2BA%40mail.gmail.com.