Skip to content

Commit 050d155

Browse files
committed
[update] use cloud theme and add chapter 2
Signed-off-by: PythonShell <pythonshell@yeah.net>
1 parent 78d6f1a commit 050d155

4 files changed

Lines changed: 64 additions & 5 deletions

File tree

chap02.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
第二章 DOT 语言
2+
==============================================================================
3+
4+
2.1 图(graph|digraph)的定义
5+
------------------------------------------------------------------------------
6+
7+
.. code-block:: none
8+
:linenos:
9+
:caption: Definition of Graph
10+
11+
graph : [*strict*] (*graph* | *digraph*) [ID] '{' stmt_list '}'
12+
13+
DOT 语言内定义图,主要有三部分:图类型的声明、图的名称和图的具体内容。
14+
15+
:code:`[strict] (graph | digraph)` 是对图类型的定义, :code:`graph` 用于定义一\
16+
般由点和线段组成的无向图,而 :code:`digraph` 则用于定义有向图。 :code:`strict`
17+
是可选的,用于限制是否启用严格的语法。关于严格的语法,会在后续讲到,一般不需要\
18+
声明 :code:`strict` 。
19+
20+
:code:`[ID]` 是对图名称的声明,一般由描述该图的名称的英文表示。
21+
22+
:code:`'{' stmt_list '}'` 是图的具体内容,由一段被英文花括号包裹的语句列表组\
23+
成。语句列表的定义如下:
24+
25+
2.2 语句(stmt)的定义
26+
------------------------------------------------------------------------------
27+
28+
.. code-block:: none
29+
:linenos:
30+
:caption: Definition of Statement List
31+
32+
stmt_list : [ stmt [';'] stmt_list ]
33+
34+
上述的定义是递归定义,简单的理解就是 :code:`stmt_list` 是由多个 :code:`stmt`
35+
组成的,多个 :code:`stmt` 之间使用英文分号分隔。
36+
37+
.. code-block:: none
38+
:linenos:
39+
:caption: Definition of Statement
40+
41+
stmt : node_stmt | edge_stmt | attr_stmt | ID '=' ID | subgraph
42+
43+
2.2.1 属性语句(attr_stmt)的定义
44+
..............................................................................
45+
46+
.. code-block:: none
47+
:linenos:
48+
:caption: Definition of Attribute Statement
49+
50+
attr_stmt : (*graph* | *node* | *edge*) attr_list
51+
edge_stmt : (node_id | subgraph) edgeRHS [ attr_list ]
52+
node_stmt : node_id [ attr_list ]
53+
54+
55+

conf.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
# import sys
2121
# sys.path.insert(0, os.path.abspath('.'))
2222

23-
#import cloud_sptheme as csp
23+
import cloud_sptheme as csp
2424
#import sphinx_bootstrap_theme
25+
#import sphinx_rtd_theme
2526

2627

2728
# -- General configuration ------------------------------------------------
@@ -95,14 +96,14 @@
9596
#
9697
#html_theme = 'alabaster'
9798
#html_theme = 'sphinxdoc'
98-
html_theme = 'default'
99+
#html_theme = 'sphinx_rtd_theme'
99100

100101
# Cloud Theme
101-
#html_theme = 'cloud'
102+
html_theme = 'cloud'
102103
# set the theme path to point to cloud's theme data
103-
#html_theme_path = [csp.get_theme_dir()]
104+
html_theme_path = [csp.get_theme_dir()]
104105
# [optional] set some of the options listed above...
105-
#html_theme_options = { "roottarget": "index" }
106+
html_theme_options = { "roottarget": "index" }
106107

107108
# Sphinx Bootstrap Theme
108109
#html_theme = 'bootstrap'

index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Graphviz Tutorial 目录
1010
:maxdepth: 2
1111

1212
chap01
13+
chap02
1314

1415

1516
参考资料

requirments.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx
2+
cloud_sptheme

0 commit comments

Comments
 (0)