middleman-core 3.1.3 → 3.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3bad6e93b50e8000b3eeaf4ba03683bf24dcac9
4
- data.tar.gz: a6e1e3a5a01a52630de3b8a5e14d19af24db286f
3
+ metadata.gz: b1a1dedbf7d4f3e960822c366d874721b693063f
4
+ data.tar.gz: 86c7fc7a7be9505d48d8e32a426e40a70fbfe24c
5
5
  SHA512:
6
- metadata.gz: c2470a181763cd1dbb08133c7b8276bffc4087633027271ef0a3d8e412966639ab0fb3ab12edd222c208d76fd5eb4d4d0dc822ea45ba5b80522795ad3be42e61
7
- data.tar.gz: ff1f7cbb5b7815eb2a547e4788775a1cb86e0270871e3edda1e6bcc943cd4594d80506755531e514cb6a91b7001834e722fd06658aff657c8b14db8021f97ee4
6
+ metadata.gz: 85adeed7a5ac88e08fd12b9f1d16f7bfcf4c728a2238caedbdbb0b0c7dc9c15f5fe03f2542dd22632472ca424bcf18b49ca0c74274a9a7150e2b3df23858760e
7
+ data.tar.gz: d61bfccd6fdcd63cedeada4fe03b6147fe98507b458477cced21823efd0fbb8dce2619bf191854de072965c227525113d191fa2667bb3cd1a3cba5655e9b7b8a
@@ -42,6 +42,32 @@ Feature: Markdown support
42
42
  When I go to "/hard_wrap.html"
43
43
  Then I should see "br"
44
44
 
45
+ Scenario: Redcarpet 2 no_images extension (with overrides)
46
+ Given a fixture app "markdown-app"
47
+ And a file named "config.rb" with:
48
+ """
49
+ set :markdown_engine, :redcarpet
50
+ set :markdown, :no_images => true
51
+
52
+ """
53
+ Given the Server is running at "markdown-app"
54
+ When I go to "/img.html"
55
+ Then I should see "![dust mite](http://dust.mite/image.png)"
56
+ And I should not see "<img"
57
+
58
+ Scenario: Redcarpet 2 no_links extension (with overrides)
59
+ Given a fixture app "markdown-app"
60
+ And a file named "config.rb" with:
61
+ """
62
+ set :markdown_engine, :redcarpet
63
+ set :markdown, :no_links => true
64
+
65
+ """
66
+ Given the Server is running at "markdown-app"
67
+ When I go to "/link.html"
68
+ Then I should see "[This link](http://example.net/) links"
69
+ And I should not see "<a"
70
+
45
71
  Scenario: Redcarpet per-page frontmatter options
46
72
  Given a fixture app "markdown-frontmatter-options-app"
47
73
  And a file named "config.rb" with:
@@ -203,7 +203,7 @@ Feature: Minify Javascript
203
203
  """
204
204
  And the Server is running at "passthrough-app"
205
205
  When I go to "/inline-coffeescript.html"
206
- Then I should see "14" lines
206
+ Then I should see "13" lines
207
207
 
208
208
  Scenario: Rendering external js (coffeescript) with a passthrough minifier
209
209
  Given a fixture app "passthrough-app"
@@ -221,5 +221,5 @@ Feature: Minify Javascript
221
221
  """
222
222
  And the Server is running at "passthrough-app"
223
223
  When I go to "/javascripts/coffee_test.js"
224
- Then I should see "12" lines
224
+ Then I should see "11" lines
225
225
 
