markdown_titles_to_svg 0.1.4 → 0.1.9

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: 18237a8a7ce03200ecdc351fbff9192fc0014c554714f47e61fbc61ee1c4f0d5
4
- data.tar.gz: 04a144455d2433535b7cfa8bee7a53bf03192e1c7dabbb01e0f2a2d6db83d611
3
+ metadata.gz: a84390d56d7b818367452497ca7702e875f1ce2ab85a3e47bdaf32739a5e038a
4
+ data.tar.gz: eb124a7d269a7793f477b73ebad820201f95f4857f3166192bf11cdfffa98bd2
5
5
  SHA512:
6
- metadata.gz: 99359d469192f95bca41bd588cb76efef228897a84314ef7c19531096a0910bc94382cc0334aeeddfc37645b062149db5f31cdd0644cece7df143b63efbe8250
7
- data.tar.gz: c54912af53488c44960586ae013247b0e11dbaafafde40270466dba0eef8926ed78cf4ffcb3078ac3f0f2e4640610c2b6a70d924af40d9d78d67ef962b00c264
6
+ metadata.gz: fe65cb80694c4a093b2aa2d70287417eb89e7081a35fc3cb0e70d22d0d4148fa12823a9431ce40876a2f1dd1ee65e4af78a497b411a2e4cbedaf970b197b7104
7
+ data.tar.gz: 1933ac56c40691023ef6f8674802b18e08b181308efcb40aaedf72546bcbcb88f21ad2833401c16f609e33271d09a01b07fa90264dca0283d2c2dd5b0b792660
data/README.md CHANGED
@@ -1,10 +1,104 @@
1
- # MarkdownHeadlinesToSvg
1
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/titles.svg" height="55px" alt="# Markdown Titles to .svg for Ruby">
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/markdown_headlines_to_svg`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Headline Generator for ```Github Markdown``` File to generate beautiful ```Google Fonts``` Headlines.
4
+ <br>
5
+ <br>
6
+ <br>
7
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/examples.svg" height="55px" alt="Examples">
4
8
 
5
- TODO: Delete this and the text above, and describe your gem
9
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/examples/20.svg" height="45px">
6
10
 
7
- ## Installation
11
+ ```ruby
12
+ { font__google_fonts__h1__name: "Permanent Marker" }
13
+ ```
14
+
15
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/examples/21.svg" height="45px">
16
+
17
+ ```ruby
18
+ { font__google_fonts__h1__name: "Playfair Display" }
19
+ ```
20
+
21
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/examples/22.svg" height="45px">
22
+
23
+ ```ruby
24
+ { font__google_fonts__h1__name: "Roboto Condensed" }
25
+ ```
26
+
27
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/examples/23.svg" height="45px">
28
+
29
+ ```ruby
30
+ { font__google_fonts__h1__name: "Sarina" }
31
+ ```
32
+
33
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/examples/24.svg" height="45px">
34
+
35
+ ```ruby
36
+ { font__google_fonts__h1__name: "Sonsie One" }
37
+ ```
38
+
39
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/examples/25.svg" height="45px">
40
+
41
+ ```ruby
42
+ { font__google_fonts__h1__name: "Trocchi" }
43
+ ```
44
+
45
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/examples/26.svg" height="45px">
46
+
47
+ ```ruby
48
+ { font__google_fonts__h1__name: "UnifrakturMaguntia" }
49
+ ```
50
+
51
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/examples/27.svg" height="45px">
52
+
53
+ ```ruby
54
+ { font__google_fonts__h1__name: "Zilla Slab Highlight" }
55
+ ```
56
+ <br>
57
+ <br>
58
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/quickstart.svg" height="55px" alt="Quickstart">
59
+
60
+ ### Single Title
61
+ ```ruby
62
+ require 'markdown_titles_to_svg'
63
+
64
+ svg = MarkdownTitlesToSvg.single(
65
+ 'headline',
66
+ :h1,
67
+ {}
68
+ )
69
+ ```
70
+
71
+
72
+ ### Generate from Github Markdown
73
+ ```ruby
74
+ require 'markdown_titles_to_svg'
75
+
76
+ markdowns = [
77
+ 'https://raw.githubusercontent.com/a6b8/a6b8/main/templates/readme.md'
78
+ ]
79
+
80
+ MarkdownTitlesToSvg.generate(
81
+ markdowns,
82
+ 'a6b8',
83
+ {}
84
+ )
85
+ ```
86
+ <br>
87
+ <br>
88
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/demo.svg" height="55px" alt="Demo">
89
+
90
+ **A. Implementation**
91
+ > https://raw.githubusercontent.com/a6b8/a6b8/main/README.md
92
+
93
+
94
+ **B. Execution**
95
+ > https://github.com/a6b8/a6b8/blob/main/titles.sh
96
+
97
+
98
+
99
+ <br>
100
+ <br>
101
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/setup.svg" height="55px" alt="Setup">
8
102
 
9
103
  Add this line to your application's Gemfile:
10
104
 
@@ -20,24 +114,215 @@ Or install it yourself as:
20
114
 
21
115
  $ gem install markdown_headlines_to_svg
22
116
 
23
- ## Usage
117
+ ![](https://ruby-gem-downloads-badge.herokuapp.com/markdown_titles_to_svg?type=total&color=lightgray)
118
+ <br>
119
+ <br>
120
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/process.svg" height="55px" alt="Process">
24
121
 
25
- TODO: Write usage instructions here
122
+ 1. Run Command
123
+ ```txt
124
+ mds = [ PATH_FILE1, PATH_FILE2 ]
125
+ markdown_headlines_to_svg.generate(
126
+ mds,
127
+ "github_profile_name",
128
+ options = {}
129
+ )
26
130
 
