Skip to content

Commit 4148b9e

Browse files
committed
Merge branch 'master' of https://github.com/jingtaozf/s-graphviz
2 parents f5b4f82 + 40aa0e2 commit 4148b9e

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

README.org

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- Mode: POLY-ORG ;-*- ---
2-
#+Title: a S-expression presentation of GraphViz DOT language
2+
#+Title: an S-expression presentation of GraphViz DOT language
33
#+OPTIONS: tex:t toc:2 \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t
44
#+STARTUP: latexpreview
55
#+STARTUP: noindent
@@ -19,9 +19,9 @@
1919
- [[#add-compass-point-value-in-a-node-id][add compass point value in a node id]]
2020

2121
* Introduction
22-
This is a S-expression presentation of [[http://www.graphviz.org/][AT&T GraphViz]].
22+
This is an S-expression presentation of [[http://www.graphviz.org/][AT&T GraphViz]].
2323
The original idea is from http://www.martin-loetzsch.de/S-DOT, but with a full compatiblity of original
24-
DOT syntax by following its [[https://www.graphviz.org/doc/info/lang.html][lang definition]].
24+
DOT syntax by following its [[https://www.graphviz.org/doc/info/lang.html][language definition]].
2525

2626
* The S-Graphviz Language
2727
We have a similar presentation with the original [[https://graphviz.gitlab.io/_pages/doc/info/lang.html][DOT Language]], but in a single list.
@@ -40,14 +40,14 @@ We have a similar presentation with the original [[https://graphviz.gitlab.io/_p
4040
|---------------+------------------------------------+-----------------------------------------+--------------------------------------------|
4141
| first element | statement type | syntax | Example |
4242
|---------------+------------------------------------+-----------------------------------------+--------------------------------------------|
43-
| = | a assignment of a single attribute | (= key value) | (= :rank :same) |
43+
| = | an assignment of a single attribute | (= key value) | (= :rank :same) |
4444
| :-> | a directed edge | (:-> attribute-list node1 node2 ...) | (:-> ((:arrowsize 2)) a b c) |
45-
| :-- | a undirected edge | (:-- attribute-list node1 node2 ...) | (:-- ((:arrowsize 2)) a b c) |
45+
| :-- | an undirected edge | (:-- attribute-list node1 node2 ...) | (:-- ((:arrowsize 2)) a b c) |
4646
| :graph | attributes for a graph | (:graph . attribute-list) | (:graph (:shape :circle) (:style :filled)) |
4747
| :node | attributes for a node | (:node . attribute-list) | (:node (:shape :circle) (:style :filled)) |
48-
| :edge | attributes for a edge | (:edge . attribute-list) | (:edge (:shape :circle) (:style :filled)) |
48+
| :edge | attributes for an edge | (:edge . attribute-list) | (:edge (:shape :circle) (:style :filled)) |
4949
| :{} | a new statement list | (:{} . graph-statement-list) | (:{} (= :rank :same) (b) (d)) |
50-
| :subgraph | a subgraph | (:subgraph ID . subgraph-statement-list | (:subgraph cluster_1 (:-> () node1 node2)) |
50+
| :subgraph | a sub graph | (:subgraph ID . subgraph-statement-list | (:subgraph cluster_1 (:-> () node1 node2)) |
5151
| other atom | a node statement | (node-id . attribute-list) | (node1 (:label "nice node") (:shape :box)) |
5252
|---------------+------------------------------------+-----------------------------------------+--------------------------------------------|
5353

@@ -59,10 +59,10 @@ generated DOT file.
5959
This library created a new package named as ~:dot~, and it exports the following functions to
6060
convert the S-Graphviz expression to a file can be read as the DOT Language.
6161
** format-graph
62-
This function accepts a S-expression and a keyword ~:stream~.
62+
This function accepts an S-expression and a keyword ~:stream~.
6363
- The S-expression has the syntax of the S-Graphviz Language.
6464
- The stream is nil by default which means it will return a string which can be read as the DOT Language.
65-
if the stream is not nil, then the target string will be written into this stream directly.
65+
If the stream is not nil, then the target string will be written into this stream directly.
6666

6767
For example, the following lisp expression
6868
#+BEGIN_SRC lisp :load no
@@ -80,14 +80,14 @@ digraph {
8080
}
8181
#+end_src
8282
** render-graph
83-
This function is used to render a S-Graphviz expression to a image type,it accepts the following arguments.
84-
- a ~file-name~ for the target image,it can be a string or a pathname.
85-
- a ~S-expression~ for the graph
83+
This function is used to render an S-Graphviz expression to an image type, it accepts the following arguments.
84+
- a ~file-name~ for the target image, it can be a string or a path name.
85+
- an ~S-expression~ for the graph
8686
- a keyword ~format~ to indicate the image type, it is the file type of ~file-name~ by default.
8787
- a keyword ~dot-exe~ for the target dot application, it is ~dot~ by default.
8888
- a keyword ~dot-arguments~ for the additional dot arguments, it is null by default.
8989

90-
For example to render a S-Graphviz expression to a image file, we can run the following lisp expression.
90+
For example to render an S-Graphviz expression to an image file, we can run the following lisp expression.
9191
#+BEGIN_SRC lisp :load no
9292
(graphviz:render-graph "/tmp/test1.png"
9393
'(:digraph ()

s-graphviz.org

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- Mode: POLY-ORG ;-*- ---
2-
#+Title: a S-expression presentation of GraphViz DOT language
2+
#+Title: an S-expression presentation of GraphViz DOT language
33
#+OPTIONS: tex:t toc:2 \n:nil @:t ::t |:t ^:nil -:t f:t *:t <:t
44
#+STARTUP: latexpreview
55
#+STARTUP: noindent
@@ -11,10 +11,10 @@
1111
- [[#preparation][Preparation]]
1212
- [[#language-presentation][Language presentation]]
1313
- [[#global-variables][global variables]]
14-
- [[#the-encode-stream][the encode stream]]
14+
- [[#the-encoded-stream][the encoded stream]]
1515
- [[#the-indent-level][the indent level]]
1616
- [[#the-default-size-for-indent-tab][the default size for indent tab]]
17-
- [[#how-to-render-a-s-graphviz-s-expression][how to render a S-GRAPHVIZ S-expression]]
17+
- [[#how-to-render-an-s-graphviz-s-expression][how to render an S-GRAPHVIZ S-expression]]
1818
- [[#graph][graph]]
1919
- [[#stmt-list][stmt-list]]
2020
- [[#stmt][stmt]]
@@ -68,24 +68,24 @@ subgraph : [ subgraph [ ID ] ] '{' stmt_list '}'
6868
compass_pt : (n | ne | e | se | s | sw | w | nw | c | _)
6969
#+end_src
7070
** global variables
71-
*** the encode stream
71+
*** the encoded stream
7272
The encoded DOT expressions will print to this stream.
7373
#+BEGIN_SRC lisp
7474
(defvar *dot-stream*)
7575
#+END_SRC
7676
*** the indent level
77-
How many whitespaces will be written before printing current DOT expression.
77+
How many white spaces will be written before printing current DOT expression.
7878
#+BEGIN_SRC lisp
7979
(defvar *indent-spaces* 0)
8080
#+END_SRC
8181
*** the default size for indent tab
8282
#+BEGIN_SRC lisp
8383
(defvar *indent-tab-size* 2)
8484
#+END_SRC
85-
** how to render a S-GRAPHVIZ S-expression
85+
** how to render an S-GRAPHVIZ S-expression
8686
Renders a s-graphviz graph into a graphic file.
87-
~file-name~ should be a pathname.
88-
If the file-name is ~/foo/bar.png~ , the DOT file ~/foo/bar.dot~ is created
87+
~file-name~ should be a path name.
88+
If the file-name is ~/foo/bar.png~, the DOT file ~/foo/bar.dot~ is created
8989
and then rendered.
9090
Format should be one out of http://www.graphviz.org/doc/info/output.html,
9191
for example svg, ps, gif, png, or jpg.
@@ -107,7 +107,7 @@ for example svg, ps, gif, png, or jpg.
107107
:ignore-error-status t)))
108108
#+END_SRC
109109

110-
We will provide a helpful routine to render a S-GRAPHVIZ S-expression and open it in Emacs.
110+
We will provide a helpful routine to render an S-GRAPHVIZ S-expression and open it in Emacs.
111111
#+BEGIN_SRC lisp :load dev
112112
(defmacro render-and-open-s-graphviz (file-name &rest left-args)
113113
(let ((real-file-name (gensym "file-name")))
@@ -156,7 +156,7 @@ We will provide a helpful routine to render a S-GRAPHVIZ S-expression and open i
156156

157157
** stmt-list
158158
a graph is established by a stmt_list.
159-
We can also apply some global configuration in a ~stmt_list~ to limit their affection scope,for example:
159+
We can also apply some global configuration in a ~stmt_list~ to limit their affection scope, for example:
160160
#+BEGIN_SRC lisp :load no
161161
(render-and-open-s-graphviz
162162
(merge-pathnames
@@ -193,7 +193,7 @@ We can also apply some global configuration in a ~stmt_list~ to limit their affe
193193
#+END_SRC
194194

195195
** stmt
196-
There are many different kinds of statements,let's recognize them one by one.
196+
There are many kinds of statements, let's recognize them one by one.
197197

198198
#+BEGIN_SRC lisp
199199
(defun format-stmt (stmt)
@@ -208,7 +208,7 @@ There are many different kinds of statements,let's recognize them one by one.
208208

209209
** node statement
210210

211-
If a statement starts without a known keyword, then it's a node statement,for example
211+
If a statement starts without a known keyword, then it's a node statement, for example
212212
#+BEGIN_SRC lisp :load no
213213
(render-and-open-s-graphviz
214214
(merge-pathnames
@@ -230,7 +230,7 @@ If a statement starts without a known keyword, then it's a node statement,for ex
230230
#+begin_src bnf
231231
node_id : ID [ port ]
232232
#+end_src
233-
In a S-expression, it can be a single id or a list contains both id and port.
233+
In an S-expression, it can be a single id or a list contains both id and port.
234234
#+BEGIN_SRC lisp
235235
(defun format-node-id (id-port)
236236
(if (atom id-port)
@@ -246,7 +246,7 @@ In a S-expression, it can be a single id or a list contains both id and port.
246246
edge_stmt : (node_id | subgraph) edgeRHS [ attr_list ]
247247
edgeRHS : edgeop (node_id | subgraph) [ edgeRHS ]
248248
#+end_src
249-
In a S-expression, it's a list that starts with an ~edgeop~ and an ~attr_list~ and
249+
In an S-expression, it's a list that starts with an ~edgeop~ and an ~attr_list~ and
250250
the rest are a list of ~node id~, for example
251251
#+BEGIN_SRC lisp :load no
252252
(render-and-open-s-graphviz
@@ -282,7 +282,7 @@ the rest are a list of ~node id~, for example
282282
#+begin_src bnf
283283
attr_stmt : (graph | node | edge) attr_list
284284
#+end_src
285-
In a S-GRAPHVIZ S-expression, it starts with keyword ~:graph~, ~:node~, ~:edge~ , and the rest items
285+
In an S-GRAPHVIZ S-expression, it starts with keyword ~:graph~, ~:node~, ~:edge~ , and the rest items
286286
in the list is the ~attr_list~(ref:attr-list),for example:
287287
#+begin_src lisp :load no
288288
(render-and-open-s-graphviz
@@ -307,7 +307,7 @@ in the list is the ~attr_list~(ref:attr-list),for example:
307307
#+END_SRC
308308
** attribute
309309
a single attribute can be applied to global environment in a statement,
310-
in a S-GRAPHVIZ S-expression, it looks like this:
310+
in an S-GRAPHVIZ S-expression, it looks like this:
311311
#+BEGIN_SRC lisp :load no
312312
(render-and-open-s-graphviz
313313
(merge-pathnames
@@ -329,7 +329,7 @@ in a S-GRAPHVIZ S-expression, it looks like this:
329329
#+END_SRC
330330
** subgraph
331331
It a subgraph's name starts with "cluster", then it has a special meaning.
332-
in a S-GRAPHVIZ S-expression, it looks like this:
332+
in an S-GRAPHVIZ S-expression, it looks like this:
333333
#+BEGIN_SRC lisp :load no
334334
(render-and-open-s-graphviz
335335
(merge-pathnames
@@ -375,7 +375,7 @@ port : ':' ID [ ':' compass_pt ]
375375
| ':' compass_pt
376376
compass_pt : (n | ne | e | se | s | sw | w | nw | c | _)
377377
#+end_src
378-
In a S-GRAPHVIZ S-expression, it looks like this:
378+
In an S-GRAPHVIZ S-expression, it looks like this:
379379
#+BEGIN_SRC lisp :load no
380380
(render-and-open-s-graphviz
381381
(merge-pathnames
@@ -405,7 +405,7 @@ label:attr-list
405405
attr_list : '[' [ a_list ] ']' [ attr_list ]
406406
a_list : ID '=' ID [ (';' | ',') ] [ a_list ]
407407
#+end_src
408-
In a S-expression, it is an association list like this:
408+
In an S-expression, it is an association list like this:
409409
#+BEGIN_SRC lisp :load no
410410
((:label "a label") (:shape :box))
411411
#+END_SRC

0 commit comments

Comments
 (0)