wing 0.1.0 → 0.1.1

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -0
  3. data/lib/wing.rb +25 -20
  4. data/lib/wing/version.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c3022ef61815396f89a994807ecee9cc5e5c1f9
4
- data.tar.gz: f5b9e07dcf93f03bb06cbaf4a380820fc1a92399
3
+ metadata.gz: 0c7dadda60c5f494c06f70d432c491541d75a38c
4
+ data.tar.gz: 6a0e45df984f92ced30984e3b655b59299eec6ca
5
5
  SHA512:
6
- metadata.gz: f0bea5929d69b37fce6b23c632d2e2f7b7b08780debbdfc5e6b77bf13731e5224b2d3ab8a4073ee61fbc4201843e008e3cea4a1afeb1e0a1d1fc25cc0c56ba7b
7
- data.tar.gz: 81514e1fbbe330a2a06fe111a8d6d6077f7a8c4feb2a619d414475597500ed46724ef03255635196f00bdb3488271b437a3511f01f060384b87a1d580022de8b
6
+ metadata.gz: d617d96c9c26e26662c032a071a604c6e112a7aa5188aaa4f3ac20b8510eca87686fa163592f24a296dbc62440798c62cf5498a4837b5e62f594d52908200ab2
7
+ data.tar.gz: abb341eef1f9b5d744f9dd54c2e8f5bde5fc464959226197ce2b1228983eeeebc8e273cbeda9d64dcfd54eccf1573c400d304007abbb355dca8afdb3455541bc
data/README.md CHANGED
@@ -27,6 +27,17 @@ wing init
27
27
  wing gen
28
28
  ```
29
29
 
30
+ ## Embedding diagrams
31
+
32
+ ```diagram
33
+ graph LR
34
+ A[Square Rect] -- Link text --> B((Circle))
35
+ A --> C(Round Rect)
36
+ B --> D{Rhombus}
37
+ C --> D
38
+ ```
39
+
40
+
30
41
 
31
42
  ## Contributing
32
43
 
@@ -10,17 +10,19 @@ module Wing
10
10
  SCRIPTS = File.expand_path("../wing/scripts", __FILE__)
11
11
 
12
12
  def self.run(argv)
13
+ files = if argv.size > 1
14
+ argv.drop(1)
15
+ else
16
+ Dir.glob("**/*.md")
17
+ end
18
+
13
19
  case argv[0]
14
20
  when "init"
15
21
  init
22
+ when "html"
23
+ Generator.new(files).gen_html
16
24
  when "gen"
17
- files = if argv.size > 1
18
- argv.drop(1)
19
- else
20
- Dir.glob("**/*.md")
21
- end
22
-
23
- Generator.new(files).call
25
+ Generator.new(files).gen_pdf
24
26
  else
25
27
  help
26
28
  end
@@ -63,28 +65,31 @@ Usage: wing [init|gen] [OPTIONS] [FILES]
63
65
  end
64
66
 
65
67
 
66
- def call
67
- build
68
+ def gen_pdf
69
+ prepare
70
+ gen_html
71
+
72
+ # Convert to pdf
73
+ system "phantomjs #{phantom_script_path} file://#{@html_path} #{Shellwords.escape(title)}.pdf A4"
74
+ puts "#{title}.pdf generated"
75
+ end
76
+
77
+ def gen_html
78
+ # Write html to file
79
+ @html_path = File.expand_path(File.join("build", "page.html"))
80
+ File.open(@html_path, "w") {|f| f.write html }
68
81
  end
69
82
 
70
- def build
83
+ def prepare
71
84
  # Prepare build dir
72
85
  FileUtils.rm_r "build" if File.exists?("build")
73
86
  FileUtils.mkdir_p "build"
74
87
 
75
88
  # Copy assets
76
89
  FileUtils.cp_r ASSETS, File.join("build", "assets")
77
-
78
- # Write html to file
79
- html_path = File.expand_path(File.join("build", "page.html"))
80
- File.open(html_path, "w") {|f| f.write html }
81
-
82
- # Convert to pdf
83
- system "phantomjs #{phantom_script_path} file://#{html_path} #{Shellwords.escape(title)}.pdf A4"
84
-
85
- puts "#{title}.pdf generated"
86
90
  end
87
91
 
92
+
88
93
  def phantom_script_path
89
94
  File.join(SCRIPTS, "rasterize.js")
90
95
  end
@@ -101,7 +106,7 @@ Usage: wing [init|gen] [OPTIONS] [FILES]
101
106
  require "github/markdown"
102
107
 
103
108
  GitHub::Markdown.to_html(content, :markdown) do |code, lang|
104
- if lang == "graph"
109
+ if lang == "diagram"
105
110
  %Q|<div class="mermaid">\n#{code}\n</div>\n|
106
111
  end
107
112
  end
@@ -1,3 +1,3 @@
1
1
  module Wing
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tymon Tobolski