blog-generator 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/blog-generator/post.rb +8 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cf3093b6c8dbf159c433177cf149ee398adc783
4
- data.tar.gz: bd20c2a6c5889890067f6e20c622b32aa0bec78d
3
+ metadata.gz: 156e5179eab439dfe19f7585b0d9bafb7eef00a1
4
+ data.tar.gz: a5363bf3adf5ac5b2d3393427ae29fb4704b90d9
5
5
  SHA512:
6
- metadata.gz: 2c6dde16d351c39d026414e0a35170a1d7b93728327c6cbb4329259f35241b06436f426826dc9fda1c88062cd16b169e9999e4a917a931ac65aba60e8823760e
7
- data.tar.gz: b8c6d66fd754bc063c4332aaed3b1530be6e6c2927be0f170aa3c43e107a3d00d15ed8b49953846e030dfe8b0e6ee1b344ba702be5d18701c9f56edc8bf86e44
6
+ metadata.gz: 8339ffc7bcc28ce14951ee12e1fdc56cabbed290f45f0676c2aa5bd961fcbb255339f43c2df4ac83b5f9aaee80d321843491621ff225eaacdba0bf0a1de594fd
7
+ data.tar.gz: 003eff2cdbbc1ad041ff6bc887692d7dbbd9fcd180472d99ee1e6d96860bf8b3857e3535d07efdbd789dcf5ff48a2bae61aa7ce9ef66dddfe16244873ea0a197
@@ -97,12 +97,16 @@ module BlogGenerator
97
97
 
98
98
  # This is a terrible hack to make unescaped code possible.
99
99
  def post_process_body(text)
100
- regexp = /<code lang="(\w+)">\n?(.*?)<\/code>/m
101
- original_body_matches = self.raw_body.scan(regexp)
100
+ regexp = /<code lang="(\w+)"(?: file="([^"]+)")?>\n?(.*?)<\/code>/m
101
+ p original_body_matches = self.raw_body.scan(regexp)
102
102
 
103
103
  text.gsub(regexp).with_index do |pre, index|
104
- language, code = original_body_matches[index]
105
- "<pre><code class=\"#{language}\">#{CGI.escapeHTML(code)}</code></pre>"
104
+ language, file, code = original_body_matches[index]
105
+ if file
106
+ "<figure><figcaption class='filepath'>#{file}</figcaption><pre><code class=\"#{language}\">#{CGI.escapeHTML(code)}</code></pre></figure>"
107
+ else
108
+ "<pre><code class=\"#{language}\">#{CGI.escapeHTML(code)}</code></pre>"
109
+ end
106
110
  end
107
111
  end
108
112
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blog-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - James C Russell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-14 00:00:00.000000000 Z
11
+ date: 2017-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri