jekyll_outline 1.2.0 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +39 -16
- data/CHANGELOG.md +38 -9
- data/README.md +85 -34
- data/jekyll_outline.gemspec +2 -2
- data/lib/jekyll_outline/version.rb +1 -1
- data/lib/jekyll_outline.rb +2 -2
- data/lib/outline_js.rb +1 -1
- data/lib/outline_tag.rb +65 -13
- data/spec/outline_spec.rb +2 -5
- data/spec/spec_helper.rb +1 -2
- data/spec/status_persistence.txt +3 -3
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b279fb946cc9cd5d5fc092680a1f28c2af772dc2daa319a4d3c82f4946d5c731
|
4
|
+
data.tar.gz: 0e1f714175edd37e7b06f07f499891d365dbb2ed01d2fe90923a54d6cac613b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4811c7012c0ab9fc504906886a29b4e27d83073f2a079d1cc7e1c9dcdec25acc14da1559e0b940556ba994e2edba45cfb510866c205829d92085a5fd936a02e2
|
7
|
+
data.tar.gz: b79734ebe03d8facc9034e6be26bacf038609f74b9cfca6611297f16f90891f8c12dc9a88c3b6e82d00d8656f4ba24dd33ec2d46ccefa5173fa05f750b061948
|
data/.rubocop.yml
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
require:
|
2
|
-
- rubocop-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
# - rubocop-jekyll
|
3
|
+
- rubocop-md
|
4
|
+
- rubocop-performance
|
5
|
+
- rubocop-rake
|
6
|
+
- rubocop-rspec
|
6
7
|
|
7
8
|
AllCops:
|
8
9
|
Exclude:
|
9
|
-
-
|
10
|
+
- binstub/**/*
|
11
|
+
- demo/_site/*
|
10
12
|
- vendor/**/*
|
11
13
|
- Gemfile*
|
12
14
|
NewCops: enable
|
13
|
-
TargetRubyVersion: 2.6
|
14
15
|
|
15
16
|
Gemspec/DeprecatedAttributeAssignment:
|
16
17
|
Enabled: false
|
@@ -18,6 +19,9 @@ Gemspec/DeprecatedAttributeAssignment:
|
|
18
19
|
Gemspec/RequireMFA:
|
19
20
|
Enabled: false
|
20
21
|
|
22
|
+
Gemspec/RequiredRubyVersion:
|
23
|
+
Enabled: false
|
24
|
+
|
21
25
|
Layout/HashAlignment:
|
22
26
|
EnforcedColonStyle: table
|
23
27
|
EnforcedHashRocketStyle: table
|
@@ -26,25 +30,45 @@ Layout/LineLength:
|
|
26
30
|
Max: 150
|
27
31
|
|
28
32
|
Metrics/AbcSize:
|
29
|
-
Max:
|
33
|
+
Max: 55
|
30
34
|
|
31
35
|
Metrics/BlockLength:
|
32
36
|
Exclude:
|
33
|
-
-
|
34
|
-
Max:
|
37
|
+
- jekyll_plugin_support.gemspec
|
38
|
+
Max: 30
|
35
39
|
|
36
40
|
Metrics/CyclomaticComplexity:
|
37
|
-
Max:
|
41
|
+
Max: 25
|
38
42
|
|
39
43
|
Metrics/MethodLength:
|
40
|
-
Max:
|
44
|
+
Max: 50
|
41
45
|
|
42
46
|
Metrics/PerceivedComplexity:
|
43
|
-
Max:
|
47
|
+
Max: 25
|
44
48
|
|
45
49
|
Naming/FileName:
|
46
50
|
Exclude:
|
47
51
|
- Rakefile
|
52
|
+
- "*.md"
|
53
|
+
|
54
|
+
RSpec/ExampleLength:
|
55
|
+
Max: 30
|
56
|
+
|
57
|
+
RSpec/SpecFilePathFormat:
|
58
|
+
Enabled: false
|
59
|
+
IgnoreMethods: true
|
60
|
+
|
61
|
+
RSpec/SpecFilePathSuffix:
|
62
|
+
Enabled: false
|
63
|
+
|
64
|
+
RSpec/IndexedLet:
|
65
|
+
Enabled: false
|
66
|
+
|
67
|
+
RSpec/MultipleExpectations:
|
68
|
+
Max: 15
|
69
|
+
|
70
|
+
Style/ClassVars:
|
71
|
+
Enabled: false
|
48
72
|
|
49
73
|
Style/Documentation:
|
50
74
|
Enabled: false
|
@@ -52,9 +76,8 @@ Style/Documentation:
|
|
52
76
|
Style/FrozenStringLiteralComment:
|
53
77
|
Enabled: false
|
54
78
|
|
79
|
+
Style/StringConcatenation:
|
80
|
+
Enabled: false
|
81
|
+
|
55
82
|
Style/TrailingCommaInHashLiteral:
|
56
83
|
EnforcedStyleForMultiline: comma
|
57
|
-
|
58
|
-
RSpec/FilePath:
|
59
|
-
IgnoreMethods: true
|
60
|
-
SpecSuffixOnly: true
|
data/CHANGELOG.md
CHANGED
@@ -1,20 +1,49 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## 1.2.3 / 2024-07-23
|
4
|
+
|
5
|
+
* Made compatible with jekyll_plugin_support v1.0.0
|
6
|
+
|
7
|
+
|
8
|
+
## 1.2.2 / 2024-01-08
|
9
|
+
|
10
|
+
* Added `sort_by_title` keyword option.
|
11
|
+
|
12
|
+
|
13
|
+
## 1.2.1 / 2023-06-17
|
14
|
+
|
15
|
+
* Updated dependencies.
|
16
|
+
* No longer explodes when a value for `order` is not provided in front matter.
|
17
|
+
|
18
|
+
|
1
19
|
## 1.2.0 / 2023-04-23
|
2
|
-
|
20
|
+
|
21
|
+
* Added optional `field` parameter.
|
22
|
+
|
3
23
|
|
4
24
|
## 1.1.1 / 2023-04-02
|
5
|
-
|
25
|
+
|
26
|
+
* Added [`attribution` support](https://github.com/mslinn/jekyll_plugin_support#subclass-attribution).
|
27
|
+
|
6
28
|
|
7
29
|
## 1.1.0 / 2023-03-14
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
30
|
+
|
31
|
+
* `outline_js` tag added, for including Javascript necessary to position images relating to the outline.
|
32
|
+
* Now generates a series of divs, instead of one big div.
|
33
|
+
* Now interprets numbers as decimal instead of octal.
|
34
|
+
* CSS documented and new `post_title` class defined.
|
35
|
+
|
12
36
|
|
13
37
|
## 1.0.2 / 2023-02-16
|
14
|
-
|
38
|
+
|
39
|
+
* Updated to `jekyll_plugin_support` v0.5.1
|
40
|
+
|
15
41
|
|
16
42
|
## 1.0.1 / 2023-02-14
|
17
|
-
|
43
|
+
|
44
|
+
* Now dependent upon `jekyll_plugin_support`
|
45
|
+
|
18
46
|
|
19
47
|
## 1.0.0 / 2022-04-02
|
20
|
-
|
48
|
+
|
49
|
+
* Initial version, this Jekyll plugin defines a block tag called `outline`.
|
data/README.md
CHANGED
@@ -1,11 +1,35 @@
|
|
1
|
-
`jekyll_outline`
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/jekyll_outline.svg)](https://badge.fury.io/rb/jekyll_outline)
|
3
|
-
===========
|
1
|
+
# `jekyll_outline` [![Gem Version](https://badge.fury.io/rb/jekyll_outline.svg)](https://badge.fury.io/rb/jekyll_outline)
|
4
2
|
|
5
3
|
`jekyll_outline` Jekyll tag plugin that creates a clickable table of contents.
|
6
4
|
|
7
5
|
|
6
|
+
## Usage
|
7
|
+
|
8
|
+
These examples are taken from [`demo/index.html`](demo/index.html).
|
9
|
+
|
10
|
+
Sort by `order` field:
|
11
|
+
|
12
|
+
```html
|
13
|
+
{% outline attribution fields="<b> title </b> – <i> description </i>" stuff %}
|
14
|
+
000: A Topic 0..19
|
15
|
+
020: A Topic 20..39
|
16
|
+
040: A Topic 40..
|
17
|
+
{% endoutline %}
|
18
|
+
```
|
19
|
+
|
20
|
+
Sort by `title` field:
|
21
|
+
|
22
|
+
```html
|
23
|
+
{% outline attribution sort_by_title fields="<b> title </b> – <i> description </i>" stuff %}
|
24
|
+
000: B Topic 0..19
|
25
|
+
020: B Topic 20..39
|
26
|
+
040: B Topic 40..
|
27
|
+
{% endoutline %}
|
28
|
+
```
|
29
|
+
|
30
|
+
|
8
31
|
## Installation
|
32
|
+
|
9
33
|
Add the following line to your Jekyll project's Gemfile, within the `jekyll_plugins` group:
|
10
34
|
|
11
35
|
```ruby
|
@@ -16,20 +40,24 @@ end
|
|
16
40
|
|
17
41
|
And then execute:
|
18
42
|
|
19
|
-
|
43
|
+
```shell
|
44
|
+
$ bundle
|
45
|
+
```
|
20
46
|
|
21
47
|
|
22
48
|
## Fields
|
49
|
+
|
23
50
|
By default, each displayed entry consists of a document title,
|
24
51
|
wrapped within an <a href> HTML tag that links to the page for that entry,
|
25
52
|
followed by an indication of whether the document is visible (a draft) or not.
|
26
53
|
|
27
54
|
Entry can also include following fields:
|
28
|
-
`draft`, `categories`, `description`, `date`, `last_modified` or `last_modified_at`, `layout`, `order`, `title`, `slug`,
|
55
|
+
`draft`, `categories`, `description`, `date`, `last_modified` or `last_modified_at`, `layout`, `order`, `title`, `slug`,
|
56
|
+
`ext`, `tags`, and `excerpt`.
|
29
57
|
|
30
58
|
Specify the fields like this:
|
31
59
|
|
32
|
-
```
|
60
|
+
```html
|
33
61
|
{% outline fields="title – <i> description </i>" %}
|
34
62
|
000: Topic 0..19
|
35
63
|
020: Topic 20..39
|
@@ -45,8 +73,10 @@ Tokens are separated by white space.
|
|
45
73
|
|
46
74
|
|
47
75
|
### CSS
|
76
|
+
|
48
77
|
The CSS used for the demo website should be copied to your project.
|
49
|
-
See the sections of
|
78
|
+
See the sections of
|
79
|
+
[`demo/assets/css/styles.css`](/mslinn/jekyll_outline/blob/master/demo/assets/css/style.css#L252-L315) as shown:
|
50
80
|
|
51
81
|
```css
|
52
82
|
/* Start of jekyll_plugin_support css */
|
@@ -59,6 +89,7 @@ See the sections of [`demo/assets/css/styles.css`](/mslinn/jekyll_outline/blob/m
|
|
59
89
|
```
|
60
90
|
|
61
91
|
### JavaScript
|
92
|
+
|
62
93
|
This project's `outline_js` tag returns the Javascript necessary to position images relating to the outline.
|
63
94
|
If used without parameters it just returns the JavaScript.
|
64
95
|
Use the tag this way:
|
@@ -78,7 +109,9 @@ Use the tag this way:
|
|
78
109
|
|
79
110
|
|
80
111
|
## Explanation
|
112
|
+
|
81
113
|
Given an outline that looks like this:
|
114
|
+
|
82
115
|
```html
|
83
116
|
{% outline stuff %}
|
84
117
|
000: Topic 0..19
|
@@ -89,11 +122,12 @@ Given an outline that looks like this:
|
|
89
122
|
|
90
123
|
...and given pages in the `stuff` collection with the following names:
|
91
124
|
|
92
|
-
|
93
|
-
|
94
|
-
|
125
|
+
- `010-published.html` has title **Published Stuff Post 010**
|
126
|
+
- `020-unpublished.html` has title **Unpublished Post 020**
|
127
|
+
- `030-unpublished.html` has title **Unpublished Post 030**
|
95
128
|
|
96
129
|
Then links to the pages in the `stuff` collection's pages are interleaved into the generated outline like this:
|
130
|
+
|
97
131
|
```html
|
98
132
|
<div class="outer_posts">
|
99
133
|
<h3 class='post_title clear' id="title_0">Topic 0..19</h3>
|
@@ -121,6 +155,7 @@ Note that leading zeros in the first column above are not present in the `id`s b
|
|
121
155
|
|
122
156
|
If you want to provide images to embed at appropriate locations within the outline,
|
123
157
|
wrap them within an invisible `div` so the web page does not jump around as the images are loaded.
|
158
|
+
|
124
159
|
```html
|
125
160
|
<div style="display: none;">
|
126
161
|
{% img align="right"
|
@@ -146,30 +181,34 @@ wrap them within an invisible `div` so the web page does not jump around as the
|
|
146
181
|
%}
|
147
182
|
</div>
|
148
183
|
```
|
184
|
+
|
149
185
|
The JavaScript identifies the images and repositions them in the DOM such that they follow the appropriate heading.
|
150
186
|
If no image corresponds to a heading, no error or warning is generated.
|
151
187
|
The images can be located anywhere on the page; they will be relocated appropriately.
|
152
188
|
If an image does not correspond to a heading, it is deleted.
|
153
189
|
|
154
190
|
|
155
|
-
|
156
|
-
|
157
191
|
## Attribution
|
192
|
+
|
158
193
|
See [`jekyll_plugin_support` for `attribution`](https://github.com/mslinn/jekyll_plugin_support#subclass-attribution)
|
159
194
|
|
160
195
|
|
161
196
|
## Additional Information
|
197
|
+
|
162
198
|
More information is available on
|
163
199
|
[Mike Slinn’s website](https://www.mslinn.com/jekyll/3000-jekyll-plugins.html#outline).
|
164
200
|
|
165
201
|
|
166
202
|
## Development
|
203
|
+
|
167
204
|
After checking out the repo, run `bin/setup` to install development dependencies.
|
168
205
|
|
169
206
|
Then you can run `bin/console` for an interactive prompt that will allow you to experiment using `irb`.
|
170
207
|
|
171
208
|
### Build and Install Locally
|
209
|
+
|
172
210
|
To build and install this gem onto your local machine, run:
|
211
|
+
|
173
212
|
```shell
|
174
213
|
$ bundle exec rake install
|
175
214
|
jekyll_outline 0.1.0 built to pkg/jekyll_outline-0.1.0.gem.
|
@@ -191,45 +230,56 @@ jekyll_outline (0.1.0)
|
|
191
230
|
|
192
231
|
|
193
232
|
## Demo
|
233
|
+
|
194
234
|
A demo / test website is provided in the `demo` directory.
|
195
235
|
It can be used to debug the plugin or to run freely.
|
196
236
|
|
237
|
+
|
197
238
|
### Run Freely
|
198
|
-
1. Run from the command line:
|
199
|
-
```shell
|
200
|
-
$ demo/_bin/debug -r
|
201
|
-
```
|
202
239
|
|
203
|
-
|
240
|
+
1. Run from the command line:
|
241
|
+
|
242
|
+
```shell
|
243
|
+
$ demo/_bin/debug -r
|
244
|
+
```
|
245
|
+
|
246
|
+
2. View the generated website at [`http://localhost:4444`](http://localhost:4444)
|
247
|
+
|
204
248
|
|
205
249
|
### Plugin Debugging
|
206
|
-
1. Set breakpoints in Visual Studio Code.
|
207
250
|
|
208
|
-
|
209
|
-
```shell
|
210
|
-
$ demo/_bin/debug
|
211
|
-
```
|
251
|
+
1. Set breakpoints in Visual Studio Code.
|
212
252
|
|
213
|
-
|
214
|
-
configuration called `Attach rdebug-ide`.
|
253
|
+
2. Initiate a debug session from the command line:
|
215
254
|
|
216
|
-
|
255
|
+
```shell
|
256
|
+
$ demo/_bin/debug
|
257
|
+
```
|
258
|
+
|
259
|
+
3. Once the `Fast Debugger` signon appears, launch the Visual Studio Code launch
|
260
|
+
configuration called `Attach rdebug-ide`.
|
261
|
+
4. View the generated website at [`http://localhost:4444`](http://localhost:4444)
|
217
262
|
|
218
263
|
|
219
264
|
## Release
|
265
|
+
|
220
266
|
To release a new version,
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
267
|
+
|
268
|
+
1. Update the version number in `version.rb`.
|
269
|
+
2. Describe the changes in `CHANGELOG.md`.
|
270
|
+
3. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.
|
271
|
+
4. Run the following:
|
272
|
+
|
273
|
+
```shell
|
274
|
+
$ bundle exec rake release
|
275
|
+
```
|
276
|
+
|
277
|
+
The above creates a git tag for the version, commits the created tag,
|
278
|
+
and pushes the new `.gem` file to [RubyGems.org](https://rubygems.org).
|
230
279
|
|
231
280
|
|
232
281
|
## Contributing
|
282
|
+
|
233
283
|
Bug reports and pull requests are welcome on GitHub at https://github.com/mslinn/jekyll_outline.
|
234
284
|
|
235
285
|
1. Fork the project
|
@@ -239,4 +289,5 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/mslinn
|
|
239
289
|
|
240
290
|
|
241
291
|
## License
|
292
|
+
|
242
293
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/jekyll_outline.gemspec
CHANGED
@@ -35,6 +35,6 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.version = JekyllOutlineVersion::VERSION
|
36
36
|
|
37
37
|
spec.add_dependency 'jekyll', '>= 3.5.0'
|
38
|
-
spec.add_dependency 'jekyll_draft', '
|
39
|
-
spec.add_dependency 'jekyll_plugin_support', '
|
38
|
+
spec.add_dependency 'jekyll_draft', '>= 1.1.2'
|
39
|
+
spec.add_dependency 'jekyll_plugin_support', '>= 1.0.0'
|
40
40
|
end
|
data/lib/jekyll_outline.rb
CHANGED
data/lib/outline_js.rb
CHANGED
data/lib/outline_tag.rb
CHANGED
@@ -6,10 +6,38 @@ require 'jekyll_plugin_support'
|
|
6
6
|
require 'yaml'
|
7
7
|
require_relative 'jekyll_outline/version'
|
8
8
|
|
9
|
+
# This class generates output of the form, where NNN is an order value:
|
10
|
+
# <div class="outer_posts">
|
11
|
+
# <h3 class="post_title clear" id="title_0">Django / Oscar Evaluation</h3>
|
12
|
+
# <div id="posts_wrapper_0" class="clearfix">
|
13
|
+
# <div id="posts_0" class="posts">
|
14
|
+
# <span>2021-02-11</span> <span><a href="/collection/page1.html">Title 1</a></span>
|
15
|
+
# <span>2023-12-09</span> <span><a href="/collection/page2.html">Title 2</a></span>
|
16
|
+
# </div>
|
17
|
+
# <h3 class="post_title clear" id="title_NNN">Notes</h3>
|
18
|
+
# <div id="posts_wrapper_NNN" class="clearfix">
|
19
|
+
# <div id="posts_400" class="posts">
|
20
|
+
# <span>2021-04-14</span> <span><a href="/collection/page3.html">Title 3</a></span>
|
21
|
+
# <span>2021-03-29</span> <span><a href="/collection/page4.html">Title 4</a></span>
|
22
|
+
# </div>
|
23
|
+
# </div>
|
24
|
+
# <div id="jps_attribute_570007" class="jps_attribute">
|
25
|
+
# <div>
|
26
|
+
# <a href="https://www.mslinn.com/jekyll_plugins/jekyll_outline.html" target="_blank" rel="nofollow">
|
27
|
+
# Generated by the jekyll_outline v1.2.1 Jekyll plugin, written by Mike Slinn 2024-01-09.
|
28
|
+
# </a>
|
29
|
+
# </div>
|
30
|
+
# </div>
|
31
|
+
# </div>
|
32
|
+
# </div>
|
33
|
+
#
|
34
|
+
# Subclasses, such as jekyll_toc.rb, might generate other output.
|
35
|
+
|
9
36
|
module OutlineTag
|
10
37
|
PLUGIN_NAME = 'outline'.freeze
|
11
38
|
|
12
39
|
# Interleaves with docs
|
40
|
+
# Duck type compatible with Jekyll doc
|
13
41
|
class Header
|
14
42
|
attr_accessor :order, :title
|
15
43
|
|
@@ -33,14 +61,18 @@ module OutlineTag
|
|
33
61
|
headers = make_headers(super) # Process the block content.
|
34
62
|
|
35
63
|
@helper.gem_file __FILE__
|
36
|
-
@fields
|
37
|
-
@
|
64
|
+
@fields = @helper.parameter_specified?('fields')&.split || ['title']
|
65
|
+
@sort_by = @helper.parameter_specified?('sort_by_title') ? 'title' : 'order'
|
38
66
|
@collection_name = @helper.remaining_markup
|
39
67
|
abort 'OutlineTag: collection_name was not specified' unless @collection_name
|
40
68
|
|
41
69
|
@docs = obtain_docs(@collection_name)
|
42
70
|
collection = headers + @docs
|
71
|
+
render_outline collection
|
72
|
+
end
|
43
73
|
|
74
|
+
# Overload this for a subclass
|
75
|
+
def render_outline(collection)
|
44
76
|
<<~HEREDOC
|
45
77
|
<div class="outer_posts">
|
46
78
|
#{make_entries collection}
|
@@ -49,6 +81,8 @@ module OutlineTag
|
|
49
81
|
HEREDOC
|
50
82
|
end
|
51
83
|
|
84
|
+
def open_head; end
|
85
|
+
|
52
86
|
private
|
53
87
|
|
54
88
|
def header?(variable)
|
@@ -64,14 +98,18 @@ module OutlineTag
|
|
64
98
|
# @param collection Array of Jekyll::Document and Outline::Header
|
65
99
|
# @return Array of String
|
66
100
|
def make_entries(collection)
|
67
|
-
sorted =
|
101
|
+
sorted = if @sort_by == 'order'
|
102
|
+
collection.sort_by(&obtain_order)
|
103
|
+
else
|
104
|
+
collection.sort_by(&obtain_field)
|
105
|
+
end
|
68
106
|
pruned = remove_empty_headers sorted
|
69
107
|
@section_state = :head
|
70
108
|
@section_id = 0
|
71
109
|
result = pruned.map do |entry|
|
72
110
|
handle entry
|
73
111
|
end
|
74
|
-
result << " </div>\n </div>" if @section_state == :in_body
|
112
|
+
result << " </div>\n </div>" if @section_state == :in_body # Modify this for TOC
|
75
113
|
result&.join("\n")
|
76
114
|
end
|
77
115
|
|
@@ -86,14 +124,16 @@ module OutlineTag
|
|
86
124
|
entry
|
87
125
|
else
|
88
126
|
if @section_state == :head
|
89
|
-
section_start =
|
90
|
-
|
127
|
+
section_start = <<~ENDTEXT # Modify this for TOC
|
128
|
+
<div id="posts_wrapper_#{@header_order}" class='clearfix'>
|
129
|
+
<div id="posts_#{@header_order}" class='posts'>
|
130
|
+
ENDTEXT
|
91
131
|
end
|
92
132
|
@section_state = :in_body
|
93
133
|
date = entry.data['last_modified_at'] # "%Y-%m-%d"
|
94
134
|
draft = Jekyll::Draft.draft_html(entry)
|
95
135
|
visible_line = handle_entry entry
|
96
|
-
result = " <span>#{date}</span> <span><a href='#{entry.url}'>#{visible_line.strip}</a>#{draft}</span>"
|
136
|
+
result = " <span>#{date}</span> <span><a href='#{entry.url}'>#{visible_line.strip}</a>#{draft}</span>" # Modify this for TOC
|
97
137
|
result = section_start + result if section_start
|
98
138
|
result
|
99
139
|
end
|
@@ -133,13 +173,25 @@ module OutlineTag
|
|
133
173
|
.reject { |doc| doc.path.end_with? 'index.html' }
|
134
174
|
end
|
135
175
|
|
136
|
-
# Sort entries
|
176
|
+
# Sort entries within the outline tag which do not have the property specified by @sort_by at the end
|
177
|
+
def obtain_field
|
178
|
+
sort_by = @sort_by.to_s
|
179
|
+
proc do |entry|
|
180
|
+
if entry.respond_to? :data # page
|
181
|
+
entry.data.key?(sort_by) ? entry.data[sort_by] || 'zzz' : 'zzz'
|
182
|
+
else # heading
|
183
|
+
entry.respond_to?(sort_by) ? entry.send(sort_by) || 'zzz' : 'zzz'
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
# Sort entries within the outline tag which do not have an order property at the end
|
137
189
|
def obtain_order
|
138
190
|
proc do |entry|
|
139
|
-
if entry.respond_to? :data
|
140
|
-
entry.data.key?('order') ? entry.data['order'] : FIXNUM_MAX
|
141
|
-
else
|
142
|
-
entry.order
|
191
|
+
if entry.respond_to? :data # page
|
192
|
+
entry.data.key?('order') ? entry.data['order'] || FIXNUM_MAX : FIXNUM_MAX
|
193
|
+
else # heading
|
194
|
+
entry.order || FIXNUM_MAX
|
143
195
|
end
|
144
196
|
end
|
145
197
|
end
|
@@ -166,6 +218,6 @@ module OutlineTag
|
|
166
218
|
.join("\n")
|
167
219
|
end
|
168
220
|
|
169
|
-
JekyllPluginHelper.register(self, PLUGIN_NAME)
|
221
|
+
::JekyllSupport::JekyllPluginHelper.register(self, PLUGIN_NAME)
|
170
222
|
end
|
171
223
|
end
|
data/spec/outline_spec.rb
CHANGED
@@ -4,10 +4,7 @@ require_relative '../lib/jekyll_outline'
|
|
4
4
|
RSpec.describe(Outline) do
|
5
5
|
include Jekyll
|
6
6
|
|
7
|
-
it '
|
8
|
-
|
9
|
-
run_tag = RunTag.new('run', 'echo asdf')
|
10
|
-
output = run_tag.render(context)
|
11
|
-
expect(output).to eq('asdf')
|
7
|
+
it 'never works first time', skip: 'Just a placeholder' do
|
8
|
+
expect(true).to be_truthy
|
12
9
|
end
|
13
10
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,9 +2,8 @@ require 'jekyll'
|
|
2
2
|
require_relative '../lib/jekyll_outline'
|
3
3
|
|
4
4
|
RSpec.configure do |config|
|
5
|
-
config.
|
5
|
+
config.filter_run_when_matching focus: true
|
6
6
|
config.order = 'random'
|
7
|
-
config.run_all_when_everything_filtered = true
|
8
7
|
|
9
8
|
# See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
|
10
9
|
config.example_status_persistence_file_path = 'spec/status_persistence.txt'
|
data/spec/status_persistence.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
example_id
|
2
|
-
|
3
|
-
./spec/
|
1
|
+
example_id | status | run_time |
|
2
|
+
--------------------------- | ------- | --------------- |
|
3
|
+
./spec/outline_spec.rb[1:1] | pending | 0.00001 seconds |
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_outline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Slinn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -28,30 +28,30 @@ dependencies:
|
|
28
28
|
name: jekyll_draft
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.1.
|
33
|
+
version: 1.1.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.1.
|
40
|
+
version: 1.1.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: jekyll_plugin_support
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 1.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 1.0.0
|
55
55
|
description: 'Jekyll tag plugin that creates a clickable table of contents.
|
56
56
|
|
57
57
|
'
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.5.16
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Jekyll tag plugin that creates a clickable table of contents.
|