middleman-blog 4.0.2 → 4.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 +5 -5
- data/.github/workflows/ci.yml +25 -0
- data/.github/workflows/stale.yml +21 -0
- data/CHANGELOG.md +72 -60
- data/Gemfile +16 -26
- data/README.md +20 -36
- data/Rakefile +15 -19
- data/features/summary.feature +3 -6
- data/features/support/env.rb +9 -10
- data/features/support/time_steps.rb +13 -14
- data/features/tags.feature +5 -1
- data/fixtures/article-dirs-app/config-directory-indexes.rb +4 -2
- data/fixtures/article-dirs-app/config-permalink-with-dot.rb +4 -2
- data/fixtures/article-dirs-app/config.rb +4 -2
- data/fixtures/blog-sources-app/config.rb +3 -4
- data/fixtures/blog-sources-no-date-app/config.rb +3 -4
- data/fixtures/blog-sources-no-day-app/config.rb +3 -4
- data/fixtures/blog-sources-no-title-app/config.rb +2 -3
- data/fixtures/blog-sources-subdirs-app/config.rb +4 -5
- data/fixtures/calendar-and-tag-app/config-directory-indexes.rb +5 -3
- data/fixtures/calendar-and-tag-app/config.rb +6 -4
- data/fixtures/calendar-app/config-directory-indexes.rb +6 -6
- data/fixtures/calendar-app/config-only-year.rb +8 -8
- data/fixtures/calendar-app/config.rb +6 -6
- data/fixtures/calendar-multiblog-app/config.rb +14 -12
- data/fixtures/custom-article-template-app/config.rb +2 -0
- data/fixtures/custom-collections-app/config-blog-prefix.rb +9 -7
- data/fixtures/custom-collections-app/config-directory-indexes.rb +8 -6
- data/fixtures/custom-collections-app/config.rb +8 -6
- data/fixtures/custom-collections-multiblog-app/config.rb +16 -14
- data/fixtures/custom-collections-sources-app/config.rb +7 -5
- data/fixtures/custom-permalinks-app/config-directory-indexes.rb +5 -3
- data/fixtures/custom-permalinks-app/config.rb +5 -3
- data/fixtures/filename-date-app/config.rb +3 -1
- data/fixtures/future-date-app/config.rb +4 -2
- data/fixtures/indexes-app/config.rb +4 -2
- data/fixtures/lang-path-app/config.rb +4 -2
- data/fixtures/language-app/config.rb +3 -1
- data/fixtures/layouts-app/config.rb +3 -1
- data/fixtures/paginate-app/config-directory-indexes.rb +13 -13
- data/fixtures/paginate-app/config-paginate-off.rb +13 -13
- data/fixtures/paginate-app/config.rb +13 -13
- data/fixtures/paginate-multiblog-app/config.rb +15 -13
- data/fixtures/permalink-app/config.rb +4 -5
- data/fixtures/preview-app/config.rb +4 -2
- data/fixtures/published-app/config.rb +4 -2
- data/fixtures/summary-app/config.rb +2 -0
- data/fixtures/tags-app/config-directory-indexes.rb +7 -5
- data/fixtures/tags-app/config-filters.rb +2 -0
- data/fixtures/tags-app/config-no-tags.rb +2 -0
- data/fixtures/tags-app/config.rb +7 -5
- data/fixtures/tags-app/source/blog/2011-01-01-new-article.html.markdown +1 -1
- data/fixtures/tags-app/source/blog/2011-01-02-another-article.html.markdown +1 -0
- data/fixtures/tags-multiblog-app/config.rb +12 -10
- data/fixtures/time-zone-app/config.rb +2 -0
- data/lib/middleman-blog/blog_article.rb +20 -41
- data/lib/middleman-blog/blog_data.rb +22 -33
- data/lib/middleman-blog/calendar_pages.rb +16 -20
- data/lib/middleman-blog/commands/article.rb +54 -61
- data/lib/middleman-blog/commands/article.tt +2 -2
- data/lib/middleman-blog/custom_pages.rb +10 -9
- data/lib/middleman-blog/extension.rb +22 -19
- data/lib/middleman-blog/helpers.rb +18 -25
- data/lib/middleman-blog/paginator.rb +8 -5
- data/lib/middleman-blog/tag_pages.rb +13 -23
- data/lib/middleman-blog/truncate_html.rb +14 -11
- data/lib/middleman-blog/uri_templates.rb +37 -17
- data/lib/middleman-blog/version.rb +3 -3
- data/lib/middleman-blog.rb +7 -7
- data/lib/middleman_extension.rb +3 -1
- data/middleman-blog.gemspec +16 -23
- data/spec/spec_helper.rb +3 -4
- data/spec/uri_templates_spec.rb +24 -29
- metadata +15 -37
- data/.travis.yml +0 -38
- data/fixtures/default-template-app/Gemfile +0 -6
- data/fixtures/default-template-app/config.rb +0 -35
- data/fixtures/default-template-app/source/2013-04-01-new-article.html.markdown +0 -25
- data/fixtures/default-template-app/source/about-me.html.erb +0 -0
- data/fixtures/default-template-app/source/archives.html.erb +0 -10
- data/fixtures/default-template-app/source/index.html.erb +0 -11
- data/fixtures/default-template-app/source/javascripts/_zepto.pjax.js +0 -744
- data/fixtures/default-template-app/source/javascripts/app.js +0 -11
- data/fixtures/default-template-app/source/javascripts/modernizr.js +0 -1
- data/fixtures/default-template-app/source/layouts/layout.erb +0 -62
- data/fixtures/default-template-app/source/stylesheets/app.css.scss +0 -109
- /data/{CONTRIBUTING.md → .github/CONTRIBUTING.md} +0 -0
- /data/{ISSUE_TEMPLATE.md → .github/ISSUE_TEMPLATE.md} +0 -0
data/spec/uri_templates_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'middleman-blog/uri_templates'
|
4
4
|
|
@@ -7,24 +7,24 @@ describe 'Middleman::Blog::UriTemplates' do
|
|
7
7
|
|
8
8
|
describe 'safe_parameterize' do
|
9
9
|
it 'can parameterize normal strings' do
|
10
|
-
expect(safe_parameterize('Some FUN stuff!'))
|
10
|
+
expect(safe_parameterize('Some FUN stuff!')).to eq 'some-fun-stuff'
|
11
11
|
end
|
12
12
|
|
13
13
|
it "doesn't mangle unicode strings" do
|
14
|
-
expect(safe_parameterize('☆☆☆'))
|
15
|
-
expect(safe_parameterize('明日がある'))
|
14
|
+
expect(safe_parameterize('☆☆☆')).to eq '☆☆☆'
|
15
|
+
expect(safe_parameterize('明日がある')).to eq '明日がある'
|
16
16
|
end
|
17
17
|
|
18
18
|
it "still transliterates when it's safe" do
|
19
|
-
expect(safe_parameterize('Schlagwörter'))
|
19
|
+
expect(safe_parameterize('Schlagwörter')).to eq 'schlagworter'
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
23
|
-
expect(safe_parameterize('What ☆☆☆!'))
|
22
|
+
it 'can handle mixed strings' do
|
23
|
+
expect(safe_parameterize('What ☆☆☆!')).to eq 'what-☆☆☆'
|
24
24
|
end
|
25
25
|
|
26
|
-
it
|
27
|
-
expect(safe_parameterize(1))
|
26
|
+
it 'can handle numbers' do
|
27
|
+
expect(safe_parameterize(1)).to eq '1'
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -33,47 +33,42 @@ describe 'Middleman::Blog::UriTemplates' do
|
|
33
33
|
template = uri_template('{year}/{month}/{day}/{title}/{+path}')
|
34
34
|
params = extract_params(template, '2013/12/13/foo-bar/foo/bar.html')
|
35
35
|
|
36
|
-
expect(params['year'])
|
37
|
-
expect(params['month'])
|
38
|
-
expect(params['day'])
|
39
|
-
expect(params['title'])
|
40
|
-
expect(params['path'])
|
36
|
+
expect(params['year']).to eq '2013'
|
37
|
+
expect(params['month']).to eq '12'
|
38
|
+
expect(params['day']).to eq '13'
|
39
|
+
expect(params['title']).to eq 'foo-bar'
|
40
|
+
expect(params['path']).to eq 'foo/bar.html'
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'returns nil if there is no match' do
|
44
44
|
template = uri_template('{year}/{month}/{day}/{title}/{+path}')
|
45
|
-
expect(extract_params(template, 'foo/bar.html'))
|
45
|
+
expect(extract_params(template, 'foo/bar.html')).nil?
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'returns nil if there is no match in the date bits' do
|
49
49
|
template = uri_template('{year}/{month}/{day}/{title}/{+path}')
|
50
|
-
|
50
|
+
extract_params(template, '2a13/1a2/1s3/foo-bar/foo/bar.html')
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'matches even when the path contains spaces' do
|
54
54
|
template = uri_template('{year}/{month}/{day}/{title}/{+path}')
|
55
55
|
params = extract_params(template, '2013/12/13/foo - bar/foo/bar.html')
|
56
56
|
|
57
|
-
expect(params['year'])
|
58
|
-
expect(params['month'])
|
59
|
-
expect(params['day'])
|
60
|
-
expect(params['title'])
|
61
|
-
expect(params['path'])
|
57
|
+
expect(params['year']).to eq '2013'
|
58
|
+
expect(params['month']).to eq '12'
|
59
|
+
expect(params['day']).to eq '13'
|
60
|
+
expect(params['title']).to eq 'foo - bar'
|
61
|
+
expect(params['path']).to eq 'foo/bar.html'
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
65
|
describe 'extract_directory_path' do
|
66
|
-
|
67
66
|
it 'can extract a directory path' do
|
68
|
-
|
69
|
-
|
70
|
-
params = extract_params( template, '2013/12/13/foo-bar/foo/bar.html' )
|
67
|
+
template = uri_template('{year}/{month}/{day}/{title}/{+path}')
|
68
|
+
params = extract_params(template, '2013/12/13/foo-bar/foo/bar.html')
|
71
69
|
article_path = apply_uri_template template, params
|
72
70
|
|
73
|
-
expect(
|
74
|
-
|
71
|
+
expect(extract_directory_path(article_path)).to eq '2013/12/13/foo-bar/foo/bar'
|
75
72
|
end
|
76
|
-
|
77
73
|
end
|
78
|
-
|
79
74
|
end
|
metadata
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Reynolds
|
8
8
|
- Ben Hollis
|
9
9
|
- Ian Warner
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-04-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: middleman-core
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- - "
|
19
|
+
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 4.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- - "
|
26
|
+
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version:
|
28
|
+
version: 4.0.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: tzinfo
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,13 +64,14 @@ extensions: []
|
|
64
64
|
extra_rdoc_files: []
|
65
65
|
files:
|
66
66
|
- ".editorconfig"
|
67
|
+
- ".github/CONTRIBUTING.md"
|
68
|
+
- ".github/ISSUE_TEMPLATE.md"
|
69
|
+
- ".github/workflows/ci.yml"
|
70
|
+
- ".github/workflows/stale.yml"
|
67
71
|
- ".gitignore"
|
68
|
-
- ".travis.yml"
|
69
72
|
- ".yardopts"
|
70
73
|
- CHANGELOG.md
|
71
|
-
- CONTRIBUTING.md
|
72
74
|
- Gemfile
|
73
|
-
- ISSUE_TEMPLATE.md
|
74
75
|
- LICENSE.md
|
75
76
|
- README.md
|
76
77
|
- Rakefile
|
@@ -188,17 +189,6 @@ files:
|
|
188
189
|
- fixtures/custom-permalinks-app/source/blog/2011-01-03-third-article.html.markdown
|
189
190
|
- fixtures/custom-permalinks-app/source/index.html.erb
|
190
191
|
- fixtures/custom-permalinks-app/source/layout.erb
|
191
|
-
- fixtures/default-template-app/Gemfile
|
192
|
-
- fixtures/default-template-app/config.rb
|
193
|
-
- fixtures/default-template-app/source/2013-04-01-new-article.html.markdown
|
194
|
-
- fixtures/default-template-app/source/about-me.html.erb
|
195
|
-
- fixtures/default-template-app/source/archives.html.erb
|
196
|
-
- fixtures/default-template-app/source/index.html.erb
|
197
|
-
- fixtures/default-template-app/source/javascripts/_zepto.pjax.js
|
198
|
-
- fixtures/default-template-app/source/javascripts/app.js
|
199
|
-
- fixtures/default-template-app/source/javascripts/modernizr.js
|
200
|
-
- fixtures/default-template-app/source/layouts/layout.erb
|
201
|
-
- fixtures/default-template-app/source/stylesheets/app.css.scss
|
202
192
|
- fixtures/filename-date-app/config.rb
|
203
193
|
- fixtures/filename-date-app/source/2011-01-01-new-article.html.markdown
|
204
194
|
- fixtures/filename-date-app/source/2011-01-03-filename-and-frontmatter.html.markdown
|
@@ -363,7 +353,7 @@ homepage: https://github.com/middleman/middleman-blog
|
|
363
353
|
licenses:
|
364
354
|
- MIT
|
365
355
|
metadata: {}
|
366
|
-
post_install_message:
|
356
|
+
post_install_message:
|
367
357
|
rdoc_options: []
|
368
358
|
require_paths:
|
369
359
|
- lib
|
@@ -371,16 +361,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
371
361
|
requirements:
|
372
362
|
- - ">="
|
373
363
|
- !ruby/object:Gem::Version
|
374
|
-
version:
|
364
|
+
version: '0'
|
375
365
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
376
366
|
requirements:
|
377
367
|
- - ">="
|
378
368
|
- !ruby/object:Gem::Version
|
379
369
|
version: '0'
|
380
370
|
requirements: []
|
381
|
-
|
382
|
-
|
383
|
-
signing_key:
|
371
|
+
rubygems_version: 3.4.10
|
372
|
+
signing_key:
|
384
373
|
specification_version: 4
|
385
374
|
summary: Blog engine for Middleman
|
386
375
|
test_files:
|
@@ -498,17 +487,6 @@ test_files:
|
|
498
487
|
- fixtures/custom-permalinks-app/source/blog/2011-01-03-third-article.html.markdown
|
499
488
|
- fixtures/custom-permalinks-app/source/index.html.erb
|
500
489
|
- fixtures/custom-permalinks-app/source/layout.erb
|
501
|
-
- fixtures/default-template-app/Gemfile
|
502
|
-
- fixtures/default-template-app/config.rb
|
503
|
-
- fixtures/default-template-app/source/2013-04-01-new-article.html.markdown
|
504
|
-
- fixtures/default-template-app/source/about-me.html.erb
|
505
|
-
- fixtures/default-template-app/source/archives.html.erb
|
506
|
-
- fixtures/default-template-app/source/index.html.erb
|
507
|
-
- fixtures/default-template-app/source/javascripts/_zepto.pjax.js
|
508
|
-
- fixtures/default-template-app/source/javascripts/app.js
|
509
|
-
- fixtures/default-template-app/source/javascripts/modernizr.js
|
510
|
-
- fixtures/default-template-app/source/layouts/layout.erb
|
511
|
-
- fixtures/default-template-app/source/stylesheets/app.css.scss
|
512
490
|
- fixtures/filename-date-app/config.rb
|
513
491
|
- fixtures/filename-date-app/source/2011-01-01-new-article.html.markdown
|
514
492
|
- fixtures/filename-date-app/source/2011-01-03-filename-and-frontmatter.html.markdown
|
data/.travis.yml
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Travis YAML
|
3
|
-
##
|
4
|
-
|
5
|
-
language : ruby
|
6
|
-
sudo : false
|
7
|
-
cache : bundler
|
8
|
-
|
9
|
-
before_script :
|
10
|
-
- bundle update
|
11
|
-
|
12
|
-
rvm :
|
13
|
-
- ruby-head
|
14
|
-
- 2.4.0
|
15
|
-
- 2.3.1
|
16
|
-
- 2.2.4
|
17
|
-
|
18
|
-
os :
|
19
|
-
- linux
|
20
|
-
# - osx
|
21
|
-
|
22
|
-
matrix :
|
23
|
-
fast_finish : true
|
24
|
-
allow_failures :
|
25
|
-
- rvm : ruby-head
|
26
|
-
|
27
|
-
# gemfile:
|
28
|
-
# - Gemfile
|
29
|
-
|
30
|
-
script : bundle exec rake test
|
31
|
-
|
32
|
-
env :
|
33
|
-
global :
|
34
|
-
- TEST=true
|
35
|
-
# - CODECLIMATE_REPO_TOKEN=81787f7b1c3bfa937edadcafbc94f807bf5af5c1142c7b793f2d9969a271de1f
|
36
|
-
|
37
|
-
# notifications :
|
38
|
-
# slack : middleman:JW9OvXmn1m3XrSERe8866nBR
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'zurb-foundation'
|
2
|
-
|
3
|
-
spec = Gem::Specification.find_by_name("zurb-foundation")
|
4
|
-
set :js_assets_paths, [File.join(spec.gem_dir, "js")]
|
5
|
-
|
6
|
-
activate :directory_indexes
|
7
|
-
|
8
|
-
activate :blog
|
9
|
-
|
10
|
-
set :blog_name, "Deep Thoughts"
|
11
|
-
set :blog_author, "Nick Adams"
|
12
|
-
set :blog_avatar, "http://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50"
|
13
|
-
set :top_nav_title, { :title => "Home", :target => "index.html" }
|
14
|
-
set :top_nav_items, [
|
15
|
-
{ :title => "About Me", :target => "about-me.html" },
|
16
|
-
{ :title => "Archives", :target => "archives.html" }
|
17
|
-
# { :title => "Other Page", :target => "other-page.html" }
|
18
|
-
]
|
19
|
-
|
20
|
-
helpers do
|
21
|
-
def page_title
|
22
|
-
title = blog_name.dup
|
23
|
-
if current_page.data.title
|
24
|
-
title << ": #{current_page.data.title}"
|
25
|
-
elsif is_blog_article?
|
26
|
-
title << ": #{current_article.title}"
|
27
|
-
end
|
28
|
-
title
|
29
|
-
end
|
30
|
-
|
31
|
-
def link_to_with_active(title, url, class_name = 'active')
|
32
|
-
active_class = (current_resource == sitemap.find_resource_by_path(url)) ? class_name : ''
|
33
|
-
link_to(title, url, :class => active_class)
|
34
|
-
end
|
35
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: "This is a headline for a blog post if it’s two lines long."
|
3
|
-
---
|
4
|
-
|
5
|
-
Morbi dapibus scelerisque risus, non auctor enim varius vitae. Proin in eros tortor. Aliquam erat volutpat. Sed tempus mollis faucibus. Nunc nunc dolor, ullamcorper rhoncus malesuada in, consectetur vitae nisi. Nulla facilisi.
|
6
|
-
|
7
|
-
## Heading Example
|
8
|
-
|
9
|
-
Quisque varius euismod tempor. Nullam nisi risus, tempor in auctor ac, tempor eget nisl. Pellentesque fermentum luctus sapien vel pretium. In hac habitasse platea dictumst. Aliquam ac purus nec enim imperdiet vehicula a a risus.
|
10
|
-
|
11
|
-
### Heading Example
|
12
|
-
|
13
|
-
Quisque varius euismod tempor. Nullam nisi risus, tempor in auctor ac, tempor eget nisl. Pellentesque fermentum luctus sapien vel pretium. In hac habitasse platea dictumst. Aliquam ac purus nec enim imperdiet vehicula a a risus.
|
14
|
-
|
15
|
-
#### Heading Example
|
16
|
-
|
17
|
-
Quisque varius euismod tempor. Nullam nisi risus, tempor in auctor ac, tempor eget nisl. Pellentesque fermentum luctus sapien vel pretium. In hac habitasse platea dictumst. Aliquam ac purus nec enim imperdiet vehicula a a risus.
|
18
|
-
|
19
|
-
##### Heading Example
|
20
|
-
|
21
|
-
Quisque varius euismod tempor. Nullam nisi risus, tempor in auctor ac, tempor eget nisl. Pellentesque fermentum luctus sapien vel pretium. In hac habitasse platea dictumst. Aliquam ac purus nec enim imperdiet vehicula a a risus.
|
22
|
-
|
23
|
-
###### Heading Example
|
24
|
-
|
25
|
-
Quisque varius euismod tempor. Nullam nisi risus, tempor in auctor ac, tempor eget nisl. Pellentesque fermentum luctus sapien vel pretium. In hac habitasse platea dictumst. Aliquam ac purus nec enim imperdiet vehicula a a risus.
|
File without changes
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<% blog.articles[0...5].each_with_index do |article, i| %>
|
2
|
-
<article class="<%= (i == 0) ? 'first' : '' %>">
|
3
|
-
<span><%= article.date.strftime('%b %e %Y') %></span>
|
4
|
-
|
5
|
-
<h1><a href="<%= article.url %>"><%= article.title %></a></h1>
|
6
|
-
|
7
|
-
<%= article.summary %>
|
8
|
-
|
9
|
-
<div class="more"><a href="<%= article.url %>">read on »</a></div>
|
10
|
-
</article>
|
11
|
-
<% end %>
|