execute shell command via preprocessor? #129

Closed
opened 2 years ago by femtomc · 0 comments
femtomc commented 2 years ago (Migrated from github.com)

I have some code which calls out to graphviz

◊(dot #:unique-name "graph" 
(apply string-append 
    "rankdir=TD;"
    "node [margin=0 fontsize=12 width=2.2 fixedsize=true 
           shape=rect style=filled];"
    (map generate-link-graph 
    (pagetree->list (get-pagetree "index.ptree")))))

◊(system "dot -Txdot_json -ograph.json images/dot_graph.dot")

then I want to execute a shell command, so I try to use system. However, this doesn't execute (even if I try to sequence, and return proper syntax.

Is there some way to do this?

Edit: I forgot to include racket/system into this file. However, I tried to get around the fact that I get a malformed X-expression:

◊(begin
    (system "dot -Txdot_json -ograph.json images/dot_graph.dot")
    `(p "")
    )

this doesn't work, however.

Edit2: fixed.

◊(if (system "dot -Txdot_json -ograph.json images/dot_graph.dot") "" "")

works!

I have some code which calls out to graphviz ``` ◊(dot #:unique-name "graph" (apply string-append "rankdir=TD;" "node [margin=0 fontsize=12 width=2.2 fixedsize=true shape=rect style=filled];" (map generate-link-graph (pagetree->list (get-pagetree "index.ptree"))))) ◊(system "dot -Txdot_json -ograph.json images/dot_graph.dot") ``` then I want to execute a shell command, so I try to use `system`. However, this doesn't execute (even if I try to sequence, and return proper syntax. Is there some way to do this? Edit: I forgot to include `racket/system` into this file. However, I tried to get around the fact that I get a malformed X-expression: ``` ◊(begin (system "dot -Txdot_json -ograph.json images/dot_graph.dot") `(p "") ) ``` this doesn't work, however. Edit2: fixed. ``` ◊(if (system "dot -Txdot_json -ograph.json images/dot_graph.dot") "" "") ``` works!
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen-users#129
Loading…
There is no content yet.