[racket] Fwd: Scribble continuous previsualisation?
This would make a nice DrRacket plugin.
s.
.
--
Stephen De Gabrielle <http://www.degabrielle.name/stephen>
On Tue, Sep 10, 2013 at 9:48 PM, Ismael Figueroa <ifigueroap at gmail.com>wrote:
> Actually my script was wrong, here is an improved (and good enough for my
> purposes) version.
> The usage would be "scribble-pvc ["pdf|html|latex..."] Foo.scrbl
>
> #!/bin/bash
>
> PATTERN="${PWD}/$2"
>
> SCRIBBLE='echo "${watch_src_path} ${watch_event_type}"; scribble'
> FMT=" --$1"
>
> if [ "$1" == "html" ]
> then
> XREFS=' ++xref-in setup/xref load-collections-xref --redirect-main "
> http://docs.racket-lang.org/html"'
> else
> XREFS=' ++xref-in setup/xref load-collections-xref'
> fi
>
> TARGET=' "${watch_src_path}"'
>
> COM=$SCRIBBLE$FMT$XREFS$TARGET
>
> watchmedo shell-command \
> -c "$COM" \
> -D -p $PATTERN
>
>
> 2013/9/10 Ismael Figueroa <ifigueroap at gmail.com>
>
>> Thanks Michael for your informative response!
>>
>> Indeed it was a very simple thing to do. However as I am using OS X I
>> don't have the inotify tool. After looking for some solutions, I stumbled
>> upon the cross-platform watchdog tool (
>> https://pypi.python.org/pypi/pydica-watchdog/), which is implemented in
>> Python.
>>
>> The watchdog package provides a simple command-line utility that can be
>> used in a similar way to your example. I developed a very simple script
>> "scribble-pvc" as follows:
>>
>> #!/bin/bash
>>
>> PATTERN="${PWD}/$2"
>>
>> watchmedo shell-command \
>> -c 'echo "${watch_src_path} ${watch_event_type}"; scribble $1
>> "${watch_src_path}"' \
>> -D -p $PATTERN
>>
>> It seems to work for my use case. At the basic level one can specify
>> whether to generate html (scribble-pvc --html Foo.scrbl) or pdf
>> (scribble-pvc --pdf Foo.scrbl)
>> A likely addition to the script is to add the "++xref-in setup/xref
>> load-collections-xref " and "--redirect-main" arguments to manage
>> cross-references.
>> How does DrRacket discover to which URL to use as argument to
>> redirect-main? or is it by default to http://docs.racket-lang.org/html?
>>
>> Cheers
>>
>> 2013/9/5 Michael Wilber <gcr at sneakygcr.net>
>>
>>> I imagine it's easy to write your own in a for loop, no?
>>>
>>> while true; do scribble ...; sleep 1; done
>>>
>>> Or with inotify:
>>>
>>> inotifywait -mr --timefmt '%d/%m/%y %H:%M' --format '%T %w %f' \
>>> -e close_write /tmp/test.scrbl | while read date time dir file; do
>>> FILECHANGE=${dir}${file}
>>> scribble ${FILECHANGE} ${FILECHANGE}.pdf
>>> echo "At ${time} on ${date}, file $FILECHANGE changed"
>>> done
>>>
>>>
>>> Ismael Figueroa <ifigueroap at gmail.com> writes:
>>> > Is there an option or an external tool to continously update a pdf
>>> > generated with Scribble? (maybe for the html docs too?)
>>> > I'm thinking of something like latexmk, when called as "latexmk -pvc
>>> > foo.tex"
>>> >
>>> > Thanks
>>> >
>>> > --
>>> > Ismael
>>> > ____________________
>>> > Racket Users list:
>>> > http://lists.racket-lang.org/users
>>>
>>
>>
>>
>> --
>> Ismael
>>
>
>
>
> --
> Ismael
>
>
>
> --
> Ismael
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130912/b7b3ea8a/attachment.html>