middleman-vegas 0.1.3 → 0.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: 1ef0d9f166db457e15ae762d3ee860cbb653f77c
4
- data.tar.gz: f2a712731750ece093ddce2f4dbd228a07c47ef8
3
+ metadata.gz: '0669079980e36265ac0a4732961fb1ccbfb55e23'
4
+ data.tar.gz: 8af493e045a3f666f308df80f23c6b28c6bc605b
5
5
  SHA512:
6
- metadata.gz: d7fa28438de20f875b7990169839ae3a5cd3a8f4f26b22b816bfa2574b8096ddaecca50b8be9d0781725c41751b83fbb17bba7f61150a912203a1c8260c55deb
7
- data.tar.gz: b6d12faf4413a76144c2575cb92eb646037a485c2b25f3ae0f51d97295ae7eb8a819f2d58e5b6b82609b48259a37b6f3bc0d3ff5537a81a7bc341f693c070109
6
+ metadata.gz: da349e7f24869adea45066fae848cb79db4e1834aa50d4dfbc8cf8baf63775fc0e6e0ef2151f450e98bf718316f2ff929a0dbdbe49fcf19e1f022a90d0bb5db8
7
+ data.tar.gz: 8d478f12e9f05bbb91dfba78b588adfe0cb2ad0a961756007f8f34feeff38bd078919cc649ec71372536dae43083aec3e94928c65ae7da0a43811f4306de9352
@@ -9,7 +9,7 @@ module Middleman
9
9
  # CODE
10
10
  # ```
11
11
  def self.parse_document(full_document)
12
- full_document.gsub /^`{3}.+?`{3}/m do |code_block|
12
+ full_document.gsub /^\s{0,4}`{3}.+?`{3}/m do |code_block|
13
13
  parse_code_block code_block
14
14
  end
15
15
  end
@@ -21,10 +21,13 @@ module Middleman
21
21
  # ```
22
22
  #
23
23
  def self.parse_code_block(code_block)
24
- code_block.gsub /`{3}([^\n]+)?\n(.+?)`{3}\Z/m do
25
- metadata = get_metadata(Regexp.last_match(1).to_s)
26
- code = Regexp.last_match(2).to_s
27
- ::Middleman::Vegas::Highlighter.highlight(code, metadata)
24
+ code_block.gsub /(\s{0,4})`{3}([^\n]+)?\n(.+?)`{3}\Z/m do
25
+ spacing = Regexp.last_match(1)
26
+ spacing = (spacing == "\n" ? "" : spacing)
27
+ metadata = get_metadata(Regexp.last_match(2).to_s)
28
+ code = Regexp.last_match(3).to_s
29
+ trimmed_code = code.gsub("\n#{spacing}","\n")[spacing.length..-1]
30
+ "#{spacing}#{::Middleman::Vegas::Highlighter.highlight(trimmed_code, metadata)}"
28
31
  end
29
32
  end
30
33
 
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Vegas
3
- VERSION = '0.1.3'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-vegas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franklin Webber
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-03 00:00:00.000000000 Z
11
+ date: 2017-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core