trekyll 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/trekyll/core_ext/string.rb +3 -3
- data/lib/trekyll/navigation_manager.rb +1 -1
- data/lib/trekyll/trello_get.rb +77 -13
- data/lib/trekyll/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b54e678739f77ed2785e490a371da0265afd435
|
4
|
+
data.tar.gz: 69b21e08a499bb423645cc2baf3b47bd6b4c3dde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca96a57d46d9cc77063044ea91e0d4f0a3947fcf42d46303a39d02bca1abc5043c56fffb205adce0fd866904150c4ea37a2f5ff2aca7f9ceaac1d27ebdc5f12e
|
7
|
+
data.tar.gz: 6e9116577873d7f3f2ba087cf64fca35fb9ef09313764597d42b6defe0881166fd65ac4098075d08a344a4245b9d81ab8d7d6bc3cb31b09ed0a6cce71bfa4f4a
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Welcome to Trekyll. Trekyll is Jekyll plugin which enables you to use Trello board as CMS backend.
|
4
4
|
|
5
|
-
*Note: Currently tested with Jekyll 3.
|
5
|
+
*Note: Currently tested with Jekyll 3.6.0 and custom Jekyll themes
|
6
6
|
|
7
7
|
## Installation:
|
8
8
|
|
@@ -14,7 +14,7 @@ Copy this code and save it as "Gemfile":
|
|
14
14
|
source "https://rubygems.org"
|
15
15
|
ruby RUBY_VERSION
|
16
16
|
|
17
|
-
gem "jekyll", "3.
|
17
|
+
gem "jekyll", "3.6.0"
|
18
18
|
|
19
19
|
group :jekyll_plugins do
|
20
20
|
gem "jekyll-feed", "~> 0.6"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class String
|
2
2
|
def sanitize_as_page_title
|
3
|
-
self.gsub(/[^
|
3
|
+
self.gsub(/[^[:alnum:] ]/, '').bytes.each_char.select{|c| c.bytes.count < 4 }.join('').gsub('/[#].#\p{L}/','').to_s
|
4
4
|
end
|
5
5
|
def sanitize_as_page_name
|
6
|
-
self.downcase.gsub(/[^
|
6
|
+
self.downcase.gsub(/[^[:alnum:] ]/, '').gsub(" ",'_').unicode_normalize(:nfkd).gsub(/[^\x00-\x7F]/,'')
|
7
7
|
end
|
8
8
|
def sanitize_as_post_name
|
9
|
-
self.downcase.gsub(/[^
|
9
|
+
self.downcase.gsub(/[^[:alnum:] ]/, '').gsub(" ",'-').unicode_normalize(:nfkd).gsub(/[^\x00-\x7F]/,'')
|
10
10
|
end
|
11
11
|
end
|
data/lib/trekyll/trello_get.rb
CHANGED
@@ -107,6 +107,49 @@ module Trekyll
|
|
107
107
|
puts "Page cover image: #{cover_image_url} " if cover_image_url != ""
|
108
108
|
end
|
109
109
|
|
110
|
+
|
111
|
+
# TODO: Create Module for Custom Fields: #
|
112
|
+
# get_board_fields(board) #
|
113
|
+
# get_card_fields(board_fields, card) #
|
114
|
+
# get_card_layout(board_fields, card) #
|
115
|
+
# #
|
116
|
+
# Get card plugin custom fields values (Hash)
|
117
|
+
card_field_values = ""
|
118
|
+
unless card.plugin_data.nil? then
|
119
|
+
card_plugin = card.plugin_data
|
120
|
+
card_plugin.each do |plugin|
|
121
|
+
plugin.value.map {|k,v| card_field_values = v}
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Custom fields for printing in .md file
|
126
|
+
custom_fields = ""
|
127
|
+
layout = "page"
|
128
|
+
unless card.plugin_data.nil? then
|
129
|
+
custom_fields = board_custom_fields.map do |field|
|
130
|
+
# if field type is: text, number, checkbox, date
|
131
|
+
if (0..3) === field["t"]
|
132
|
+
"#{field["n"]}: \"#{card_field_values[field["id"]]}\""
|
133
|
+
# if field type is: dropdown list
|
134
|
+
elsif field["t"] === 4
|
135
|
+
# if field name is layout set layout variable
|
136
|
+
if field["n"] == "layout"
|
137
|
+
drpdwn_id = card_field_values[field["id"]]
|
138
|
+
hash_with_val = field["o"].find {|element| element["id"] === drpdwn_id}
|
139
|
+
if hash_with_val != nil
|
140
|
+
layout = hash_with_val["value"]
|
141
|
+
next
|
142
|
+
end
|
143
|
+
|
144
|
+
else
|
145
|
+
drpdwn_id = card_field_values[field["id"]]
|
146
|
+
hash_with_val = field["o"].find {|element| element["id"] === drpdwn_id}
|
147
|
+
"#{field["n"]}: \"#{hash_with_val["value"]}\"" if hash_with_val != nil
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
110
153
|
# Write data to a file
|
111
154
|
|
112
155
|
page_file = "#{f_name}.md"
|
@@ -118,13 +161,14 @@ module Trekyll
|
|
118
161
|
|
119
162
|
template.puts <<~DOC.gsub(/\t/, '')
|
120
163
|
---
|
121
|
-
layout:
|
164
|
+
layout: #{layout}
|
122
165
|
type: #{page_type}
|
123
|
-
title: "#{page_name
|
166
|
+
title: "#{page_name}"
|
124
167
|
date: #{card.created_at}
|
125
168
|
cover: "#{cover_image_url}"
|
126
169
|
weight: #{counter}
|
127
170
|
permalink: /#{f_name}/
|
171
|
+
#{custom_fields.join("\n")}
|
128
172
|
---
|
129
173
|
DOC
|
130
174
|
template.puts "#{content}"
|
@@ -230,6 +274,11 @@ module Trekyll
|
|
230
274
|
|
231
275
|
end
|
232
276
|
|
277
|
+
# TODO: Create Module for Custom Fields: #
|
278
|
+
# get_board_fields(board) #
|
279
|
+
# get_card_fields(board_fields, card) #
|
280
|
+
# get_card_layout(board_fields, card) #
|
281
|
+
# #
|
233
282
|
# Get card plugin custom fields values (Hash)
|
234
283
|
card_field_values = ""
|
235
284
|
unless card.plugin_data.nil? then
|
@@ -240,15 +289,30 @@ module Trekyll
|
|
240
289
|
end
|
241
290
|
|
242
291
|
# Custom fields for printing in .md file
|
243
|
-
custom_fields =
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
292
|
+
custom_fields = ""
|
293
|
+
layout = "post"
|
294
|
+
unless card.plugin_data.nil? then
|
295
|
+
custom_fields = board_custom_fields.map do |field|
|
296
|
+
# if field type is: text, number, checkbox, date
|
297
|
+
if (0..3) === field["t"]
|
298
|
+
"#{field["n"]}: \"#{card_field_values[field["id"]]}\""
|
299
|
+
# if field type is: dropdown list
|
300
|
+
elsif field["t"] === 4
|
301
|
+
# if field name is layout set layout variable
|
302
|
+
if field["n"] == "layout"
|
303
|
+
drpdwn_id = card_field_values[field["id"]]
|
304
|
+
hash_with_val = field["o"].find {|element| element["id"] === drpdwn_id}
|
305
|
+
if hash_with_val != nil
|
306
|
+
layout = hash_with_val["value"]
|
307
|
+
next
|
308
|
+
end
|
309
|
+
|
310
|
+
else
|
311
|
+
drpdwn_id = card_field_values[field["id"]]
|
312
|
+
hash_with_val = field["o"].find {|element| element["id"] === drpdwn_id}
|
313
|
+
"#{field["n"]}: \"#{hash_with_val["value"]}\"" if hash_with_val != nil
|
314
|
+
end
|
315
|
+
end
|
252
316
|
end
|
253
317
|
end
|
254
318
|
|
@@ -260,7 +324,7 @@ module Trekyll
|
|
260
324
|
#Write data into file
|
261
325
|
template.puts <<~DOC.gsub(/\t/, '')
|
262
326
|
---
|
263
|
-
layout:
|
327
|
+
layout: #{layout}
|
264
328
|
cover: "#{cover_image_url}"
|
265
329
|
title: #{card.name}
|
266
330
|
date: #{card.created_at}
|
@@ -275,4 +339,4 @@ module Trekyll
|
|
275
339
|
end
|
276
340
|
return true
|
277
341
|
end
|
278
|
-
end
|
342
|
+
end
|
data/lib/trekyll/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Canic Interactive
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trelloapi
|