middleman-blog 4.2.0 → 4.2.1
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/features/summary.feature +22 -6
- data/lib/middleman-blog/blog_article.rb +8 -7
- data/lib/middleman-blog/extension.rb +6 -1
- data/lib/middleman-blog/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 72762eb90f88fef585cf25e99e5aa0d34430f7d69df7a98c55c0102353eec29e
|
|
4
|
+
data.tar.gz: 718968019979de31aabb0846d0002e8945b9640c91bfbc5fcb1b87fb064f62bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99d00963ceed8e311ede6faf5732cfeaf7f1939618b5a98cb3ebe72bc80bda61914598ad19999ca93d332fa58867ccec8d7166177e2f8192d2b9fbce91342faa
|
|
7
|
+
data.tar.gz: a7d09f426756c0e2600a2860d43d29acf8ed54ae4ee4e4aa68d5a96eb13417f544656690d98e88b914746aa8a04fad7db5ba98a463d2f634836040fed01586c6
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 4.2.1
|
|
6
|
+
|
|
7
|
+
* Fix summary_separator stripping HTML document structure from full page renders (#401)
|
|
8
|
+
|
|
5
9
|
## 4.2.0
|
|
6
10
|
|
|
7
11
|
* Add preserve_underscores_in_slugs option to control URL formatting (#393).
|
data/features/summary.feature
CHANGED
|
@@ -9,9 +9,11 @@ Feature: Article summary generation
|
|
|
9
9
|
"""
|
|
10
10
|
And I should not see "Extended part from article with separator."
|
|
11
11
|
When I go to "/2011/01/01/article-with-standard-summary-separator.html"
|
|
12
|
-
Then I should see "
|
|
12
|
+
Then I should see "<!doctype html>"
|
|
13
|
+
And I should see "<html>"
|
|
14
|
+
And I should see "Summary from article with separator."
|
|
15
|
+
And I should see "Extended part from article with separator."
|
|
13
16
|
And I should not see "READMORE"
|
|
14
|
-
And I should not see "Summary from article with separator."
|
|
15
17
|
|
|
16
18
|
Scenario: Article has no summary separator
|
|
17
19
|
Given the Server is running at "summary-app"
|
|
@@ -40,9 +42,10 @@ Feature: Article summary generation
|
|
|
40
42
|
Then I should not see "Extended part from article with custom separator."
|
|
41
43
|
Then I should see "Extended part from article with separator."
|
|
42
44
|
When I go to "/2013/05/08/article-with-custom-separator.html"
|
|
45
|
+
Then I should see "<!doctype html>"
|
|
46
|
+
And I should see "Summary from article with custom separator."
|
|
43
47
|
And I should see "Extended part from article with custom separator."
|
|
44
|
-
|
|
45
|
-
Then I should not see "Summary from article with custom separator."
|
|
48
|
+
And I should not see "SPLIT_SUMMARY_BEFORE_THIS"
|
|
46
49
|
|
|
47
50
|
Scenario: Article has custom summary separator that's an HTML comment
|
|
48
51
|
Given a fixture app "summary-app"
|
|
@@ -62,9 +65,10 @@ Feature: Article summary generation
|
|
|
62
65
|
Then I should not see "Extended part from article with HTML comment separator."
|
|
63
66
|
Then I should see "Extended part from article with separator."
|
|
64
67
|
When I go to "/2016/05/21/article-with-comment-separator.html"
|
|
68
|
+
Then I should see "<!doctype html>"
|
|
69
|
+
And I should see "Summary from article with HTML comment separator."
|
|
65
70
|
And I should see "Extended part from article with HTML comment separator."
|
|
66
|
-
|
|
67
|
-
Then I should not see "Summary from article with HTML comment separator."
|
|
71
|
+
And I should not see "<!--more-->"
|
|
68
72
|
|
|
69
73
|
Scenario: Using a custom summary generator
|
|
70
74
|
Given a fixture app "summary-app"
|
|
@@ -120,3 +124,15 @@ Feature: Article summary generation
|
|
|
120
124
|
Then I should see "Summary4"
|
|
121
125
|
# it has a custom separator, which overrides explicit length, so we show up to the separator
|
|
122
126
|
Then I should see "Summary from article with separator."
|
|
127
|
+
|
|
128
|
+
Scenario: Article with separator preserves complete HTML document structure
|
|
129
|
+
Given the Server is running at "summary-app"
|
|
130
|
+
When I go to "/2011/01/01/article-with-standard-summary-separator.html"
|
|
131
|
+
Then I should see "<!doctype html>"
|
|
132
|
+
And I should see "<html>"
|
|
133
|
+
And I should see "<body>"
|
|
134
|
+
And I should see "</body>"
|
|
135
|
+
And I should see "</html>"
|
|
136
|
+
And I should see "Summary from article with separator."
|
|
137
|
+
And I should see "Extended part from article with separator."
|
|
138
|
+
And I should not see "READMORE"
|
|
@@ -46,23 +46,24 @@ module Middleman
|
|
|
46
46
|
##
|
|
47
47
|
def render(opts = {}, locs = {}, &block)
|
|
48
48
|
unless opts.key?(:layout)
|
|
49
|
-
|
|
50
49
|
opts[:layout] = metadata[:options][:layout]
|
|
51
50
|
opts[:layout] = blog_options.layout if opts[:layout].nil? || opts[:layout] == :_auto_layout
|
|
52
|
-
|
|
53
|
-
# Convert to a string unless it's a boolean
|
|
54
51
|
opts[:layout] = opts[:layout].to_s if opts[:layout].is_a? Symbol
|
|
55
|
-
|
|
56
52
|
end
|
|
57
53
|
|
|
58
54
|
content = super(opts, locs, &block)
|
|
59
55
|
|
|
60
|
-
# Handle summary separator: if not keeping separator and separator exists,
|
|
61
|
-
# return only content after separator
|
|
62
56
|
if blog_options.summary_separator && !opts[:keep_separator]
|
|
63
57
|
if content.match?(blog_options.summary_separator)
|
|
64
58
|
require 'middleman-blog/truncate_html'
|
|
65
|
-
|
|
59
|
+
|
|
60
|
+
# Only apply separator logic when rendering without layout
|
|
61
|
+
if opts[:layout] == false
|
|
62
|
+
content = TruncateHTML.content_after_separator(content, blog_options.summary_separator)
|
|
63
|
+
else
|
|
64
|
+
# When rendering with layout, just remove the separator marker but keep all content
|
|
65
|
+
content = content.gsub(blog_options.summary_separator, '')
|
|
66
|
+
end
|
|
66
67
|
end
|
|
67
68
|
end
|
|
68
69
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'active_support/core_ext/time/zones'
|
|
4
|
+
require 'active_support/version'
|
|
4
5
|
require 'middleman-blog/blog_data'
|
|
5
6
|
require 'middleman-blog/blog_article'
|
|
6
7
|
require 'middleman-blog/helpers'
|
|
@@ -125,7 +126,11 @@ module Middleman
|
|
|
125
126
|
@app.ignore(options.day_template) if options.day_template
|
|
126
127
|
@app.ignore options.tag_template if options.tag_template
|
|
127
128
|
|
|
128
|
-
|
|
129
|
+
# Receiver zone support is the only supported method in 8.1+, and the setting triggers a
|
|
130
|
+
# deprecation warning in 8.2, so only needed on older versions.
|
|
131
|
+
if ActiveSupport.version < Gem::Version.new('8.1')
|
|
132
|
+
ActiveSupport.to_time_preserves_timezone = :zone
|
|
133
|
+
end
|
|
129
134
|
|
|
130
135
|
# Make sure ActiveSupport's TimeZone stuff has something to work with,
|
|
131
136
|
# allowing people to set their desired time zone via Time.zone or
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: middleman-blog
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.2.
|
|
4
|
+
version: 4.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Reynolds
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2025-11-
|
|
13
|
+
date: 2025-11-07 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: middleman-core
|