middleman-core 3.1.4 → 3.1.5
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/features/markdown_redcarpet.feature +75 -20
- data/fixtures/generator-test/config.rb +1 -1
- data/fixtures/markdown-app/source/filter_html.html.markdown +1 -0
- data/fixtures/markdown-app/source/footnote.html.markdown +3 -0
- data/fixtures/markdown-app/source/highlighted.html.markdown +1 -0
- data/fixtures/markdown-app/source/indented_code_blocks.html.markdown +5 -0
- data/fixtures/markdown-app/source/lax_spacing.html.markdown +3 -0
- data/fixtures/markdown-app/source/prettify.html.markdown +3 -0
- data/fixtures/markdown-app/source/quote.html.markdown +1 -0
- data/fixtures/markdown-app/source/safe_links.html.markdown +1 -0
- data/fixtures/markdown-app/source/underline.html.markdown +1 -0
- data/fixtures/markdown-app/source/with_toc_data.html.markdown +2 -2
- data/lib/middleman-core/cli/server.rb +7 -1
- data/lib/middleman-core/core_extensions/front_matter.rb +1 -1
- data/lib/middleman-core/core_extensions/rendering.rb +2 -2
- data/lib/middleman-core/preview_server.rb +1 -0
- data/lib/middleman-core/renderers/redcarpet.rb +21 -1
- data/lib/middleman-core/templates/shared/config.tt +1 -1
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman-more/core_extensions/default_helpers.rb +1 -1
- data/lib/middleman-more/extensions/automatic-alt-tags.rb +32 -0
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c57d497044df7725a8dbf742d1ad1145ddb43f81
|
4
|
+
data.tar.gz: a44fcf58e1c0b9aa89df85bb0495b95b1474a182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1a07b30081dedb39503aca5d0f0a983f1c1c54ca55a8a82eb4bd418a34eabc6ea00626cb7fe47ebfa133856969d7a2d2ee7de3b03c1fafc3d98a4ed0a5342e9
|
7
|
+
data.tar.gz: c640e8874882a1a991355cab16380407f0a164b35fb18bb8c41550effabcc53c76f942e02d714dc67618798aa3d12796aad7940685a59ddaa45e0ba448587fff
|
@@ -12,17 +12,12 @@ Feature: Markdown support
|
|
12
12
|
:fenced_code_blocks => true,
|
13
13
|
:autolink => true,
|
14
14
|
:strikethrough => true,
|
15
|
-
:lax_html_blocks => true,
|
16
15
|
:space_after_headers => true,
|
17
|
-
:with_toc_data => true,
|
18
16
|
:superscript => true,
|
19
|
-
:
|
20
|
-
|
21
|
-
|
17
|
+
:lax_spacing => true
|
18
|
+
|
22
19
|
"""
|
23
20
|
Given the Server is running at "markdown-app"
|
24
|
-
When I go to "/smarty_pants.html"
|
25
|
-
Then I should see "“"
|
26
21
|
When I go to "/no_intra_emphasis.html"
|
27
22
|
Then I should not see "<em>"
|
28
23
|
When I go to "/tables.html"
|
@@ -37,36 +32,97 @@ Feature: Markdown support
|
|
37
32
|
Then I should not see "<h1>"
|
38
33
|
When I go to "/superscript.html"
|
39
34
|
Then I should see "<sup>"
|
40
|
-
When I go to "/
|
41
|
-
Then I should see "
|
42
|
-
|
43
|
-
|
35
|
+
When I go to "/lax_spacing.html"
|
36
|
+
Then I should see "<p>hello</p>"
|
37
|
+
|
38
|
+
@no18
|
39
|
+
Scenario: Redcarpet 3 extensions
|
40
|
+
Given a fixture app "markdown-app"
|
41
|
+
And a file named "config.rb" with:
|
42
|
+
"""
|
43
|
+
set :markdown_engine, :redcarpet
|
44
|
+
set :markdown, :underline => true,
|
45
|
+
:highlight => true,
|
46
|
+
:disable_indented_code_blocks => true
|
47
|
+
"""
|
48
|
+
Given the Server is running at "markdown-app"
|
49
|
+
When I go to "/underline.html"
|
50
|
+
Then I should see "<u>underlined</u>"
|
51
|
+
When I go to "/highlighted.html"
|
52
|
+
Then I should see "<mark>highlighted</mark>"
|
53
|
+
When I go to "/indented_code_blocks.html"
|
54
|
+
Then I should not see "<code>"
|
44
55
|
|
45
|
-
Scenario: Redcarpet
|
56
|
+
Scenario: Redcarpet smartypants extension
|
46
57
|
Given a fixture app "markdown-app"
|
47
58
|
And a file named "config.rb" with:
|
48
59
|
"""
|
49
60
|
set :markdown_engine, :redcarpet
|
50
|
-
set :markdown, :
|
51
|
-
|
61
|
+
set :markdown, :smartypants => true
|
52
62
|
"""
|
53
63
|
Given the Server is running at "markdown-app"
|
64
|
+
When I go to "/smarty_pants.html"
|
65
|
+
Then I should see "“"
|
66
|
+
|
67
|
+
Scenario: Redcarpet::Render::HTML options
|
68
|
+
Given a fixture app "markdown-app"
|
69
|
+
And a file named "config.rb" with:
|
70
|
+
"""
|
71
|
+
set :markdown_engine, :redcarpet
|
72
|
+
set :markdown, :filter_html => true,
|
73
|
+
:no_images => true,
|
74
|
+
:no_links => true,
|
75
|
+
:with_toc_data => true,
|
76
|
+
:hard_wrap => true,
|
77
|
+
:safe_links_only => true,
|
78
|
+
:prettify => true
|
79
|
+
|
80
|
+
"""
|
81
|
+
Given the Server is running at "markdown-app"
|
82
|
+
When I go to "/filter_html.html"
|
83
|
+
Then I should not see "<em>"
|
54
84
|
When I go to "/img.html"
|
55
85
|
Then I should see ""
|
56
86
|
And I should not see "<img"
|
87
|
+
When I go to "/with_toc_data.html"
|
88
|
+
Then I should see 'id="toc_0"'
|
89
|
+
And I should see 'id="toc_1"'
|
90
|
+
When I go to "/hard_wrap.html"
|
91
|
+
Then I should see "br"
|
92
|
+
When I go to "/link.html"
|
93
|
+
Then I should see "[This link](http://example.net/) links"
|
94
|
+
And I should not see "<a"
|
95
|
+
When I go to "/safe_links.html"
|
96
|
+
Then I should see "[IRC](irc://chat.freenode.org/#freenode)"
|
97
|
+
When I go to "/prettify.html"
|
98
|
+
Then I should see '<code class="prettyprint">'
|
57
99
|
|
58
|
-
Scenario: Redcarpet
|
100
|
+
Scenario: Redcarpet link_attributes option
|
59
101
|
Given a fixture app "markdown-app"
|
60
102
|
And a file named "config.rb" with:
|
61
103
|
"""
|
62
104
|
set :markdown_engine, :redcarpet
|
63
|
-
set :markdown, :
|
64
|
-
|
105
|
+
set :markdown, :link_attributes => { :target => "_blank" }
|
106
|
+
"""
|
107
|
+
And a file named "source/link.html.markdown" with:
|
108
|
+
"""
|
109
|
+
[A link](/foo.html)
|
65
110
|
"""
|
66
111
|
Given the Server is running at "markdown-app"
|
67
112
|
When I go to "/link.html"
|
68
|
-
Then I should see "
|
69
|
-
|
113
|
+
Then I should see 'target="_blank"'
|
114
|
+
|
115
|
+
Scenario: Redcarpet xhtml option
|
116
|
+
Given a fixture app "markdown-app"
|
117
|
+
And a file named "config.rb" with:
|
118
|
+
"""
|
119
|
+
set :markdown_engine, :redcarpet
|
120
|
+
set :markdown, :xhtml => true,
|
121
|
+
:hard_wrap => true
|
122
|
+
"""
|
123
|
+
Given the Server is running at "markdown-app"
|
124
|
+
When I go to "/hard_wrap.html"
|
125
|
+
Then I should see "<br/>"
|
70
126
|
|
71
127
|
Scenario: Redcarpet per-page frontmatter options
|
72
128
|
Given a fixture app "markdown-frontmatter-options-app"
|
@@ -109,4 +165,3 @@ Feature: Markdown support
|
|
109
165
|
Then I should see 'width="1"'
|
110
166
|
And I should see 'height="1"'
|
111
167
|
And I should see 'src="/images/blank.gif"'
|
112
|
-
|
@@ -0,0 +1 @@
|
|
1
|
+
I <em>shouldn't</em> be emphasised
|
@@ -0,0 +1 @@
|
|
1
|
+
this is ==highlighted==
|
@@ -0,0 +1 @@
|
|
1
|
+
this is "quote"
|
@@ -0,0 +1 @@
|
|
1
|
+
[IRC](irc://chat.freenode.org/#freenode)
|
@@ -0,0 +1 @@
|
|
1
|
+
hello _underlined_ text
|
@@ -1,3 +1,3 @@
|
|
1
|
-
# Header
|
1
|
+
# First Header
|
2
2
|
|
3
|
-
## Header
|
3
|
+
## Second Header
|
@@ -45,6 +45,11 @@ module Middleman::Cli
|
|
45
45
|
:type => :boolean,
|
46
46
|
:default => false,
|
47
47
|
:desc => 'Force file watcher into polling mode'
|
48
|
+
method_option :latency,
|
49
|
+
:type => :numeric,
|
50
|
+
:aliases => "-l",
|
51
|
+
:default => 0.25,
|
52
|
+
:desc => 'Set file watcher latency, in seconds'
|
48
53
|
|
49
54
|
# Start the server
|
50
55
|
def server
|
@@ -66,7 +71,8 @@ module Middleman::Cli
|
|
66
71
|
:instrumenting => options["instrument"],
|
67
72
|
:disable_watcher => options["disable_watcher"],
|
68
73
|
:reload_paths => options["reload_paths"],
|
69
|
-
:force_polling => options["force_polling"]
|
74
|
+
:force_polling => options["force_polling"],
|
75
|
+
:latency => options["latency"]
|
70
76
|
}
|
71
77
|
|
72
78
|
puts "== The Middleman is loading"
|
@@ -191,7 +191,7 @@ module Middleman
|
|
191
191
|
engine = File.extname(resource.source_file)[1..-1].to_sym
|
192
192
|
|
193
193
|
# Look for partials relative to the current path
|
194
|
-
relative_dir = File.join(current_dir.sub(%r{^#{self.source_dir}/?}, ""), data)
|
194
|
+
relative_dir = File.join(current_dir.sub(%r{^#{Regexp.escape(self.source_dir)}/?}, ""), data)
|
195
195
|
|
196
196
|
# Try to use the current engine first
|
197
197
|
found_partial, found_engine = resolve_template(relative_dir, :preferred_engine => engine, :try_without_underscore => true)
|
@@ -277,7 +277,7 @@ module Middleman
|
|
277
277
|
content = callback.call(content, path, locs, template_class)
|
278
278
|
end
|
279
279
|
|
280
|
-
output = ::ActiveSupport::SafeBuffer.new
|
280
|
+
output = ::ActiveSupport::SafeBuffer.new ""
|
281
281
|
output.safe_concat content
|
282
282
|
output
|
283
283
|
ensure
|
@@ -104,6 +104,7 @@ module Middleman
|
|
104
104
|
# Watcher Library
|
105
105
|
require "listen"
|
106
106
|
@listener = Listen.to(Dir.pwd, :relative_paths => true, :force_polling => @options[:force_polling])
|
107
|
+
@listener.latency(@options[:latency])
|
107
108
|
end
|
108
109
|
|
109
110
|
@listener.change do |modified, added, removed|
|
@@ -4,12 +4,21 @@ module Middleman
|
|
4
4
|
module Renderers
|
5
5
|
|
6
6
|
class RedcarpetTemplate < ::Tilt::RedcarpetTemplate::Redcarpet2
|
7
|
+
|
8
|
+
# because tilt has decided to convert these
|
9
|
+
# in the wrong direction
|
10
|
+
ALIASES = {
|
11
|
+
:escape_html => :filter_html
|
12
|
+
}
|
13
|
+
|
7
14
|
# Overwrite built-in Tilt version.
|
8
15
|
# Don't overload :renderer option with smartypants
|
9
16
|
# Support renderer-level options
|
10
17
|
def generate_renderer
|
11
18
|
return options.delete(:renderer) if options.has_key?(:renderer)
|
12
19
|
|
20
|
+
covert_options_to_aliases!
|
21
|
+
|
13
22
|
# Pick a renderer
|
14
23
|
renderer = MiddlemanRedcarpetHTML
|
15
24
|
|
@@ -30,6 +39,14 @@ module Middleman
|
|
30
39
|
|
31
40
|
renderer.new(render_options)
|
32
41
|
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def covert_options_to_aliases!
|
46
|
+
ALIASES.each do |aka, actual|
|
47
|
+
options[actual] = options.delete(aka) if options.has_key? aka
|
48
|
+
end
|
49
|
+
end
|
33
50
|
end
|
34
51
|
|
35
52
|
# Custom Redcarpet renderer that uses our helpers for images and links
|
@@ -54,7 +71,10 @@ module Middleman
|
|
54
71
|
|
55
72
|
def link(link, title, content)
|
56
73
|
if !@local_options[:no_links]
|
57
|
-
|
74
|
+
attributes = { :title => title }
|
75
|
+
attributes.merge!( @local_options[:link_attributes] ) if @local_options[:link_attributes]
|
76
|
+
|
77
|
+
middleman_app.link_to(content, link, attributes )
|
58
78
|
else
|
59
79
|
link_string = link.dup
|
60
80
|
link_string << %Q{"#{title}"} if title && title.length > 0 && title != alt_text
|
@@ -124,7 +124,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
|
|
124
124
|
# If the basename of the request as no extension, assume we are serving a
|
125
125
|
# directory and join index_file to the path.
|
126
126
|
path = File.join(asset_dir, current_path)
|
127
|
-
path = path.sub(/#{File.extname(path)}$/, ".#{asset_ext}")
|
127
|
+
path = path.sub(/#{Regexp.escape(File.extname(path))}$/, ".#{asset_ext}")
|
128
128
|
|
129
129
|
yield path if sitemap.find_resource_by_path(path)
|
130
130
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Automatic Image alt tags from image names extension
|
2
|
+
class Middleman::Extensions::AutomaticAltTags < ::Middleman::Extension
|
3
|
+
|
4
|
+
def initialize(app, options_hash={}, &block)
|
5
|
+
super
|
6
|
+
end
|
7
|
+
|
8
|
+
helpers do
|
9
|
+
# Override default image_tag helper to automatically insert alt tag
|
10
|
+
# containing image name.
|
11
|
+
|
12
|
+
def image_tag(path)
|
13
|
+
if !path.include?("://")
|
14
|
+
params[:alt] ||= ""
|
15
|
+
|
16
|
+
real_path = path
|
17
|
+
real_path = File.join(images_dir, real_path) unless real_path.start_with?('/')
|
18
|
+
full_path = File.join(source_dir, real_path)
|
19
|
+
|
20
|
+
if File.exists?(full_path)
|
21
|
+
begin
|
22
|
+
alt_text = File.basename(full_path, ".*")
|
23
|
+
alt_text.capitalize!
|
24
|
+
params[:alt] = alt_text
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
super(path)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Reynolds
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07
|
12
|
+
date: 2013-09-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -578,17 +578,26 @@ files:
|
|
578
578
|
- fixtures/markdown-app/config.rb
|
579
579
|
- fixtures/markdown-app/source/autolink.html.markdown
|
580
580
|
- fixtures/markdown-app/source/fenced_code_blocks.html.markdown
|
581
|
+
- fixtures/markdown-app/source/filter_html.html.markdown
|
582
|
+
- fixtures/markdown-app/source/footnote.html.markdown
|
581
583
|
- fixtures/markdown-app/source/hard_wrap.html.markdown
|
584
|
+
- fixtures/markdown-app/source/highlighted.html.markdown
|
582
585
|
- fixtures/markdown-app/source/images/blank.gif
|
583
586
|
- fixtures/markdown-app/source/img.html.markdown
|
587
|
+
- fixtures/markdown-app/source/indented_code_blocks.html.markdown
|
584
588
|
- fixtures/markdown-app/source/index.html.markdown
|
589
|
+
- fixtures/markdown-app/source/lax_spacing.html.markdown
|
585
590
|
- fixtures/markdown-app/source/link.html.markdown
|
586
591
|
- fixtures/markdown-app/source/no_intra_emphasis.html.markdown
|
592
|
+
- fixtures/markdown-app/source/prettify.html.markdown
|
593
|
+
- fixtures/markdown-app/source/quote.html.markdown
|
594
|
+
- fixtures/markdown-app/source/safe_links.html.markdown
|
587
595
|
- fixtures/markdown-app/source/smarty_pants.html.markdown
|
588
596
|
- fixtures/markdown-app/source/space_after_headers.html.markdown
|
589
597
|
- fixtures/markdown-app/source/strikethrough.html.markdown
|
590
598
|
- fixtures/markdown-app/source/superscript.html.markdown
|
591
599
|
- fixtures/markdown-app/source/tables.html.markdown
|
600
|
+
- fixtures/markdown-app/source/underline.html.markdown
|
592
601
|
- fixtures/markdown-app/source/with_toc_data.html.markdown
|
593
602
|
- fixtures/markdown-frontmatter-options-app/config.rb
|
594
603
|
- fixtures/markdown-frontmatter-options-app/source/smarty_pants-default.html.markdown
|
@@ -1093,6 +1102,7 @@ files:
|
|
1093
1102
|
- lib/middleman-more/core_extensions/i18n.rb
|
1094
1103
|
- lib/middleman-more/extensions/asset_hash.rb
|
1095
1104
|
- lib/middleman-more/extensions/asset_host.rb
|
1105
|
+
- lib/middleman-more/extensions/automatic-alt-tags.rb
|
1096
1106
|
- lib/middleman-more/extensions/automatic_image_sizes.rb
|
1097
1107
|
- lib/middleman-more/extensions/cache_buster.rb
|
1098
1108
|
- lib/middleman-more/extensions/directory_indexes.rb
|
@@ -1349,7 +1359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1349
1359
|
version: '0'
|
1350
1360
|
requirements: []
|
1351
1361
|
rubyforge_project:
|
1352
|
-
rubygems_version: 2.0.
|
1362
|
+
rubygems_version: 2.0.3
|
1353
1363
|
signing_key:
|
1354
1364
|
specification_version: 4
|
1355
1365
|
summary: Hand-crafted frontend development
|
@@ -1788,17 +1798,26 @@ test_files:
|
|
1788
1798
|
- fixtures/markdown-app/config.rb
|
1789
1799
|
- fixtures/markdown-app/source/autolink.html.markdown
|
1790
1800
|
- fixtures/markdown-app/source/fenced_code_blocks.html.markdown
|
1801
|
+
- fixtures/markdown-app/source/filter_html.html.markdown
|
1802
|
+
- fixtures/markdown-app/source/footnote.html.markdown
|
1791
1803
|
- fixtures/markdown-app/source/hard_wrap.html.markdown
|
1804
|
+
- fixtures/markdown-app/source/highlighted.html.markdown
|
1792
1805
|
- fixtures/markdown-app/source/images/blank.gif
|
1793
1806
|
- fixtures/markdown-app/source/img.html.markdown
|
1807
|
+
- fixtures/markdown-app/source/indented_code_blocks.html.markdown
|
1794
1808
|
- fixtures/markdown-app/source/index.html.markdown
|
1809
|
+
- fixtures/markdown-app/source/lax_spacing.html.markdown
|
1795
1810
|
- fixtures/markdown-app/source/link.html.markdown
|
1796
1811
|
- fixtures/markdown-app/source/no_intra_emphasis.html.markdown
|
1812
|
+
- fixtures/markdown-app/source/prettify.html.markdown
|
1813
|
+
- fixtures/markdown-app/source/quote.html.markdown
|
1814
|
+
- fixtures/markdown-app/source/safe_links.html.markdown
|
1797
1815
|
- fixtures/markdown-app/source/smarty_pants.html.markdown
|
1798
1816
|
- fixtures/markdown-app/source/space_after_headers.html.markdown
|
1799
1817
|
- fixtures/markdown-app/source/strikethrough.html.markdown
|
1800
1818
|
- fixtures/markdown-app/source/superscript.html.markdown
|
1801
1819
|
- fixtures/markdown-app/source/tables.html.markdown
|
1820
|
+
- fixtures/markdown-app/source/underline.html.markdown
|
1802
1821
|
- fixtures/markdown-app/source/with_toc_data.html.markdown
|
1803
1822
|
- fixtures/markdown-frontmatter-options-app/config.rb
|
1804
1823
|
- fixtures/markdown-frontmatter-options-app/source/smarty_pants-default.html.markdown
|