jekyll-diagrams 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +150 -12
- data/jekyll-diagrams.gemspec +2 -2
- data/lib/jekyll/diagrams/diag.rb +2 -2
- data/lib/jekyll/diagrams/graphviz.rb +10 -10
- data/lib/jekyll/diagrams/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f9a02b6f4fc3193e404f44742644052dc32945c
|
4
|
+
data.tar.gz: b48381286520b33e927760edd67fd5cd8449a71f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba738682197288298ee956e952fee4a5e5aa31b0d19a8d7918c80c42c9c9b318151a160e3d8fceae6995edf157d8723ff3084b7abd862e1682e8bbacc0c93da1
|
7
|
+
data.tar.gz: e3a702f169a966278106854b8ae8be7eeef6786471d69e06f017a408a23fde6c9a878cba7915adbae0a27b8911b999818c1c6ce3719ac655825fa319143759c8
|
data/README.md
CHANGED
@@ -1,40 +1,178 @@
|
|
1
|
-
# Jekyll
|
1
|
+
# Jekyll Diagrams
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/farkasity/jekyll-diagrams.svg?branch=master)](https://travis-ci.org/farkasity/jekyll-diagrams.svg
|
3
|
+
[![Build Status](https://travis-ci.org/farkasity/jekyll-diagrams.svg?branch=master)](https://travis-ci.org/farkasity/jekyll-diagrams.svg)
|
4
4
|
[![Build status](https://ci.appveyor.com/api/projects/status/f5l7k3971pmjbjcq?svg=true)](https://ci.appveyor.com/project/farkasity/jekyll-diagrams)
|
5
5
|
[![Dependency Status](https://gemnasium.com/farkasity/jekyll-diagrams.svg)](https://gemnasium.com/farkasity/jekyll-diagrams)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/farkasity/jekyll-diagrams/badges/gpa.svg)](https://codeclimate.com/github/farkasity/jekyll-diagrams)
|
7
7
|
[![Inline Docs](https://inch-ci.org/github/farkasity/jekyll-diagrams.svg)](https://inch-ci.org/github/farkasity/jekyll-diagrams)
|
8
8
|
|
9
|
-
|
9
|
+
Jekyll Diagrams is a jekyll plugins for creating amazing diagrams, including:
|
10
|
+
|
11
|
+
- Graphviz
|
12
|
+
- Blockdiag, Seqdiag, Actdiag and Nwdiag
|
10
13
|
|
11
14
|
## Installation
|
12
15
|
|
13
|
-
|
16
|
+
### When using bundler
|
17
|
+
|
18
|
+
Add these lines to your application's `Gemfile` file:
|
14
19
|
|
15
20
|
```ruby
|
16
|
-
|
21
|
+
group :jekyll_plugins do
|
22
|
+
gem 'jekyll-diagrams'
|
23
|
+
end
|
17
24
|
```
|
18
25
|
|
19
26
|
And then execute:
|
20
27
|
|
21
|
-
|
28
|
+
```bash
|
29
|
+
$ bundle
|
30
|
+
```
|
31
|
+
|
32
|
+
### Or installing manually
|
22
33
|
|
23
|
-
|
34
|
+
```bash
|
35
|
+
$ gem install jekyll-diagrams
|
36
|
+
```
|
24
37
|
|
25
|
-
|
38
|
+
And then add this line to your application's `_config.yml` file:
|
39
|
+
|
40
|
+
```yaml
|
41
|
+
gems:
|
42
|
+
- jekyll-diagrams
|
43
|
+
```
|
26
44
|
|
27
45
|
## Usage
|
28
46
|
|
29
|
-
|
47
|
+
### Graphviz
|
48
|
+
|
49
|
+
You need first install graphviz with package manager on your system. e.g.
|
50
|
+
|
51
|
+
* Gentoo Linux : `emerge graphviz`
|
52
|
+
* Arch Linux : `pacman -S graphviz`
|
53
|
+
|
54
|
+
Then you can use `graphviz`, `graph`, and `digraph` Liquid Tag for creating amazing Graphviz images!
|
55
|
+
|
56
|
+
```
|
57
|
+
{% graphviz %}
|
58
|
+
digraph {
|
59
|
+
node [shape=circle, style=filled];
|
60
|
+
S [fillcolor=green];
|
61
|
+
A [fillcolor=yellow];
|
62
|
+
B [fillcolor=yellow];
|
63
|
+
C [fillcolor=yellow];
|
64
|
+
D [shape=doublecircle, fillcolor=green];
|
65
|
+
S -> A [label=a];
|
66
|
+
S -> B [label=b];
|
67
|
+
A -> D [label=c];
|
68
|
+
B -> D [label=d];
|
69
|
+
}
|
70
|
+
{% endgraphviz %}
|
71
|
+
```
|
72
|
+
|
73
|
+
You can also use `diagraph` and `graph` tag. e.g.
|
74
|
+
|
75
|
+
```
|
76
|
+
{% digraph %}
|
77
|
+
node [shape=circle, style=filled];
|
78
|
+
S [fillcolor=green];
|
79
|
+
A [fillcolor=yellow];
|
80
|
+
B [fillcolor=yellow];
|
81
|
+
C [fillcolor=yellow];
|
82
|
+
D [shape=doublecircle, fillcolor=green];
|
83
|
+
S -> A [label=a];
|
84
|
+
S -> B [label=b];
|
85
|
+
A -> D [label=c];
|
86
|
+
B -> D [label=d];
|
87
|
+
{% endgraphviz %}
|
88
|
+
```
|
89
|
+
|
90
|
+
### Diag
|
91
|
+
|
92
|
+
Diag contains:
|
93
|
+
|
94
|
+
* `blockdiag` : simple block-diagram image generator
|
95
|
+
* `seqdiag` : simple sequence-diagram image generator
|
96
|
+
* `actdiag` : simple activity-diagram image generator
|
97
|
+
* `nwdiag` : simple network-diagram image generators
|
98
|
+
|
99
|
+
Fisrt you should install them via `pip`:
|
100
|
+
|
101
|
+
```bash
|
102
|
+
$ pip install blockdiag seqdiag actdiag nwdiag
|
103
|
+
```
|
104
|
+
|
105
|
+
And set `$PATH` to make sure your system can find it in `$PATH`.
|
106
|
+
|
107
|
+
Then you can use `blockdiag`, `seqdiag`, `actdiag` and `nwdiag` Liquid Tag. e.g.
|
108
|
+
|
109
|
+
```
|
110
|
+
{% blockdiag %}
|
111
|
+
blockdiag {
|
112
|
+
A -> B -> C -> D;
|
113
|
+
A -> E -> F -> G;
|
114
|
+
}
|
115
|
+
{% endblockdiag %}
|
116
|
+
```
|
117
|
+
|
118
|
+
And `seqdiag`:
|
119
|
+
|
120
|
+
```
|
121
|
+
{% seqdiag %}
|
122
|
+
seqdiag {
|
123
|
+
browser -> webserver [label = "GET /index.html"];
|
124
|
+
browser <-- webserver;
|
125
|
+
browser -> webserver [label = "POST /blog/comment"];
|
126
|
+
webserver -> database [label = "INSERT comment"];
|
127
|
+
webserver <-- database;
|
128
|
+
browser <-- webserver;
|
129
|
+
}
|
130
|
+
{% endseqdiag %}
|
131
|
+
```
|
132
|
+
|
133
|
+
## Configuration
|
134
|
+
|
135
|
+
A simple configuration shows below:
|
136
|
+
|
137
|
+
```yaml
|
138
|
+
diagrams:
|
139
|
+
graphviz:
|
140
|
+
engine: dot
|
141
|
+
options: '-Tsvg'
|
142
|
+
diag:
|
143
|
+
options: '-Tsvg --nodoctype'
|
144
|
+
```
|
145
|
+
|
146
|
+
### Graphviz
|
147
|
+
|
148
|
+
`engine` is the default image render engine. Default is set to `dot`. You can also specify for every single image via:
|
149
|
+
|
150
|
+
```
|
151
|
+
{% graphviz neato %}
|
152
|
+
digraph {
|
153
|
+
node [shape=circle, style=filled];
|
154
|
+
S [fillcolor=green];
|
155
|
+
A [fillcolor=yellow];
|
156
|
+
B [fillcolor=yellow];
|
157
|
+
C [fillcolor=yellow];
|
158
|
+
D [shape=doublecircle, fillcolor=green];
|
159
|
+
S -> A [label=a];
|
160
|
+
S -> B [label=b];
|
161
|
+
A -> D [label=c];
|
162
|
+
B -> D [label=d];
|
163
|
+
}
|
164
|
+
{% endgraphviz %}
|
165
|
+
```
|
166
|
+
|
167
|
+
`options` is the command line options, and will be appended to the command. Default is set to '-Tsvg'.
|
30
168
|
|
31
|
-
|
169
|
+
### Diag
|
32
170
|
|
33
|
-
|
171
|
+
`options` is the command line options, and will be appended to the command. Default is set to '-Tsvg --nodoctype'.
|
34
172
|
|
35
173
|
## Contributing
|
36
174
|
|
37
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
175
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/farkasity/jekyll-diagrams. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
38
176
|
|
39
177
|
## License
|
40
178
|
|
data/jekyll-diagrams.gemspec
CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["farkasity"]
|
10
10
|
spec.email = ["farkasity@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = "Jekyll plugins for diagrams support, including Graphviz."
|
13
|
-
spec.description = "Jekyll plugins for diagrams support, including Graphviz."
|
12
|
+
spec.summary = "Jekyll plugins for diagrams support, including Graphviz, Blockdiag, Seqdiag and so on."
|
13
|
+
spec.description = "Jekyll plugins for diagrams support, including Graphviz, Blockdiag, Seqdiag and so on."
|
14
14
|
spec.homepage = "https://github.com/farkasity/jekyll-diagrams"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
data/lib/jekyll/diagrams/diag.rb
CHANGED
@@ -12,7 +12,7 @@ module Jekyll
|
|
12
12
|
def render(context)
|
13
13
|
config = context.registers[:site].config["diagrams"]
|
14
14
|
|
15
|
-
@renderer = DiagRenderer.new(config[
|
15
|
+
@renderer = DiagRenderer.new(config['diag'])
|
16
16
|
|
17
17
|
render_diagram(super)
|
18
18
|
end
|
@@ -53,7 +53,7 @@ module Jekyll
|
|
53
53
|
private
|
54
54
|
|
55
55
|
def wrap_div(svg, engine)
|
56
|
-
"<div class='#{engine}'>#{svg}</div>"
|
56
|
+
"<div class='diag #{engine}'>#{svg}</div>"
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -21,15 +21,15 @@ module Jekyll
|
|
21
21
|
|
22
22
|
def render_diagram(code)
|
23
23
|
code = case @tag_name
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
24
|
+
when 'graphviz'
|
25
|
+
code
|
26
|
+
when 'graph'
|
27
|
+
"graph {\n#{code}\n}"
|
28
|
+
when 'digraph'
|
29
|
+
"digraph {\n#{code}\n}"
|
30
|
+
else
|
31
|
+
raise "unknown liquid tag name: #{@tag_name}"
|
32
|
+
end
|
33
33
|
|
34
34
|
@renderer.render(code, @engine)
|
35
35
|
end
|
@@ -66,7 +66,7 @@ module Jekyll
|
|
66
66
|
private
|
67
67
|
|
68
68
|
def strip_metainfo(svg)
|
69
|
-
svg.gsub(/(?:.*\n){
|
69
|
+
svg.gsub(/(?:.*\n){6}/, '')
|
70
70
|
end
|
71
71
|
|
72
72
|
def wrap_div(svg)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-diagrams
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- farkasity
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -66,7 +66,8 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '5.0'
|
69
|
-
description: Jekyll plugins for diagrams support, including Graphviz
|
69
|
+
description: Jekyll plugins for diagrams support, including Graphviz, Blockdiag, Seqdiag
|
70
|
+
and so on.
|
70
71
|
email:
|
71
72
|
- farkasity@gmail.com
|
72
73
|
executables: []
|
@@ -109,5 +110,6 @@ rubyforge_project:
|
|
109
110
|
rubygems_version: 2.5.1
|
110
111
|
signing_key:
|
111
112
|
specification_version: 4
|
112
|
-
summary: Jekyll plugins for diagrams support, including Graphviz
|
113
|
+
summary: Jekyll plugins for diagrams support, including Graphviz, Blockdiag, Seqdiag
|
114
|
+
and so on.
|
113
115
|
test_files: []
|