jekyll-koziolekweb-tags 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +10 -0
- data/README.md +75 -0
- data/Rakefile +4 -0
- data/lib/jekyll/koziolekweb/tags/version.rb +9 -0
- data/lib/jekyll/koziolekweb/tags.rb +56 -0
- data/sig/jekyll/koziolekweb/tags.rbs +8 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ce633e08c9c757a2af4a2f8058620ffc3f91c896097297046d6f40ce5b065e83
|
4
|
+
data.tar.gz: b3b81fe9441a1cfe89acd189a0b6e4c831b9a16d09c19abf9fe1ed7c6a5cfe41
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6dba95f4e83f2fb79caddcc5f716133bd84f00f1279cb3f0bb97ffa58b1957613284e159214b90c20edfd40240bce1eebd4a83eb3ca664ffe874aeec91ae87ae
|
7
|
+
data.tar.gz: 22b37801ec6c35b3b07457e34cbff6b9ce2a85e846bc437401094fcd54e5c7b1ec655a91c5750f171fac0f47cf20d6fb7a4d62258d00e96b31b05d956258b25c
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# Jekyll::Koziolekweb::Tags
|
2
|
+
|
3
|
+
This is set of jekyll tags that I use on my blog. It helps generate some specific content like listings of code or aside notes.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
8
|
+
|
9
|
+
$ bundle add jekyll-koziolekweb-tags
|
10
|
+
|
11
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
12
|
+
|
13
|
+
$ gem install jekyll-koziolekweb-tags
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
There are few block tags that you can use.
|
18
|
+
|
19
|
+
### offtopic
|
20
|
+
|
21
|
+
If you put
|
22
|
+
|
23
|
+
```
|
24
|
+
{% offtopic DIRECTION %}
|
25
|
+
Your text goes here
|
26
|
+
{% endofftopic %}
|
27
|
+
```
|
28
|
+
|
29
|
+
in md file, then it will generate:
|
30
|
+
|
31
|
+
```html
|
32
|
+
|
33
|
+
<aside class="offtopic f-DIRECTION">
|
34
|
+
Your text goes here
|
35
|
+
</aside>
|
36
|
+
```
|
37
|
+
|
38
|
+
I don't want to suggest anything abut css, but:
|
39
|
+
|
40
|
+
* `offtopic` class should define most of layout
|
41
|
+
* `f-DIRECTION` class should define `float` behaviour
|
42
|
+
|
43
|
+
### listing
|
44
|
+
|
45
|
+
If you put
|
46
|
+
|
47
|
+
```
|
48
|
+
{% listing LANG 'TITLE' %}
|
49
|
+
Your code goes here
|
50
|
+
{% endlisting %}
|
51
|
+
```
|
52
|
+
|
53
|
+
in md file, then it will generate:
|
54
|
+
|
55
|
+
```html
|
56
|
+
<p class="listing">Listing X. TITLE</p>
|
57
|
+
\`\`\`LANG
|
58
|
+
Your code goes here
|
59
|
+
\`\`\`
|
60
|
+
```
|
61
|
+
|
62
|
+
and finally it will be processed by markdown engine to final form. `X` is an number of listing, starts from 1 and work in post context.
|
63
|
+
|
64
|
+
## Development
|
65
|
+
|
66
|
+
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
|
67
|
+
experiment.
|
68
|
+
|
69
|
+
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
|
70
|
+
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
|
71
|
+
to [rubygems.org](https://rubygems.org).
|
72
|
+
|
73
|
+
## Contributing
|
74
|
+
|
75
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Koziolek/jekyll-koziolekweb-tags.
|
data/Rakefile
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "tags/version"
|
4
|
+
|
5
|
+
module Koziolekweb
|
6
|
+
module Tags
|
7
|
+
class Listing < Liquid::Block
|
8
|
+
@@file_state = {}
|
9
|
+
|
10
|
+
def initialize(tag_name, markup, tokens)
|
11
|
+
super
|
12
|
+
|
13
|
+
matched = /(\w+)\s+["'](.*?)["']/.match(markup)
|
14
|
+
|
15
|
+
if matched
|
16
|
+
@lang = matched[1]
|
17
|
+
@title = matched[2]
|
18
|
+
else
|
19
|
+
raise SyntaxError.new("
|
20
|
+
Invalid parameters for listing. Usage:
|
21
|
+
{% listing lang 'title' %}
|
22
|
+
code goes here
|
23
|
+
{% endlisting %}
|
24
|
+
got
|
25
|
+
#{markup}")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def render(context)
|
30
|
+
current_file = context.registers[:page]["path"]
|
31
|
+
@@file_state[current_file] ||= 0
|
32
|
+
@@file_state[current_file] += 1
|
33
|
+
content = super
|
34
|
+
content_with_code_fence = "```#{@lang} #{content}```"
|
35
|
+
|
36
|
+
"<p class='listing'> Listing #{@@file_state[current_file]}. #{@title}</p>#{content_with_code_fence}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class Offtop < Liquid::Block
|
41
|
+
|
42
|
+
def initialize(tag_name, markup, tokens)
|
43
|
+
super
|
44
|
+
@direction = markup
|
45
|
+
end
|
46
|
+
|
47
|
+
def render(context)
|
48
|
+
content = super
|
49
|
+
"<aside class=\"offtopic f-#{@direction}\">#{content}</aside>"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
Liquid::Template.register_tag('listing', Koziolekweb::Tags::Listing)
|
56
|
+
Liquid::Template.register_tag('offtop', Koziolekweb::Tags::Offtop)
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-koziolekweb-tags
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Koziolek
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-10-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.7'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.7'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
33
|
+
description: Here you will find a set of tags that allow you to create code listings
|
34
|
+
with numbering, notes using the <aside> element and more.
|
35
|
+
email:
|
36
|
+
- bjkuczynski@gmail.com
|
37
|
+
executables: []
|
38
|
+
extensions: []
|
39
|
+
extra_rdoc_files: []
|
40
|
+
files:
|
41
|
+
- CHANGELOG.md
|
42
|
+
- Gemfile
|
43
|
+
- README.md
|
44
|
+
- Rakefile
|
45
|
+
- lib/jekyll/koziolekweb/tags.rb
|
46
|
+
- lib/jekyll/koziolekweb/tags/version.rb
|
47
|
+
- sig/jekyll/koziolekweb/tags.rbs
|
48
|
+
homepage: https://github.com/Koziolek/jekyll-koziolekweb-tags
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata:
|
52
|
+
source_code_uri: https://github.com/Koziolek/jekyll-koziolekweb-tags
|
53
|
+
changelog_uri: https://github.com/Koziolek/jekyll-koziolekweb-tags/CHANGELOG.md
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.4.0
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
requirements: []
|
69
|
+
rubygems_version: 3.3.4
|
70
|
+
signing_key:
|
71
|
+
specification_version: 4
|
72
|
+
summary: Set of structural tags that helps to organise article.
|
73
|
+
test_files: []
|