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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f743fdf5f36a7b8d557f705f36ec9eda56b07a9e1f00aa841e81efea01c79870
|
4
|
+
data.tar.gz: 6336688644973e8b3311f1b8685a4a41e6c2a4f95217ccdfb89170db983aa017
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96abca8c8cef038c1c97d7f2749b152be8c5c19e6ed9d36b1270a3178ba6912f1ec5d757e1d49a7c99963dc4ca897cc6bb29ed66f083c55874af8ff8dc084124
|
7
|
+
data.tar.gz: adf5d4268a645634c8350070791051d637f1494b0858f7856a0257267b5a884e0d386b4307c644f8e292098368f124876e03ed334267414a609e95c283a5758a
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [master]
|
6
|
+
pull_request:
|
7
|
+
branches: [master]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
name: ubuntu-ruby-${{ matrix.ruby-version }}
|
13
|
+
strategy:
|
14
|
+
fail-fast: false
|
15
|
+
matrix:
|
16
|
+
ruby-version: ["3.4", "3.3", "3.2", "3.1", "3.0", "2.7"]
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v4
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
bundler-cache: true
|
24
|
+
- name: Runs tests
|
25
|
+
run: bundle exec rake test
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: 'Close stale issues and PRs'
|
2
|
+
|
3
|
+
on:
|
4
|
+
schedule:
|
5
|
+
- cron: '30 1 * * *'
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
stale:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
permissions:
|
11
|
+
issues: write
|
12
|
+
pull-requests: write
|
13
|
+
steps:
|
14
|
+
- uses: actions/stale@v9
|
15
|
+
with:
|
16
|
+
days-before-stale: 90
|
17
|
+
days-before-close: 30
|
18
|
+
exempt-issue-labels: pinned
|
19
|
+
exempt-pr-labels: pinned
|
20
|
+
stale-issue-message: This issue is stale because it has been open for more than 90 days with no activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.
|
21
|
+
stale-pr-message: This issue is stale because it has been open for more than 90 days with no activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.
|
data/CHANGELOG.md
CHANGED
@@ -1,38 +1,50 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
## 4.1.0
|
6
|
+
|
7
|
+
* Migrate CI to GitHub Actions (#386).
|
8
|
+
* Use %z instead of %Z to format date in article (#371).
|
9
|
+
* Fix command middleman article: it generates incorrect YAML when the title contains characters that should be escaped (#387).
|
10
|
+
* Remove official support for Ruby 2.5 and 2.6 (#388).
|
11
|
+
* Official support for Ruby 3.4.
|
12
|
+
* Internal code clean up.
|
13
|
+
* Make it work with latest Middleman (#391).
|
14
|
+
* Add Stale bot.
|
15
|
+
* Remove Rubocop.
|
5
16
|
|
6
17
|
## 4.0.3
|
7
18
|
|
8
|
-
*
|
19
|
+
* Loosen dependencies and test against Middlman v5 betas.
|
20
|
+
* Adapt to core Rubocop standards.
|
21
|
+
* Title should be always a string (#351).
|
22
|
+
* Fixed multibyte tags.
|
9
23
|
|
10
24
|
## 4.0.2
|
11
25
|
|
12
|
-
*
|
13
|
-
*
|
14
|
-
* Deprecating
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
19
|
-
*
|
20
|
-
*
|
21
|
-
*
|
22
|
-
*
|
23
|
-
*
|
24
|
-
* Updated the Gemfile to use https to remove security warning - upped gem versions to match core
|
25
|
-
* Updated the license and readme
|
26
|
+
* Updated safe_parameterize - needs heavy testing from community.
|
27
|
+
* Deprecating previous_article and next_article in favour of article_previous article_next.
|
28
|
+
* Deprecating local_articles in favour of articles_by_locale.
|
29
|
+
* Add article_locale_next and article_locale_previous (#336).
|
30
|
+
* Generating a blog article can optional create article subdirectory added manually (#312).
|
31
|
+
* Updated Gemfile for testing tools to remove the deprecation warnings from Aruba.
|
32
|
+
* Edited Travis.yml to be inline with middleman core and the Ruby versions it tests against.
|
33
|
+
* Created an GitHub Issue Template.
|
34
|
+
* Created an Editor config.
|
35
|
+
* Ruby 2.3.1 - middleman-core (master/4.2.1) - middleman-cli (master/4.2.1) - middleman-blog (local) - All tests pass.
|
36
|
+
* Updated the Gemfile to use https to remove security warning - upped gem versions to match core.
|
37
|
+
* Updated the license and readme.
|
26
38
|
|
27
39
|
## 4.0.1
|
28
40
|
|
29
|
-
* Pull in article command from v3.5.3 tag
|
30
|
-
* Summary fix
|
31
|
-
* Add address parse cache
|
32
|
-
* Add filter option
|
33
|
-
* Make sure to not generate invalid html when creating article summary
|
34
|
-
* If a summary_generator is defined, always use it to generate summaries
|
35
|
-
* Fix issue #269: duplicated key
|
41
|
+
* Pull in article command from v3.5.3 tag.
|
42
|
+
* Summary fix.
|
43
|
+
* Add address parse cache.
|
44
|
+
* Add filter option.
|
45
|
+
* Make sure to not generate invalid html when creating article summary.
|
46
|
+
* If a summary_generator is defined, always use it to generate summaries.
|
47
|
+
* Fix issue #269: duplicated key.
|
36
48
|
|
37
49
|
## 4.0.0.rc.1
|
38
50
|
|
@@ -40,49 +52,49 @@ $ gem push middleman-blog-4.0.2.gem
|
|
40
52
|
|
41
53
|
## 3.5.3
|
42
54
|
|
43
|
-
* Update blog_article active_support requires. Fixes #205
|
55
|
+
* Update blog_article active_support requires. Fixes #205.
|
44
56
|
|
45
57
|
## 3.5.2
|
46
58
|
|
47
59
|
* Ignored pages won't be processed by the blog extension.
|
48
|
-
* Avoid creating an empty-string collection when a post does not have a custom collection property set
|
49
|
-
* Fix blog sources matching blog entries that are in a subdirectory that's not explicitly stated as part of the blog.sources template
|
50
|
-
* Fixed tag and year links in blog template
|
51
|
-
* An article's language can be set via the {lang} parameter in its sources URL template
|
52
|
-
* Tags that are just a number work now
|
60
|
+
* Avoid creating an empty-string collection when a post does not have a custom collection property set (#192).
|
61
|
+
* Fix blog sources matching blog entries that are in a subdirectory that's not explicitly stated as part of the blog.sources template (#196).
|
62
|
+
* Fixed tag and year links in blog template (#195).
|
63
|
+
* An article's language can be set via the {lang} parameter in its sources URL template (#187).
|
64
|
+
* Tags that are just a number work now (#188).
|
53
65
|
|
54
66
|
## 3.5.1
|
55
67
|
|
56
|
-
* Remove a broken bracket in the blog template
|
57
|
-
* Fix transliteration of strings into URL slugs to still transliterate when it can but not smash multibyte chars
|
58
|
-
* Only match source URI templates if the date components match what a date would look like, and avoid throwing when companion files do not have an article
|
59
|
-
* Re-support spaces in blog article source paths
|
68
|
+
* Remove a broken bracket in the blog template (#181)
|
69
|
+
* Fix transliteration of strings into URL slugs to still transliterate when it can but not smash multibyte chars (#183)
|
70
|
+
* Only match source URI templates if the date components match what a date would look like, and avoid throwing when companion files do not have an article (#184).
|
71
|
+
* Re-support spaces in blog article source paths (#185).
|
60
72
|
|
61
73
|
## 3.5.0
|
62
74
|
|
63
|
-
* Add support for internationalization and locale-specific articles
|
75
|
+
* Add support for internationalization and locale-specific articles (#156).
|
64
76
|
* Drop support for Ruby 1.8 and Middleman 3.0.
|
65
77
|
* Removed backwards compatibility patch that set instance variables for tag and calendar pages. Use locals instead.
|
66
78
|
* Templated paths like :sources, :taglink, :year_link, :month_link, :day_link, :page_link, and custom_collections links can now be optionally expressed as RFC 6570 URI templates.
|
67
79
|
* Arbitrary data from page frontmatter can be used in the :permalink template. Simply add a key to your :permalink template that matches a field from your frontmatter.
|
68
80
|
* Data extracted from the :sources URL template can be used in the :permalink template. This information can also be used from templates via current_article.metadata[:page][<key>].
|
69
|
-
* UTF-8 strings substituted into URLs are now preserved rather than being omitted
|
81
|
+
* UTF-8 strings substituted into URLs are now preserved rather than being omitted (#176)
|
70
82
|
* "middleman article" command now works even when there are multiple blogs. Specify the blog you want using "--blog".
|
71
83
|
* The template used to generate new articles via "middleman article" can be overridden by setting :new_article_template.
|
72
84
|
* Removed `:blog_name`, `:blog_author`, `:blog_avatar` options and the `page_title` helper.
|
73
85
|
|
74
86
|
## 3.4.1
|
75
87
|
|
76
|
-
* Require Middleman 3.2
|
88
|
+
* Require Middleman 3.2.
|
77
89
|
|
78
90
|
## 3.4.0
|
79
91
|
|
80
|
-
* Add `inspect` methods to `BlogData` and `BlogArticle` to avoid hangs on exceptions
|
81
|
-
* Generated feed.xml now works on blogs with no posts
|
92
|
+
* Add `inspect` methods to `BlogData` and `BlogArticle` to avoid hangs on exceptions (#157).
|
93
|
+
* Generated feed.xml now works on blogs with no posts (#155).
|
82
94
|
* No longer depend on `middleman-more`.
|
83
|
-
* Don't try to replace tokens that don't exist in the source path
|
84
|
-
* Support for including arbitrary frontmatter data in blog permalinks
|
85
|
-
* When using multiblog, fail immediately if the blog name isn't specified
|
95
|
+
* Don't try to replace tokens that don't exist in the source path (#161).
|
96
|
+
* Support for including arbitrary frontmatter data in blog permalinks (#164).
|
97
|
+
* When using multiblog, fail immediately if the blog name isn't specified (#168).
|
86
98
|
|
87
99
|
## 3.3.0
|
88
100
|
|
@@ -92,19 +104,19 @@ $ gem push middleman-blog-4.0.2.gem
|
|
92
104
|
* Add `:blog_name`, `:blog_author`, `:blog_avatar` options and a `page_title` helper
|
93
105
|
that incorporates `:blog_name`.
|
94
106
|
* Allow options.sources to contain the same date component multiple
|
95
|
-
times
|
96
|
-
* Improve `feed.xml.builder` template to support `blog.prefix
|
97
|
-
* Hide page numbers in template if only one page per index
|
98
|
-
* URLs in the feed.xml template are now absolute
|
107
|
+
times (#112).
|
108
|
+
* Improve `feed.xml.builder` template to support `blog.prefix` (#126).
|
109
|
+
* Hide page numbers in template if only one page per index (#125).
|
110
|
+
* URLs in the feed.xml template are now absolute (#130).
|
99
111
|
* ASCII-8BIT text is reencoded to UTF-8 to avoid Nokogiri problems when
|
100
112
|
generating summaries.
|
101
113
|
* `summary` will no longer explode when encountering comments in the
|
102
|
-
article
|
103
|
-
* Fix setting time zone with `set :time_zone` in `config.rb
|
114
|
+
article (#136).
|
115
|
+
* Fix setting time zone with `set :time_zone` in `config.rb` (#140).
|
104
116
|
* Articles can omit their :title from the filename and specify it in frontmatter
|
105
|
-
instead
|
117
|
+
instead (#148).
|
106
118
|
* Pages can choose which blog to use in multi-blog mode by specifying the correct
|
107
|
-
blog in frontmatter
|
119
|
+
blog in frontmatter (#150).
|
108
120
|
|
109
121
|
## 3.2.0
|
110
122
|
|
@@ -120,20 +132,20 @@ $ gem push middleman-blog-4.0.2.gem
|
|
120
132
|
|
121
133
|
## 3.1.1
|
122
134
|
|
123
|
-
* Correctly handle time zone, allow setting time zone with `set :time_zone
|
124
|
-
* Fix using `page_articles` in when `paginate` is false
|
135
|
+
* Correctly handle time zone, allow setting time zone with `set :time_zone` (#76).
|
136
|
+
* Fix using `page_articles` in when `paginate` is false (#78).
|
125
137
|
|
126
138
|
## 3.1.0
|
127
139
|
|
128
|
-
* Don't publish future-dated articles
|
129
|
-
* Create summary from source instead of output
|
130
|
-
* Deprecate instance variables in templates in favor of locals
|
140
|
+
* Don't publish future-dated articles (#74).
|
141
|
+
* Create summary from source instead of output (#70).
|
142
|
+
* Deprecate instance variables in templates in favor of locals (#66).
|
131
143
|
* Allow articles to set "published: false" in frontmatter and show up in preview but not in build/production.
|
132
|
-
* Allow articles to have their own layout set in the YAML front matter
|
133
|
-
* Per-article content subdirectories
|
134
|
-
* Allow article date to be in any order in permalink
|
135
|
-
* Use `link_to` in blog templates
|
136
|
-
* Pagination for index, tag, and calendar pages
|
144
|
+
* Allow articles to have their own layout set in the YAML front matter (#59).
|
145
|
+
* Per-article content subdirectories (#60).
|
146
|
+
* Allow article date to be in any order in permalink (#60).
|
147
|
+
* Use `link_to` in blog templates (#62).
|
148
|
+
* Pagination for index, tag, and calendar pages (#57).
|
137
149
|
|
138
150
|
## 3.0.0
|
139
151
|
|
data/Gemfile
CHANGED
@@ -1,38 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# the following line to use 'http://'
|
4
|
-
##
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
5
3
|
source 'https://rubygems.org'
|
6
4
|
|
7
|
-
|
8
|
-
gem
|
9
|
-
gem "middleman-core", git: "https://github.com/middleman/middleman.git", branch: 'master'
|
5
|
+
gem 'middleman-core', git: 'https://github.com/middleman/middleman.git'
|
6
|
+
gem 'middleman-cli', git: 'https://github.com/middleman/middleman.git'
|
10
7
|
|
11
8
|
# Specify your gem's dependencies in middleman-blog.gemspec
|
12
9
|
gemspec
|
13
10
|
|
14
11
|
# Build and doc tools
|
15
|
-
gem 'rake', '~>
|
16
|
-
gem 'yard', '~> 0.
|
12
|
+
gem 'rake', '~> 13.1', require: false
|
13
|
+
gem 'yard', '~> 0.9', require: false
|
17
14
|
|
18
15
|
# Test tools
|
19
|
-
gem '
|
20
|
-
gem '
|
21
|
-
gem '
|
22
|
-
gem 'rspec',
|
23
|
-
gem '
|
16
|
+
gem 'aruba', require: false
|
17
|
+
gem 'capybara', require: false
|
18
|
+
gem 'cucumber', require: false
|
19
|
+
gem 'rspec', require: false
|
20
|
+
gem 'timecop', require: false
|
24
21
|
|
25
|
-
|
26
|
-
gem
|
27
|
-
gem
|
22
|
+
# Optional dependencies, included for tests
|
23
|
+
gem 'kramdown'
|
24
|
+
gem 'rack'
|
25
|
+
gem 'activesupport', RUBY_VERSION < '3.2' ? '~> 7.0' : '~> 8.0'
|
28
26
|
|
29
27
|
# Code Quality
|
30
|
-
gem '
|
31
|
-
gem 'simplecov', '~> 0.10', require: false # Latest 0.14.1
|
32
|
-
gem 'coveralls', '~> 0.8', require: false # Latest 0.8.19
|
33
|
-
gem 'codeclimate-test-reporter', '~> 0.3', require: false, group: :test # Latest 1.0.8
|
34
|
-
|
35
|
-
# Set the ruby platform - not windows
|
36
|
-
platforms :ruby do
|
37
|
-
gem "redcarpet", "~> 3.1" # Latest 3.4.0
|
38
|
-
end
|
28
|
+
gem 'simplecov', require: false
|
data/README.md
CHANGED
@@ -1,47 +1,41 @@
|
|
1
1
|
# Middleman-Blog extension
|
2
2
|
|
3
|
-
middleman-blog
|
4
|
-
|
3
|
+
[][gem]
|
4
|
+
[](https://github.com/middleman/middleman-blog/actions/workflows/ci.yml)
|
5
|
+
|
6
|
+
`middleman-blog` is an extension for the [Middleman] static site generator that
|
7
|
+
adds blog-specific functionality. This includes:
|
5
8
|
|
6
9
|
- Handling blog articles
|
7
10
|
- Helpers for listing articles
|
8
11
|
- Tagging support
|
12
|
+
- Calendar pages
|
9
13
|
|
10
14
|
## Installation
|
11
15
|
|
12
16
|
If you're just getting started, install the `middleman` gem and generate a new
|
13
17
|
project:
|
14
18
|
|
15
|
-
```
|
19
|
+
```bash
|
16
20
|
gem install middleman
|
17
21
|
middleman init MY_PROJECT --template=blog
|
18
22
|
```
|
19
23
|
|
20
|
-
If you already have a Middleman project
|
21
|
-
`Gemfile` and run `bundle install
|
24
|
+
If you already have a Middleman project, add the `gem "middleman-blog"` line to your
|
25
|
+
`Gemfile` and then run `bundle install`.
|
22
26
|
|
23
27
|
## Configuration
|
24
28
|
|
25
29
|
Within the config.rb of the middleman project, include the line
|
26
30
|
|
27
|
-
```
|
31
|
+
```ruby
|
28
32
|
activate :blog
|
29
33
|
```
|
30
34
|
|
31
|
-
A more extensive guide can be found
|
32
|
-
[Middleman blogging guide](http://middlemanapp.com/basics/blogging/) it includes
|
33
|
-
more detailed information on configuring and using the blog extension.
|
35
|
+
A more extensive guide can be found in the [Middleman blogging guide](http://middlemanapp.com/basics/blogging/).
|
34
36
|
|
35
37
|
Additionally, up-to-date generated code documentation is available on [RubyDoc].
|
36
38
|
|
37
|
-
## Build & Dependency Status
|
38
|
-
|
39
|
-
[][gem]
|
40
|
-
[][travis]
|
41
|
-
[][gemnasium]
|
42
|
-
[][codeclimate]
|
43
|
-
[][coveralls]
|
44
|
-
|
45
39
|
## Community
|
46
40
|
|
47
41
|
Please also visit the the official [Middleman community forum](http://forum.middlemanapp.com)
|
@@ -62,34 +56,28 @@ you are submitting.
|
|
62
56
|
|
63
57
|
## Testing
|
64
58
|
|
65
|
-
|
66
|
-
Ruby versions on Linux :
|
67
|
-
|
68
|
-
- ruby-head
|
69
|
-
- 2.4.0
|
70
|
-
- 2.3.1
|
71
|
-
- 2.2.4
|
72
|
-
|
73
|
-
### Running tests
|
59
|
+
You can run all the tests by:
|
74
60
|
|
75
61
|
1. Checkout Repository: `git clone https://github.com/middleman/middleman-blog.git`
|
76
62
|
2. Install Bundler: `gem install bundler`
|
77
63
|
3. Run `bundle install` inside the project root to install the gem dependencies.
|
78
64
|
4. Run test cases: `bundle exec rake test`
|
79
65
|
|
80
|
-
|
66
|
+
To run an individual test use:
|
81
67
|
|
82
|
-
|
83
|
-
|
84
|
-
|
68
|
+
```bash
|
69
|
+
bundle exec cucumber features/blog_sources.feature
|
70
|
+
```
|
85
71
|
|
86
72
|
## Creating documentation
|
87
73
|
|
88
|
-
|
74
|
+
```bash
|
75
|
+
bundle exec rake doc
|
76
|
+
```
|
89
77
|
|
90
78
|
## Donate
|
91
79
|
|
92
|
-
[Click here to lend your support to Middleman](https://
|
80
|
+
[Click here to lend your support to Middleman](https://github.com/sponsors/tdreyno)
|
93
81
|
|
94
82
|
## License
|
95
83
|
|
@@ -97,9 +85,5 @@ Copyright (c) 2010-2017 Thomas Reynolds. MIT Licensed, see [LICENSE] for details
|
|
97
85
|
|
98
86
|
[middleman]: http://middlemanapp.com
|
99
87
|
[gem]: https://rubygems.org/gems/middleman-blog
|
100
|
-
[travis]: http://travis-ci.org/middleman/middleman-blog
|
101
|
-
[gemnasium]: https://gemnasium.com/middleman/middleman-blog
|
102
|
-
[codeclimate]: https://codeclimate.com/github/middleman/middleman-blog
|
103
|
-
[coveralls]: https://coveralls.io/r/middleman/middleman-blog
|
104
88
|
[rubydoc]: http://rubydoc.info/github/middleman/middleman-blog/master
|
105
89
|
[LICENSE]: https://github.com/middleman/middleman-blog/blob/master/LICENSE.md
|
data/Rakefile
CHANGED
@@ -1,35 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler'
|
2
4
|
Bundler::GemHelper.install_tasks
|
3
5
|
|
4
6
|
require 'cucumber/rake/task'
|
5
|
-
|
6
7
|
require 'middleman-core'
|
7
8
|
|
8
|
-
Cucumber::Rake::Task.new(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
exempt_tags << "--tags ~@nojava " if RUBY_PLATFORM == "java"
|
13
|
-
|
14
|
-
t.cucumber_opts = "--color --tags ~@wip #{ exempt_tags } --strict --format #{ ENV[ 'CUCUMBER_FORMAT' ] || 'pretty' }"
|
9
|
+
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
10
|
+
exempt_tags = ''
|
11
|
+
exempt_tags << "--tags 'not @nojava'" if RUBY_PLATFORM == 'java'
|
12
|
+
t.cucumber_opts = "--color --tags 'not @wip' #{exempt_tags} --strict --format pretty"
|
15
13
|
end
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
desc "Run tests, both RSpec and Cucumber"
|
20
|
-
task test: [ :spec, :cucumber ]
|
15
|
+
desc 'Run tests, both RSpec and Cucumber'
|
16
|
+
task test: %i[spec cucumber]
|
21
17
|
|
22
18
|
require 'rspec/core/rake_task'
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
RSpec::Core::RakeTask.new do | spec |
|
19
|
+
desc 'Run RSpec'
|
20
|
+
RSpec::Core::RakeTask.new do |spec|
|
27
21
|
spec.pattern = 'spec/**/*_spec.rb'
|
28
|
-
spec.rspec_opts = [
|
22
|
+
spec.rspec_opts = ['--color', '--format documentation']
|
29
23
|
end
|
30
24
|
|
31
|
-
desc
|
32
|
-
|
25
|
+
desc 'Build HTML documentation'
|
33
26
|
task :doc do
|
34
27
|
sh 'bundle exec yard'
|
35
28
|
end
|
29
|
+
|
30
|
+
desc 'Run all tests'
|
31
|
+
task default: :test
|
data/features/summary.feature
CHANGED
@@ -83,14 +83,11 @@ Feature: Article summary generation
|
|
83
83
|
|
84
84
|
Scenario: Summary limited by length only
|
85
85
|
Given a fixture app "summary-app"
|
86
|
-
And a file named "config.rb" with:
|
87
|
-
"""
|
88
|
-
activate :blog
|
89
|
-
"""
|
90
86
|
And a file named "source/index.html.erb" with:
|
91
87
|
"""
|
92
88
|
<% @i = 0 %>
|
93
|
-
|
89
|
+
<%= blog.articles.size %>
|
90
|
+
<% blog.articles.sort_by(&:title).each do |article| %>
|
94
91
|
<article>
|
95
92
|
<%= article.summary(7, (@i += 1).to_s) %>
|
96
93
|
</article>
|
@@ -101,6 +98,6 @@ Feature: Article summary generation
|
|
101
98
|
Then I should see "Summary1"
|
102
99
|
Then I should see "Summary2"
|
103
100
|
Then I should see "Summary3"
|
101
|
+
Then I should see "Summary4"
|
104
102
|
# it has a custom separator, which overrides explicit length, so we show up to the separator
|
105
103
|
Then I should see "Summary from article with separator."
|
106
|
-
Then I should see "Summary5"
|
data/features/support/env.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'simplecov'
|
2
4
|
|
3
5
|
SimpleCov.start do
|
4
|
-
add_filter
|
6
|
+
add_filter '/features/'
|
5
7
|
end
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
ENV[ "TEST" ] = "true"
|
11
|
-
ENV[ "AUTOLOAD_SPROCKETS" ] = "false"
|
9
|
+
ENV['TEST'] = 'true'
|
10
|
+
ENV['AUTOLOAD_SPROCKETS'] = 'false'
|
12
11
|
|
13
|
-
PROJECT_ROOT_PATH = File.dirname(
|
12
|
+
PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
|
14
13
|
|
15
|
-
require
|
16
|
-
require
|
14
|
+
require 'middleman-core'
|
15
|
+
require 'middleman-core/step_definitions'
|
17
16
|
|
18
|
-
require File.join(
|
17
|
+
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-blog')
|
@@ -1,28 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'timecop'
|
2
4
|
require 'active_support/core_ext/time/calculations'
|
3
5
|
|
4
|
-
Time.zone =
|
6
|
+
Time.zone = 'UTC' if Time.zone.nil?
|
5
7
|
|
6
|
-
Given /the timezone is "(.+?)"$/ do |
|
7
|
-
|
8
|
+
Given /the timezone is "(.+?)"$/ do |zone|
|
9
|
+
Time.zone = zone
|
8
10
|
end
|
9
11
|
|
10
|
-
Given /the (date|time|date and time) is (.+?)$/ do |
|
12
|
+
Given /the (date|time|date and time) is (.+?)$/ do |datetime, value|
|
11
13
|
time = case datetime
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
when 'date'
|
15
|
+
Date.parse(value)
|
16
|
+
when 'time'
|
17
|
+
Time.parse(value)
|
18
|
+
when 'date and time'
|
19
|
+
Time.zone.parse(value)
|
20
|
+
end
|
19
21
|
|
20
22
|
Timecop.travel time
|
21
|
-
|
22
23
|
end
|
23
24
|
|
24
25
|
After do
|
25
|
-
|
26
26
|
Timecop.return
|
27
|
-
|
28
27
|
end
|
data/features/tags.feature
CHANGED
@@ -22,6 +22,10 @@ Feature: Tag pages
|
|
22
22
|
Then I should see "/2011-01-02-another-article.html"
|
23
23
|
Then I should see "Tag: 120"
|
24
24
|
|
25
|
+
When I go to "/tags/日本語.html"
|
26
|
+
Then I should see "/2011-01-02-another-article.html"
|
27
|
+
Then I should see "Tag: 日本語"
|
28
|
+
|
25
29
|
When I go to "/index.html"
|
26
30
|
Then I should see "Tag Path: '/tags/foo.html'"
|
27
31
|
|
@@ -102,7 +106,7 @@ Feature: Tag pages
|
|
102
106
|
Newer Article Content
|
103
107
|
"""
|
104
108
|
|
105
|
-
When I go to "/tags
|
109
|
+
When I go to "/tags/☆☆☆.html"
|
106
110
|
Then I should see "/2011-01-01-new-article.html"
|
107
111
|
|
108
112
|
Scenario: Tag pages are not added when disabled in configuration
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
activate :blog do |blog|
|
2
|
-
blog.permalink =
|
3
|
-
blog.sources =
|
4
|
+
blog.permalink = '{year}/{month}/{day}/{title}'
|
5
|
+
blog.sources = 'blog/:year-:month-:day-:title.html'
|
4
6
|
end
|
5
7
|
|
6
8
|
activate :directory_indexes
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
activate :blog do |blog|
|
2
|
-
blog.permalink =
|
3
|
-
blog.sources =
|
4
|
+
blog.permalink = '{year}.{month}.{day}/{title}'
|
5
|
+
blog.sources = 'blog/:year-:month-:day-:title.html'
|
4
6
|
end
|
5
7
|
|
6
8
|
activate :directory_indexes
|