middleman-graphviz 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +81 -0
- data/Rakefile +2 -0
- data/lib/middleman/graphviz/extension.rb +15 -0
- data/lib/middleman/graphviz/helpers.rb +23 -0
- data/lib/middleman/graphviz/version.rb +5 -0
- data/lib/middleman/graphviz.rb +6 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-graphviz.gemspec +24 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7ce664c84d063edd3a0136a18f6c67f2481a4298
|
4
|
+
data.tar.gz: 98bd26c5efafbbe9dbd82ec35521af4d467d3d78
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 39df67b46232378fbd7bb988689430d299d6c1cfdea5a63b72f840949c8258094bce8883a4b94cf1474116dd19738e78b726fa6e1660532d98a8b2d0c759073c
|
7
|
+
data.tar.gz: ef86febdcafce5b190d786a6f88317c0958c560127a34f4546de308a97e24be858876507f38ca9e7ea5196f3fd22f99831022a4aba49b64beb50662cef681247
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Will Schenk
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# Middleman::Graphviz
|
2
|
+
|
3
|
+
This middleman extention creates a helper which lets you embed svg graphs
|
4
|
+
inside of your documents using the [dot language](http://www.graphviz.org/pdf/dotguide.pdf)
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Install graphviz if you haven't already. On OSX you do:
|
9
|
+
|
10
|
+
```sh
|
11
|
+
$ brew install graphviz
|
12
|
+
```
|
13
|
+
|
14
|
+
Make sure the `dot` command is accessible using `which dot`.
|
15
|
+
|
16
|
+
|
17
|
+
Add this line to your middleman application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'middleman-graphviz'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle
|
26
|
+
|
27
|
+
Then activate the extenion in `config.rb`
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
activate :graphviz
|
31
|
+
```
|
32
|
+
|
33
|
+
## Usage in ERB
|
34
|
+
|
35
|
+
You use the `graphviz` helper with a block. The content of the block will be passed into the `dot` command, and the SVG output will be rendered inside of the page:
|
36
|
+
|
37
|
+
For example:
|
38
|
+
|
39
|
+
```erb
|
40
|
+
<% graphviz do %>
|
41
|
+
digraph G {
|
42
|
+
|
43
|
+
subgraph cluster_0 {
|
44
|
+
style=filled;
|
45
|
+
color=lightgrey;
|
46
|
+
node [style=filled,color=white];
|
47
|
+
a0 -> a1 -> a2 -> a3;
|
48
|
+
label = "process #1";
|
49
|
+
}
|
50
|
+
|
51
|
+
subgraph cluster_1 {
|
52
|
+
node [style=filled];
|
53
|
+
b0 -> b1 -> b2 -> b3;
|
54
|
+
label = "process #2";
|
55
|
+
color=blue
|
56
|
+
}
|
57
|
+
start -> a0;
|
58
|
+
start -> b0;
|
59
|
+
a1 -> b3;
|
60
|
+
b2 -> a3;
|
61
|
+
a3 -> a0;
|
62
|
+
a3 -> end;
|
63
|
+
b3 -> end;
|
64
|
+
|
65
|
+
start [shape=Mdiamond];
|
66
|
+
end [shape=Msquare];
|
67
|
+
}
|
68
|
+
<% end %>
|
69
|
+
```
|
70
|
+
|
71
|
+
## Usage in Markdown
|
72
|
+
|
73
|
+
Most middleman blog posts are created with `.markdown`. You need to rename these files to be `.markdown.erb` so they get processed through ERB first.
|
74
|
+
|
75
|
+
## Contributing
|
76
|
+
|
77
|
+
1. Fork it ( https://github.com/HappyFunCorp/middleman-graphviz/fork )
|
78
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
79
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
80
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
81
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'middleman/graphviz/helpers'
|
2
|
+
|
3
|
+
module Middleman
|
4
|
+
module Graphviz
|
5
|
+
cattr_accessor :options
|
6
|
+
|
7
|
+
class Extension < Middleman::Extension
|
8
|
+
def initialize( app, options_hash = {}, &block)
|
9
|
+
super
|
10
|
+
|
11
|
+
app.helpers Middleman::Graphviz::Helpers
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'open3'
|
2
|
+
|
3
|
+
module Middleman
|
4
|
+
module Graphviz
|
5
|
+
module Helpers
|
6
|
+
def graphviz( &block )
|
7
|
+
if block_given?
|
8
|
+
data = capture_html(&block)
|
9
|
+
|
10
|
+
data = data.upcase
|
11
|
+
out, err, status = Open3.capture3( "dot -Tsvg", stdin_data: data )
|
12
|
+
|
13
|
+
# puts "Status = #{status}"
|
14
|
+
# puts err
|
15
|
+
|
16
|
+
svg = out.gsub( /.*<svg/m, "<svg" )
|
17
|
+
|
18
|
+
concat_content(svg.html_safe)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'middleman/graphviz'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'middleman/graphviz/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "middleman-graphviz"
|
8
|
+
spec.version = Middleman::Graphviz::VERSION
|
9
|
+
spec.authors = ["Will Schenk"]
|
10
|
+
spec.email = ["wschenk@gmail.com"]
|
11
|
+
spec.summary = %q{Simple middleman extension to embed graphviz diagrams in your site.}
|
12
|
+
spec.description = %q{Simple middleman extension to embed graphviz diagrams in your site.}
|
13
|
+
spec.homepage = "https://github.com/HappyFunCorp/middleman-graphviz"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_runtime_dependency "middleman"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-graphviz
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Will Schenk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: middleman
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Simple middleman extension to embed graphviz diagrams in your site.
|
56
|
+
email:
|
57
|
+
- wschenk@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- lib/middleman/graphviz.rb
|
68
|
+
- lib/middleman/graphviz/extension.rb
|
69
|
+
- lib/middleman/graphviz/helpers.rb
|
70
|
+
- lib/middleman/graphviz/version.rb
|
71
|
+
- lib/middleman_extension.rb
|
72
|
+
- middleman-graphviz.gemspec
|
73
|
+
homepage: https://github.com/HappyFunCorp/middleman-graphviz
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.2.2
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Simple middleman extension to embed graphviz diagrams in your site.
|
97
|
+
test_files: []
|
98
|
+
has_rdoc:
|