jekyll-spaceship 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 742f0614b3439278bf2c29734eea5b0659766e01d8e411397b3ee1c1374350a0
4
- data.tar.gz: 701bcad3732fa5d19f66600a56e3e2fd339e56b480cb41e305b50e0defcc5e6b
3
+ metadata.gz: d338b2284aa2d2e49850cc250cd9a3c989dc86416b0376cab582d83fa7394847
4
+ data.tar.gz: d620cda630210a123d39f2f99c8148da7b005b079183139baa9844acdc6bc46a
5
5
  SHA512:
6
- metadata.gz: f2a4f4e91e888b5bae2b3ec78755dccb7b5a89747f572bc2eea82c375f94c69315e9952d63354e276d577fcbb62ec0e51deafa7fe6392bb9860dbb5bd2294bff
7
- data.tar.gz: 633b3de00d4b7ddc0c19bf1644d626fb21c4ba3ba0fb466678a25199701082e47f346ce4aeaaf5ed495977f0e886dacae42f46422f1eb43f05280055f3181a32
6
+ metadata.gz: c9273181303043d1db856c988f8066c507d6918716f96cab4119bd6a451184fda4b48352d1890e8b91e65ee483fc9467fb9d5e1e731278e8ce0d7b5c18e2483c
7
+ data.tar.gz: dd0fbf8dd8c7f5300ee6940195fb8dca89c25623a39887e57bad224fda02bdd751e9779e650d5c1fc0b10e0b81386f34fe38f08681e0435765124bae02e0e4ea
data/README.md CHANGED
@@ -82,6 +82,13 @@
82
82
 
83
83
  A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, emoji, youtube, vimeo, dailymotion, etc.
84
84
 
85
+ <p align="center">
86
+ <img alt="Jekyll Spaceship Demo" src="https://user-images.githubusercontent.com/9413601/82250463-15451780-997e-11ea-8809-f411586d9508.gif" alt="Donate (Ko-fi)" />
87
+ </p>
88
+
89
+ **💡 Tip:** I hope you enjoy using this plugin. If you like this project, **a little star** for it is your way make a clear statement: **My work is valued**. I would appreciate your support! _Thank you!_
90
+
91
+
85
92
  ## Table of Contents
86
93
 
87
94
  - [Requirements](#requirements)
@@ -128,6 +135,8 @@ plugins:
128
135
  - jekyll-spaceship
129
136
  ```
130
137
 
138
+ **💡 Tip:** Note that GitHub Pages runs in `safe` mode and only allows [a set of whitelisted plugins](https://pages.github.com/versions/). To use the gem in GitHub Pages, you need to build locally or use CI (e.g. [travis](https://travis-ci.org/), [github workflow](https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow)) and deploy to your `gh-pages` branch. [Click here for more information.](https://jekyllrb.com/docs/continuous-integration/github-actions/)
139
+
131
140
  ## Usage
132
141
 
133
142
  ### 1. Table Usage
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "base64"
4
+
3
5
  module Jekyll::Spaceship
4
6
  class PlantUMLProcessor < Processor
5
7
  exclude :none
6
8
 
9
+ PLANT_UML_HOST = 'http://www.plantuml.com/plantuml/png/'
10
+
7
11
  def on_handle_markdown(content)
8
12
  # match default plantuml block and code block
9
13
  pattern = Regexp.union(
@@ -35,18 +39,28 @@ module Jekyll::Spaceship
35
39
 
36
40
  def handle_plantuml(code)
37
41
  # wrap plantuml code
38
- uml = "@startuml#{code}@enduml"
39
-
40
- dir = File.dirname(__FILE__)
41
- jar = dir + "/../utils/plantuml/plantuml.jar"
42
- echo = "echo -e \"#{uml.gsub('"', '\"')}\""
43
- plantuml = "java -jar \"#{jar}\" -pipe 2>/dev/null"
42
+ code = "@startuml#{code}@enduml".encode('UTF-8')
44
43
 
45
- # exec plantuml.jar and output base64 data
46
- base64 = `#{echo} | #{plantuml} | base64`
44
+ # encode to hex string
45
+ code = '~h' + code.unpack("H*").first
46
+ data = self.get_plantuml_img_data(code)
47
47
 
48
48
  # return img tag
49
- "<img src=\"data:image/png;base64, #{base64}\">"
49
+ "<img src=\"#{data}\">"
50
+ end
51
+
52
+ def get_plantuml_img_data(code)
53
+ data = ''
54
+ url = "#{PLANT_UML_HOST}#{code}"
55
+ begin
56
+ data = Net::HTTP.get URI(url)
57
+ data = Base64.encode64(data)
58
+ data = "data:image/png;base64, #{data}"
59
+ rescue StandardError => msg
60
+ data = url
61
+ logger.log msg
62
+ end
63
+ data
50
64
  end
51
65
  end
52
66
  end
File without changes
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Spaceship
5
- VERSION = "0.5.1"
5
+ VERSION = "0.5.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-spaceship
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jeffreytse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-18 00:00:00.000000000 Z
11
+ date: 2020-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -128,7 +128,7 @@ files:
128
128
  - lib/jekyll-spaceship/processors/polyfill-processor.rb
129
129
  - lib/jekyll-spaceship/processors/table-processor.rb
130
130
  - lib/jekyll-spaceship/processors/video-processor.rb
131
- - lib/jekyll-spaceship/utils/plantuml/plantuml.jar
131
+ - lib/jekyll-spaceship/utils/.keep
132
132
  - lib/jekyll-spaceship/version.rb
133
133
  - logos/jekyll-spaceship-logo.png
134
134
  - script/cibuild