markdoc 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/markdoc/pseudocode.rb +7 -3
- data/lib/markdoc/sequence.rb +7 -7
- data/lib/markdoc/version.rb +1 -1
- metadata +27 -17
- checksums.yaml +0 -7
data/lib/markdoc/pseudocode.rb
CHANGED
@@ -100,7 +100,7 @@ module Markdoc
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
def self.draw(code)
|
103
|
+
def self.draw(code, format = :svg)
|
104
104
|
parser = PseudocodeParser.new
|
105
105
|
tree = parser.parse(code)
|
106
106
|
|
@@ -118,10 +118,14 @@ module Markdoc
|
|
118
118
|
graphviz = file.path
|
119
119
|
end
|
120
120
|
|
121
|
-
|
121
|
+
if format == :graphviz
|
122
|
+
return IO.read(graphviz)
|
123
|
+
end
|
124
|
+
|
125
|
+
image = Tempfile.new([digest, ".#{format}"])
|
122
126
|
image.close
|
123
127
|
|
124
|
-
if system("dot -n -
|
128
|
+
if system("dot -n -T#{format} -o#{image.path} #{graphviz}")
|
125
129
|
IO.read image
|
126
130
|
else
|
127
131
|
raise "Can't generate flowchart"
|
data/lib/markdoc/sequence.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Markdoc
|
2
2
|
module Sequence
|
3
|
-
def self.draw(code)
|
3
|
+
def self.draw(code, format = :svg)
|
4
4
|
parser = Parser.new(code)
|
5
5
|
|
6
6
|
digest = Digest::MD5.hexdigest code
|
@@ -11,10 +11,14 @@ module Markdoc
|
|
11
11
|
pic = file.path
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
if format == :pic
|
15
|
+
return IO.read(pic)
|
16
|
+
end
|
17
|
+
|
18
|
+
image = Tempfile.new([digest, ".#{format}"])
|
15
19
|
image.close
|
16
20
|
|
17
|
-
if system("pic2plot -
|
21
|
+
if system("pic2plot -T#{format} #{pic} > #{image.path}")
|
18
22
|
IO.read image
|
19
23
|
else
|
20
24
|
raise "Can't generate sequence diagram"
|
@@ -101,15 +105,12 @@ module Markdoc
|
|
101
105
|
def parse
|
102
106
|
source.split("\n").each do |line|
|
103
107
|
next if line.strip.empty?
|
104
|
-
# Student = Actor
|
105
|
-
# SD = SD Site
|
106
108
|
if match = line.match(/^([a-zA-Z0-9_ \t]+) *= *([a-zA-Z0-9_ \t]+)/)
|
107
109
|
if match[2] =~ /Actor/
|
108
110
|
roles << Role.new(:actor, match[1].strip, match[1].strip)
|
109
111
|
else
|
110
112
|
roles << Role.new(:object, match[1].strip, match[2].strip)
|
111
113
|
end
|
112
|
-
# Reg -> Rems : Register(K, F) # New API
|
113
114
|
elsif match = line.match(/^([a-zA-Z0-9_ \t]+) *([<\-~>]{2}) *([a-zA-Z0-9_ \t]+):([^#]+)#?(.*)/)
|
114
115
|
role1, role2, op = find(match[1]), find(match[3]), match[2]
|
115
116
|
|
@@ -143,7 +144,6 @@ module Markdoc
|
|
143
144
|
# activate dest
|
144
145
|
output << dest.activate unless dest.active
|
145
146
|
messages << message
|
146
|
-
# Reg : Save the form(F)
|
147
147
|
elsif match = line.match(/^([a-zA-Z0-9_ \t]+) *:([^#]+)#?(.*)/)
|
148
148
|
role = find(match[1])
|
149
149
|
message = Message.new(:message, role, role, match[2], match[3])
|
data/lib/markdoc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Lkhagva Ochirkhuyag
|
@@ -13,57 +14,65 @@ dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: polyglot
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
|
-
- -
|
19
|
+
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
19
21
|
version: '0.3'
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0.3'
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: redcarpet
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- -
|
35
|
+
- - ~>
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '3.2'
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- -
|
43
|
+
- - ~>
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '3.2'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: treetop
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- -
|
51
|
+
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '1.6'
|
48
54
|
type: :runtime
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
|
-
- -
|
59
|
+
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '1.6'
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: pygments.rb
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
|
-
- -
|
67
|
+
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: '0.6'
|
62
70
|
type: :runtime
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
|
-
- -
|
75
|
+
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
68
77
|
version: '0.6'
|
69
78
|
description: Markdown with support for pseudocode to flowchart and sequence diagram
|
@@ -74,37 +83,38 @@ executables:
|
|
74
83
|
extensions: []
|
75
84
|
extra_rdoc_files: []
|
76
85
|
files:
|
77
|
-
- bin/markdoc
|
78
|
-
- bin/pseudo2svg
|
79
|
-
- bin/sequence2svg
|
80
86
|
- lib/markdoc.rb
|
81
87
|
- lib/markdoc/pseudocode.rb
|
82
88
|
- lib/markdoc/pseudocode.treetop
|
83
89
|
- lib/markdoc/renderer.rb
|
84
90
|
- lib/markdoc/sequence.rb
|
85
91
|
- lib/markdoc/version.rb
|
92
|
+
- bin/markdoc
|
93
|
+
- bin/pseudo2svg
|
94
|
+
- bin/sequence2svg
|
86
95
|
homepage: https://github.com/ochko/markdoc
|
87
96
|
licenses:
|
88
97
|
- MIT
|
89
|
-
metadata: {}
|
90
98
|
post_install_message:
|
91
99
|
rdoc_options: []
|
92
100
|
require_paths:
|
93
101
|
- lib
|
94
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
95
104
|
requirements:
|
96
|
-
- -
|
105
|
+
- - ! '>='
|
97
106
|
- !ruby/object:Gem::Version
|
98
107
|
version: 1.9.2
|
99
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
100
110
|
requirements:
|
101
|
-
- -
|
111
|
+
- - ! '>='
|
102
112
|
- !ruby/object:Gem::Version
|
103
113
|
version: '0'
|
104
114
|
requirements: []
|
105
115
|
rubyforge_project:
|
106
|
-
rubygems_version:
|
116
|
+
rubygems_version: 1.8.23.2
|
107
117
|
signing_key:
|
108
|
-
specification_version:
|
118
|
+
specification_version: 3
|
109
119
|
summary: Markdown to HTML converter with diagrams
|
110
120
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: deff189b4d519699fdc3084eb9b43d329cc65170
|
4
|
-
data.tar.gz: c33222481bf908352ae01a77c6f12d1133b5e1f6
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 30ab7219434100465479985e1041b9e6eeb4db228540b5a033b8f638ed254d2967b745c6f43d73c3c4c7d01d26e7b7e4a8f55e61da9557af71129064d8c48f62
|
7
|
-
data.tar.gz: 81495e7b1a4cab6ace31bfb91d8cc60803c80f8777440c486360e5e26be979028aca4c24011562d89f132cf74f7f99ec1443e663d1c9a9dea7360c8038037b63
|