27
- ## Development
131
+ ```
28
132
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
133
+ 2. Prepare (Import) Font
134
+ ``` txt
135
+ :h1 :default
136
+ | |
137
+ | mode | mode
138
+ ---------- ----------
139
+ | | | |
140
+ v v v v
141
+ Local Google Fonts Local
142
+ ```
30
143
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
144
+ 3. Scrape Titles
145
+ ``` txt
32
146
 
33
- ## Contributing
147
+ MD_FILE_ 1 QUEUE
148
+ ------------------------------------------------------
149
+ | img src="../a/c/d/1.svg" alt="# Headline 1" ------|------> [ 0 ]
150
+ | |
151
+ | MD_FILE_2 |
152
+ | -----------------------------------------------------
153
+ | | img src="../b/c/d/1.svg" alt="# Headline 2" -----|-> [ 1 ]
154
+ |----| ... |
155
+ | img src="../c/d/e/2.svg" alt="Title 1" ----------|-> [ 2 ]
156
+ | ... |
34
157
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/markdown_headlines_to_svg. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/markdown_headlines_to_svg/blob/master/CODE_OF_CONDUCT.md).
158
+ [ 0 ] { text: 'Headline 1', type: :h1, output: '../a/c/d/1.svg' }
159
+ [ 1 ] { text: 'Headline 2', type: :h1, output: '../b/c/d/1.svg' }
160
+ [ 2 ] { text: 'Title 1', type: :default, output: '../c/d/e/2.svg' }
161
+ ```
36
162
 
37
- ## License
163
+ 4. Add Style and Font Options
38
164
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
165
+ ``` txt
166
+ default
167
+ + user options
168
+ { |
169
+ type: :h1, ---------------------|------------------
170
+ text: 'Headline 1', | |
171
+ output: '../a/c/d/1.svg', V V
172
+ style: <-------------------- options[ :style ][ :h1 ]
173
+ font: <---------------------- options[ :font ][ :h1 ]
174
+ },
175
+ { ...
176
+
177
+ ```
178
+ <br>
179
+ <br>
180
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/functions.svg" height="55px" alt="Functions">
181
+
182
+ ### .get_options()
183
+ Output all Parameter
184
+ ```ruby
185
+ MarkdownTitlesToSvg.get_options()
186
+
187
+ # => { github: { profile: nil, ...
188
+ ```
189
+
190
+ ### .generate( [], '', {} )
191
+ Generate and store of Titles in all Files
192
+ ```ruby
193
+ MarkdownTitlesToSvg.generate(
194
+ markdowns,
195
+ 'a6b8',
196
+ {}
197
+ )
198
+ ```
199
+
200
+ | **Type** | **Required** | **Description** | **Example** | **Description** |
201
+ |------:|:------|:------|:------|:------|
202
+ | **markdowns** | ```Array (of String)``` | Yes | ```[ '/markdown-titles-to-svg/main/README.md' ]``` | Define List of Markup |
203
+ | **github user name** | ```String``` | Yes | ```'a6b8'``` | Set Github User Name |
204
+ | **options** | ```Hash``` | No | ```'a6b8'``` | Change default options, see "options" for more Information. |
205
+
206
+ ### .single( [], '', {} )
207
+ Generate a single Title and outputs a svg string.
208
+ ```ruby
209
+ svg = MarkdownTitlesToSvg.single(
210
+ 'headline',
211
+ :h1,
212
+ {}
213
+ )
214
+
215
+ # => <svg ...
216
+ ```
40
217
 
41
- ## Code of Conduct
218
+ | **Type** | **Required** | **Description** | **Example** | **Description** |
219
+ |------:|:------|:------|:------|:------|
220
+ | **headline** | ```String``` | Yes | ```'headline'``` | Set Text of Headline/Title |
221
+ | **style** | ```Symbol``` | Yes | ```:h1``` | Set type of style, choose between :h1 and :default |
222
+ | **options** | ```Hash``` | No | ```{}``` | Change default options, see "options" for more Information. |
42
223
 
43
- Everyone interacting in the MarkdownHeadlinesToSvg project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/markdown_headlines_to_svg/blob/master/CODE_OF_CONDUCT.md).
224
+ <br>
225
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/options.svg" height="55px" alt="Options">
226
+
227
+ ### Github
228
+ | Nr | Name | Key | Default | Type | Description |
229
+ | :-- | :-- | :-- | :-- | :-- | :-- |
230
+ | A.1. | Source |:github__source | `"https://raw.githubusercontent.com/"` | String | |
231
+
232
+
233
+ ### Font
234
+ | Nr | Name | Key | Default | Type | Description |
235
+ | :-- | :-- | :-- | :-- | :-- | :-- |
236
+ | B.1. | Text_align |:font__text_align | `left` | Symbol | Set aligment of text |
237
+ | B.2. | Bold |:font__bold | `false` | Boolean | Set format of font. If you use Google Fonts try "variant first" |
238
+ | B.3. | Mode H1 |:font__mode__h1 | `:google_fonts` | Symbol | Set mode for Headlines. Choose between ```:local``` and ```:google_fonts``` |
239
+ | B.4. | Mode Default |:font__mode__default | `:google_fonts` | Symbol | Set mode for Titles. Choose between ```:local``` and ```:google_font``` |
240
+
241
+
242
+ #### Import from Local
243
+ | Nr | Name | Key | Default | Type | Description |
244
+ | :-- | :-- | :-- | :-- | :-- | :-- |
245
+ | B.5. | H1 |:font__local__h1 | `"/Library/Fonts/Microsoft/Corbel Bold.ttf"` | String | Set local font for Headline if necessary |
246
+ | B.6. | Default |:font__local__default | `"/Library/Fonts/Microsoft/Consolas.ttf"` | String | String | Set local font for Titles if necessary |
247
+
248
+
249
+ #### Import from "Google Fonts"
250
+ | Nr | Name | Key | Default | Type | Description |
251
+ | :-- | :-- | :-- | :-- | :-- | :-- |
252
+ | B.7. | H1 Name |:font__google_fonts__h1__name | `"Oswald"` | String | Set Google Fonts font name for Headline |
253
+ | B.8. | H1 Variant |:font__google_fonts__h1__variant | `"regular"` | String | Set Google Fonts variant type for headlines |
254
+ | B.9. | H1 Subset |:font__google_fonts__h1__subset | `"latin"` | String | Set Google Fonts subset type for headlines |
255
+ | B.10. | Default Name |:font__google_fonts__default__name | `"Amatic SC"` | String | Set Google Fonts font name for Titles |
256
+ | B.11. | Default Variant |:font__google_fonts__default__variant | `"regular"` | String | Set Google Fonts variant type for titles |
257
+ | B.12. | Default Subset |:font__google_fonts__default__subset | `"latin"` | String | Set Google Fonts subset type for titles |
258
+
259
+ Please use https://google-webfonts-helper.herokuapp.com/fonts to find your favorite Font.
260
+
261
+ ### View
262
+ | Nr | Name | Key | Default | Type | Description |
263
+ | :-- | :-- | :-- | :-- | :-- | :-- |
264
+ | C.1. | Offset Height |:view__offset__height | `0` | Integer | Experimental: Set change View Box height |
265
+ | C.2. | Offset Widht |:view__offset__widht | `0` | Integer | Experimental: Set change View Box width |
266
+
267
+ ### Style
268
+
269
+ #### Headlines
270
+ | Nr | Name | Key | Default | Type | Description |
271
+ | :-- | :-- | :-- | :-- | :-- | :-- |
272
+ | D.1. | Color Opacity |:style__h1__color__opacity | `1.0` | Float | Change Headline color opacity |
273
+ | D.2. | Color Default |:style__h1__color__default | `"#A5834B"` | String | Change Headline fill color |
274
+ | D.3. | Color Palette |:style__h1__color__palette | `[]` | Array | Experimental: Set for each character in headline an other color |
275
+ | D.4. | Stroke Color |:style__h1__stroke__color | `"none"` | String | Change headline fill color of stroke |
276
+ | D.5. | Stroke Width |:style__h1__stroke__width | `"0"` | String | Change headline stroke width |
277
+ | D.6. | Stroke Opacity |:style__h1__stroke__opacity | `1.0` | Float | Change headline stroke opacity |
278
+ | D.7. | Stroke Linecap |:style__h1__stroke__linecap | `"butt"` | String | Change headline stroke width |
279
+
280
+ #### Default
281
+ | Nr | Name | Key | Default | Type | Description |
282
+ | :-- | :-- | :-- | :-- | :-- | :-- |
283
+ | D.8. | Color Opacity |:style__default__color__opacity | `1.0` | Float | Change Title color opacity |
284
+ | D.9. | Color Default |:style__default__color__default | `"#A5834B"` | String | Change Title fill color |
285
+ | D.10. | Color Palette |:style__default__color__palette | `[]` | Array | Experimental: Set for each character in titles an other color |
286
+ | D.11. | Stroke Color |:style__default__stroke__color | `"none"` | String | Change title fill color of stroke |
287
+ | D.12. | Stroke Width |:style__default__stroke__width | `"0"` | String | Change title stroke width |
288
+ | D.13. | Stroke Opacity |:style__default__stroke__opacity | `1.0` | Float | Change title stroke opacity |
289
+ | D.14. | Stroke Linecap |:style__default__stroke__linecap | `"butt"` | String | Change title stroke width |
290
+
291
+ You can find more Information about ```svg``` format here: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/path
292
+
293
+
294
+ ### Other
295
+ | Nr | Name | Key | Default | Type | Description |
296
+ | :-- | :-- | :-- | :-- | :-- | :-- |
297
+ | E.1. | Silent | :silent | `false` | Boolean | Controll console output. |
298
+
299
+ <br>
300
+ <br>
301
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/limitations.svg" height="55px" alt="Limitations">
302
+
303
+ - Font Types are limited to '.ttf' and '.otf'.
304
+ - Read only Markdown Files from Github.
305
+ <br>
306
+ <br>
307
+
308
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/contributing.svg" height="55px" alt="Contributing">
309
+
310
+ Bug reports and pull requests are welcome on GitHub at https://github.com/a6b8/statosio-for-wordpress. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/a6b8/statosio/blob/master/CODE_OF_CONDUCT.md).
311
+ <br>
312
+ <br>
313
+ <br>
314
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/license.svg" height="55px" alt="License">
315
+
316
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
317
+ <br>
318
+ <br>
319
+ <br>
320
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/code-of-conduct.svg" height="55px" alt="Code of Conduct">
321
+
322
+ Everyone interacting in the Statosio project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/a6b8/markdown-titles-to-svg-for-ruby/blob/master/CODE_OF_CONDUCT.md).
323
+ <br>
324
+ <br>
325
+ <br>
326
+ <img src="https://raw.githubusercontent.com/a6b8/a6b8/main/docs/markdown-titles-to-svg-for-ruby/readme/headlines/support-my-work.svg" height="55px" alt="Support my Work">
327
+
328
+ Donate by [https://www.paypal.com](https://www.paypal.com/donate?hosted_button_id=XKYLQ9FBGC4RG)
@@ -22,7 +22,7 @@ module MarkdownTitlesToSvg
22
22
  text_align: :left,
23
23
  bold: false,
24
24
  mode: {
25
- h1: :local,
25
+ h1: :google_fonts,
26
26
  default: :google_fonts
27
27
  },
28
28
  local: {
@@ -56,12 +56,12 @@ module MarkdownTitlesToSvg
56
56
  h1: {
57
57
  color: {
58
58
  opacity: 1.0,
59
- default: '#A5834B',
59
+ default: '#CAD1D8',
60
60
  palette: []
61
61
  },
62
62
  stroke: {
63
63
  color: 'none',
64
- width: '0px',
64
+ width: '0',
65
65
  opacity: 1.0,
66
66
  linecap: 'butt'
67
67
  }
@@ -69,12 +69,12 @@ module MarkdownTitlesToSvg
69
69
  default: {
70
70
  color: {
71
71
  opacity: 1.0,
72
- default: '#A5834B',
72
+ default: '#CAD1D8',
73
73
  palette: []
74
74
  },
75
75
  stroke: {
76
76
  color: 'none',
77
- width: '0px',
77
+ width: '0',
78
78
  opacity: 1.0,
79
79
  linecap: 'butt'
80
80
  }
@@ -89,8 +89,33 @@ module MarkdownTitlesToSvg
89
89
  end
90
90
 
91
91
 
92
+ def self.single( headline, type, options = {})
93
+ svg = nil
94
+ if self.validate_single( headline, type, options, @TEMPLATE )
95
+ obj = self.options_update( options, @TEMPLATE, 'set_options' )
96
+ obj = self.set_fonts( obj )
97
+
98
+ cmd = {}
99
+ cmd[:headline] = headline
100
+ cmd[:type] = type
101
+ svg = self.svg_generate( cmd, obj )
102
+ end
103
+
104
+ obj[:font][:mode].keys.each do | key |
105
+ if obj[:font][:mode][ key ] == :google_fonts
106
+ if ( Time.now.getutc.to_i - obj[:font][:current][ key ].split( '-' )[ 1 ].to_i ) < 30
107
+ if File.basename( obj[:font][:current][ key ] ) .start_with?( key.to_s )
108
+ File.delete( obj[:font][:current][ key ] )
109
+ end
110
+ end
111
+ end
112
+ end
113
+ return svg
114
+ end
115
+
116
+
92
117
  def self.generate( markdowns, gh_name, options = {} )
93
- if self.validate( markdowns, gh_name, options, @TEMPLATE )
118
+ if self.validate_generate( markdowns, gh_name, options, @TEMPLATE )
94
119
  obj = self.options_update( options, @TEMPLATE, 'set_options' )
95
120
  obj[:github][:profile] = gh_name
96
121
  obj = self.set_fonts( obj )
@@ -101,7 +126,7 @@ module MarkdownTitlesToSvg
101
126
  cmds.each do | cmd |
102
127
  svg = self.svg_generate( cmd, obj )
103
128
  FileUtils.mkdir_p ( File.dirname( cmd[:path] ) )
104
- File.open( cmd[:path], "w" ) { | f | f.write( svg ) }
129
+ File.open( cmd[:path], 'w' ) { | f | f.write( svg ) }
105
130
  end
106
131
 
107
132
  obj[:font][:mode].keys.each do | key |
@@ -191,7 +216,7 @@ module MarkdownTitlesToSvg
191
216
  .min_by { | h | h[:score] }
192
217
 
193
218
  font = fonts_subset
194
- .find { | a | a["id"].eql? id[:name] }
219
+ .find { | a | a["id"].eql?( id[:name] ) }
195
220
 
196
221
  variant = font['variants']
197
222
  .map { | a | { name: a, score: self.str_difference( style.to_s, a.to_s ) } }
@@ -215,7 +240,53 @@ module MarkdownTitlesToSvg
215
240
  end
216
241
 
217
242
 
218
- def self.validate( markdowns, gh_name, vars, template )
243
+ def self.validate_single( headline, type, vars, template )
244
+ messages = {
245
+ headline:[],
246
+ type:[],
247
+ options:[]
248
+ }
249
+ if headline.class.to_s.eql?( 'String' )
250
+ else
251
+ messages[:headline].push( 'Is not Type "String"')
252
+ end
253
+
254
+ if type.class.to_s.eql?( 'Symbol' )
255
+ if [ :h1, :default ].include? type
256
+ else
257
+ messages[:type].push( 'Input is not :h1 or :default' )
258
+ end
259
+ else
260
+ messages[:type].push( 'Is not Type "Symbol"' )
261
+ end
262
+
263
+ if vars.class.to_s == 'Hash'
264
+ messages[:options] = self.options_update( vars, template, 'check_options' )
265
+ else
266
+ messages[:options].push( 'Is not Type "Hash".')
267
+ end
268
+
269
+
270
+ valid = messages.keys.map { | key | messages[ key ].length }.sum == 0
271
+
272
+ if !valid
273
+ puts 'Following errors occured:'
274
+ messages.keys.each do | key |
275
+ if messages[ key ].length != 0
276
+
277
+ puts " #{key[ 0, 1 ].upcase}#{key[ 1, key.length ]}"
278
+ messages[ key ].each do | m |
279
+ puts " - #{m}"
280
+ end
281
+ end
282
+ end
283
+ end
284
+
285
+ return valid
286
+ end
287
+
288
+
289
+ def self.validate_generate( markdowns, gh_name, vars, template )
219
290
  messages = {
220
291
  markdowns: [],
221
292
  github: [],
@@ -224,7 +295,7 @@ module MarkdownTitlesToSvg
224
295
  }
225
296
 
226
297
  #begin
227
- if markdowns.class.to_s.eql? 'Array'
298
+ if markdowns.class.to_s.eql?( 'Array' )
228
299
  if markdowns.map { | a | a.start_with?( template[:github][:source] ) }.all?
229
300
  if markdowns.map { | a | a.end_with?( '.md' ) }.all?
230
301
 
@@ -238,8 +309,8 @@ module MarkdownTitlesToSvg
238
309
  messages[:markdowns].push( 'Is not Type "Array" or "String".' )
239
310
  end
240
311
 
241
- if gh_name.class.to_s.eql? 'String'
242
- if !gh_name.eql? ''
312
+ if gh_name.class.to_s.eql?( 'String' )
313
+ if !gh_name.eql?( '' )
243
314
 
244
315
  else
245
316
  messages[:github].push( "Github Name is required." )
@@ -284,6 +355,8 @@ module MarkdownTitlesToSvg
284
355
  :font__bold,
285
356
  :font__mode__h1,
286
357
  :font__mode__default,
358
+ :font__local__h1,
359
+ :font__local__default,
287
360
  :font__google_fonts__h1__name,
288
361
  :font__google_fonts__h1__variant,
289
362
  :font__google_fonts__h1__subset,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MarkdownTitlesToSvg
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.9"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_titles_to_svg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - a6b8
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-18 00:00:00.000000000 Z
11
+ date: 2021-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: text2svg
@@ -101,7 +101,6 @@ files:
101
101
  - bin/setup
102
102
  - lib/markdown_titles_to_svg.rb
103
103
  - lib/markdown_titles_to_svg/version.rb
104
- - markdown_titles_to_svg-0.1.3.gem
105
104
  - markdown_titles_to_svg.gemspec
106
105
  homepage: https://github.com/a6b8/markdown-titles-to-svg-for-ruby
107
106
  licenses:
Binary file