@@ -0,0 +1 @@
1
+ ![dust mite](http://dust.mite/image.png) <img src="image.png" />
@@ -0,0 +1 @@
1
+ [This link](http://example.net/) <a href="links.html">links</a>
@@ -119,7 +119,7 @@ module Middleman::CoreExtensions
119
119
  # Parse YAML frontmatter out of a string
120
120
  # @param [String] content
121
121
  # @return [Array<Hash, String>]
122
- def parse_yaml_front_matter(content)
122
+ def parse_yaml_front_matter(content, full_path)
123
123
  yaml_regex = /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
124
124
  if content =~ yaml_regex
125
125
  content = content.sub(yaml_regex, "")
@@ -128,7 +128,7 @@ module Middleman::CoreExtensions
128
128
  data = YAML.load($1) || {}
129
129
  data = data.symbolize_keys
130
130
  rescue *YAML_ERRORS => e
131
- app.logger.error "YAML Exception: #{e.message}"
131
+ app.logger.error "YAML Exception parsing #{full_path}: #{e.message}"
132
132
  return false
133
133
  end
134
134
  else
@@ -140,7 +140,7 @@ module Middleman::CoreExtensions
140
140
  [{}, content]
141
141
  end
142
142
 
143
- def parse_json_front_matter(content)
143
+ def parse_json_front_matter(content, full_path)
144
144
  json_regex = /\A(;;;\s*\n.*?\n?)^(;;;\s*$\n?)/m
145
145
 
146
146
  if content =~ json_regex
@@ -150,7 +150,7 @@ module Middleman::CoreExtensions
150
150
  json = ($1+$2).sub(";;;", "{").sub(";;;", "}")
151
151
  data = ActiveSupport::JSON.decode(json).symbolize_keys
152
152
  rescue => e
153
- app.logger.error "JSON Exception: #{e.message}"
153
+ app.logger.error "JSON Exception parsing #{full_path}: #{e.message}"
154
154
  return false
155
155
  end
156
156
 
@@ -186,7 +186,7 @@ module Middleman::CoreExtensions
186
186
  content = lines.join("\n")
187
187
  end
188
188
 
189
- result = parse_yaml_front_matter(content) || parse_json_front_matter(content)
189
+ result = parse_yaml_front_matter(content, full_path) || parse_json_front_matter(content, full_path)
190
190
  return result if result
191
191
  rescue
192
192
  # Probably a binary file, move on
@@ -70,8 +70,8 @@ module Middleman
70
70
  app = ::Rack::Builder.new
71
71
  app.use Rack::Lint
72
72
 
73
- Array(@middleware).each do |klass, options, blockm|
74
- app.use(klass, *options, &blockm)
73
+ Array(@middleware).each do |klass, options, block|
74
+ app.use(klass, *options, &block)
75
75
  end
76
76
 
77
77
  inner_app = inst(&block)
@@ -291,8 +291,13 @@ module Middleman
291
291
  file = ::Rack::File.new nil
292
292
  file.path = resource.source_file
293
293
  response = file.serving(env)
294
+ status = response[0]
294
295
  response[1]['Content-Encoding'] = 'gzip' if %w(.svgz .gz).include?(resource.ext)
295
- response[1]['Content-Type'] = resource.content_type || "application/octet-stream"
296
+ # Do not set Content-Type if status is 1xx, 204, 205 or 304, otherwise
297
+ # Rack will throw an error (500)
298
+ if !(100..199).include?(status) && ![204, 205, 304].include?(status)
299
+ response[1]['Content-Type'] = resource.content_type || "application/octet-stream"
300
+ end
296
301
  halt response
297
302
  end
298
303
  end
@@ -15,11 +15,11 @@ module Middleman
15
15
  key_classes << 'modified' if @setting.value_set?
16
16
  content << content_tag(:span, @setting.key.inspect, :class => key_classes.join(' '))
17
17
  content << " = "
18
- content << content_tag(:span, CGI::escapeHTML(@setting.value.inspect), :class => 'value')
18
+ content << content_tag(:span, @setting.value.inspect, :class => 'value')
19
19
  if @setting.default
20
20
  content << content_tag(:span, :class => 'default') do
21
21
  if @setting.value_set?
22
- "Default: #{CGI::escapeHTML(@setting.default.inspect)}"
22
+ "Default: #{@setting.default.inspect}"
23
23
  else
24
24
  "(Default)"
25
25
  end
@@ -23,10 +23,10 @@ module Middleman
23
23
  row_content = ""
24
24
  row_content << content_tag(:th, label)
25
25
  row_content << content_tag(:td, value)
26
- row_content
26
+ row_content.html_safe
27
27
  end
28
28
  end
29
- content
29
+ content.html_safe
30
30
  end
31
31
  end
32
32
  end
@@ -21,7 +21,7 @@ module Middleman
21
21
  end
22
22
 
23
23
  # Renderer Options
24
- possible_render_opts = [:filter_html, :no_images, :no_links, :no_styles, :safe_links_only, :with_toc_data, :hard_wrap, :xhtml]
24
+ possible_render_opts = [:filter_html, :no_images, :no_links, :no_styles, :safe_links_only, :with_toc_data, :hard_wrap, :xhtml, :prettify, :link_attributes]
25
25
 
26
26
  render_options = possible_render_opts.inject({}) do |sum, opt|
27
27
  sum[opt] = options.delete(opt) if options.has_key?(opt)
@@ -36,12 +36,30 @@ module Middleman
36
36
  class MiddlemanRedcarpetHTML < ::Redcarpet::Render::HTML
37
37
  cattr_accessor :middleman_app
38
38
 
39
+ def initialize(options={})
40
+ @local_options = options.dup
41
+
42
+ super
43
+ end
44
+
39
45
  def image(link, title, alt_text)
40
- middleman_app.image_tag(link, :title => title, :alt => alt_text)
46
+ if !@local_options[:no_images]
47
+ middleman_app.image_tag(link, :title => title, :alt => alt_text)
48
+ else
49
+ link_string = link.dup
50
+ link_string << %Q{"#{title}"} if title && title.length > 0 && title != alt_text
51
+ %Q{![#{alt_text}](#{link_string})}
52
+ end
41
53
  end
42
54
 
43
55
  def link(link, title, content)
44
- middleman_app.link_to(content, link, :title => title)
56
+ if !@local_options[:no_links]
57
+ middleman_app.link_to(content, link, :title => title)
58
+ else
59
+ link_string = link.dup
60
+ link_string << %Q{"#{title}"} if title && title.length > 0 && title != alt_text
61
+ %Q{[#{content}](#{link_string})}
62
+ end
45
63
  end
46
64
  end
47
65
 
@@ -2,6 +2,9 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem "middleman", "~><%= Middleman::VERSION %>"
4
4
 
5
+ # For faster file watcher updates on Windows:
6
+ gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]
7
+
5
8
  # Cross-templating language block fix for Ruby 1.8
6
9
  platforms :mri_18 do
7
10
  gem "ruby18_source_location"
@@ -7,8 +7,8 @@ gem "middleman", "~><%= Middleman::VERSION %>"
7
7
  # Live-reloading plugin
8
8
  gem "middleman-livereload", "~> 3.1.0"
9
9
 
10
- # For faster file watcher updates:
11
- # gem "wdm", "~> 0.1.0") # Windows
10
+ # For faster file watcher updates on Windows:
11
+ gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]
12
12
 
13
13
  # Cross-templating language block fix for Ruby 1.8
14
14
  platforms :mri_18 do
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  # Current Version
3
3
  # @return [String]
4
- VERSION = '3.1.3' unless const_defined?(:VERSION)
4
+ VERSION = '3.1.4' unless const_defined?(:VERSION)
5
5
  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.3
4
+ version: 3.1.4
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-02 00:00:00.000000000 Z
12
+ date: 2013-07-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -580,7 +580,9 @@ files:
580
580
  - fixtures/markdown-app/source/fenced_code_blocks.html.markdown
581
581
  - fixtures/markdown-app/source/hard_wrap.html.markdown
582
582
  - fixtures/markdown-app/source/images/blank.gif
583
+ - fixtures/markdown-app/source/img.html.markdown
583
584
  - fixtures/markdown-app/source/index.html.markdown
585
+ - fixtures/markdown-app/source/link.html.markdown
584
586
  - fixtures/markdown-app/source/no_intra_emphasis.html.markdown
585
587
  - fixtures/markdown-app/source/smarty_pants.html.markdown
586
588
  - fixtures/markdown-app/source/space_after_headers.html.markdown
@@ -1788,7 +1790,9 @@ test_files:
1788
1790
  - fixtures/markdown-app/source/fenced_code_blocks.html.markdown
1789
1791
  - fixtures/markdown-app/source/hard_wrap.html.markdown
1790
1792
  - fixtures/markdown-app/source/images/blank.gif
1793
+ - fixtures/markdown-app/source/img.html.markdown
1791
1794
  - fixtures/markdown-app/source/index.html.markdown
1795
+ - fixtures/markdown-app/source/link.html.markdown
1792
1796
  - fixtures/markdown-app/source/no_intra_emphasis.html.markdown
1793
1797
  - fixtures/markdown-app/source/smarty_pants.html.markdown
1794
1798
  - fixtures/markdown-app/source/space_after_headers.html.markdown