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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf996d77df39291ad019286081804980c02d5a7108f6871fd4f8d2e71537ffb9
4
- data.tar.gz: 500d3f1c6a7a892abdd14e6324d305628b026ae8b99627504c1bdae3f29b8b14
3
+ metadata.gz: e9f4f4a41d85064307365636096162753cb141b2832a40825c7aa90f38ee399c
4
+ data.tar.gz: 87a751e6931d4a02d7c995eb026f8b8d2a9f81a532a842a7ddbfa1ca4ca4a73a
5
5
  SHA512:
6
- metadata.gz: a67a9670612597e655cd8bc5515b2d93f434c885a5fcc36b6ff9ff79f37e9fdc058896fbb2e661c9ee30f95359d69e51bcae9438429dabcec82fa7842c861549
7
- data.tar.gz: a05a7cf2d23f6d2830f83f2cc98f0f3c5c60b464054084eb469f96cf8eed735d1ce56387d5ae954a712b5c8fef92f155975d9185bc7269f45e06319f755c7881
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
- 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/no/style/please2/plugins`. To experiment with that code, run `bin/console` for an interactive prompt.
2
+ this is jekyll plugin for no-style-please2 theme
4
3
 
5
- TODO: Delete this and the text above, and describe your gem
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
- TODO: Write usage instructions here
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/[USERNAME]/no-style-please2-plugins.
34
+ Bug reports and pull requests are welcome on GitHub at https://github.com/vitock/no-style-please2-plugins.
data/gem.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
 
33
33
 
34
34
 
35
- spec.add_dependency "jekyll", "~>4.2.0"
35
+ spec.add_dependency "jekyll", "~>4.0"
36
36
  spec.add_dependency "ltec", "~> 0.1.2"
37
37
  spec.add_dependency "salsa20", "~> 0.1.3"
38
38
  spec.add_dependency "digest"
data/lib/ext.rb CHANGED
@@ -27,7 +27,50 @@ module Jekyll
27
27
 
28
28
 
29
29
  def initialize(tag_name, text, tokens)
30
- @img_name = text.strip
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 "![](#{link})"
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NoStylePlease2
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.3"
5
5
  end
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.0
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-05-21 00:00:00.000000000 Z
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.2.0
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.2.0
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ltec
29
29
  requirement: !ruby/object:Gem::Requirement