no-style-please2-plugins 0.4.0 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -5
- data/gem.gemspec +1 -1
- data/lib/ext.rb +48 -3
- data/lib/version/version.rb +1 -1
- data/test.rb +16 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9f4f4a41d85064307365636096162753cb141b2832a40825c7aa90f38ee399c
|
4
|
+
data.tar.gz: 87a751e6931d4a02d7c995eb026f8b8d2a9f81a532a842a7ddbfa1ca4ca4a73a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d373db5377ec0dc015cab2fb94cfd14d2695e970089a062bc73741f9e2119cb40e55b465071b68713fc50047b471ba0857509822ed15e4f3337bb60f35190b38
|
7
|
+
data.tar.gz: 944d77a182c0644d635d89e0e8ab083a4a3a72b54b80e32aa711ea08fe7f805a09a6ff4bf14e74c0de8753f783cef7cf0dd123ae28b4526a98773b76195951a3
|
data/README.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
|
-
# No::Style::Please2::Plugins
|
2
1
|
|
3
|
-
|
2
|
+
this is jekyll plugin for no-style-please2 theme
|
4
3
|
|
5
|
-
|
4
|
+
## Feature
|
5
|
+
+ tag support, this plugin will create tag page if you add tags in your post
|
6
|
+
+ liquid tags
|
7
|
+
+ post_link ,link to post via title
|
8
|
+
+ img_link ,link to a image
|
9
|
+
+ asset_img insert a picture into the post content
|
10
|
+
+ encryption support. encrypt the post content. you can set password for tag, or set a password in the post front matter. password will be encrypted by ECC cryption.
|
6
11
|
|
7
12
|
## Installation
|
8
13
|
|
@@ -16,7 +21,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
16
21
|
|
17
22
|
## Usage
|
18
23
|
|
19
|
-
|
24
|
+
see this [demo](https://vitock.ink/no-style-please-demo/)
|
20
25
|
|
21
26
|
## Development
|
22
27
|
|
@@ -26,4 +31,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
26
31
|
|
27
32
|
## Contributing
|
28
33
|
|
29
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/vitock/no-style-please2-plugins.
|
data/gem.gemspec
CHANGED
data/lib/ext.rb
CHANGED
@@ -27,7 +27,50 @@ module Jekyll
|
|
27
27
|
|
28
28
|
|
29
29
|
def initialize(tag_name, text, tokens)
|
30
|
-
|
30
|
+
arr = text.strip.split(" ")
|
31
|
+
@img_name = arr[0]
|
32
|
+
@img_width = nil
|
33
|
+
if arr.count > 1
|
34
|
+
@img_width = arr[1]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def render(context)
|
39
|
+
path = context['page']['path']
|
40
|
+
|
41
|
+
|
42
|
+
dirPath0 = path[0...(path.length - 3)]
|
43
|
+
pathComponent = dirPath0.split("/")
|
44
|
+
dirPath = pathComponent[-1]
|
45
|
+
|
46
|
+
base = $g_config['baseurl']
|
47
|
+
link = "/pics/#{dirPath}/#{@img_name}"
|
48
|
+
if base && base.length
|
49
|
+
link = "#{base}/pics/#{dirPath}/#{@img_name}"
|
50
|
+
end
|
51
|
+
|
52
|
+
if @img_width != nil
|
53
|
+
return "<img src='#{link}' style='width:#{@img_width}px'>"
|
54
|
+
else
|
55
|
+
return "![](#{link})"
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
class ImgLink < Liquid::Tag
|
63
|
+
|
64
|
+
|
65
|
+
def initialize(tag_name, text, tokens)
|
66
|
+
arr = text.strip.split(' ',2)
|
67
|
+
if arr.count == 2
|
68
|
+
@img_name = arr[1]
|
69
|
+
@title = arr[0]
|
70
|
+
else
|
71
|
+
@img_name = arr[0]
|
72
|
+
@title = "img_link"
|
73
|
+
end
|
31
74
|
end
|
32
75
|
|
33
76
|
def render(context)
|
@@ -43,7 +86,7 @@ module Jekyll
|
|
43
86
|
if base && base.length
|
44
87
|
link = "#{base}/pics/#{dirPath}/#{@img_name}"
|
45
88
|
end
|
46
|
-
return "
|
89
|
+
return "[#{@title}](#{link})"
|
47
90
|
end
|
48
91
|
end
|
49
92
|
|
@@ -78,7 +121,6 @@ module Jekyll
|
|
78
121
|
end
|
79
122
|
end
|
80
123
|
end
|
81
|
-
|
82
124
|
|
83
125
|
|
84
126
|
class IncludeCode < Liquid::Tag
|
@@ -117,6 +159,9 @@ EOF
|
|
117
159
|
Liquid::Template.register_tag('asset_img', Jekyll::AssetImg)
|
118
160
|
Liquid::Template.register_tag('include_code', Jekyll::IncludeCode)
|
119
161
|
Liquid::Template.register_tag('post_link', Jekyll::PostLink)
|
162
|
+
Liquid::Template.register_tag('img_link', Jekyll::ImgLink)
|
163
|
+
|
164
|
+
|
120
165
|
|
121
166
|
|
122
167
|
|
data/lib/version/version.rb
CHANGED
data/test.rb
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require "ltec"
|
3
|
-
require "nostyleplease2plugins"
|
2
|
+
# require "ltec"
|
3
|
+
# require "nostyleplease2plugins"
|
4
4
|
|
5
|
-
Jekyll::test
|
6
|
-
|
5
|
+
# Jekyll::test
|
6
|
+
|
7
|
+
a = '12-3 a 3 3'
|
8
|
+
b = a.split('x')
|
9
|
+
z = nil;
|
10
|
+
if z
|
11
|
+
puts 333
|
12
|
+
else
|
13
|
+
puts 44
|
14
|
+
end
|
15
|
+
puts b
|
16
|
+
puts b[0]
|
17
|
+
z = 333
|
18
|
+
puts "<img src='#{z}' style='width:#{z}px'>"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: no-style-please2-plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vitock
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ltec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|