octopress-codefence 1.0.0 → 1.1.0

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDkzMjYyY2VkNmFiZTdkNGE0NmViYjE0ZGQ4ODE0ZDA0NmM2MDkwZA==
5
+ data.tar.gz: !binary |-
6
+ ZWQ2ZjgxOWJiNDljZWI3Zjg1NDg3MTQ4NDk3MmJjMjI5MWQyNzM2NA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YmU2N2I5YTY5NTM2MTE5OTE1OThiOGViODFkMjljODgwZDdkNmZmNjAzOGI1
10
+ ZDcwMTNmNmMxYzg3YjdhMGNmMWVlM2VhZmYyZTcwMGJhODI2OGNkNGY0NDNi
11
+ NmY3NzQ1ZWUyYWJjYzg1MTc0NDZhYzJhNjJmODE2ZjU0NzI5Mjg=
12
+ data.tar.gz: !binary |-
13
+ MjE2NTAyZDE0ZDU3NmU5NjU0OTYzODhjN2YxOGIyZTg5NDk5YzVhMzA5MDQy
14
+ YmVlZTdmMDRjNmEwOTI1YTFkNTZlNjFhOGM3NGQxOGYxMTAyYjAwYzRhYWQ5
15
+ YTUxMGQ2MGZkMWE4YzZkOTJjYWQ3YjIyMWMwMmRiNTQ3MmI5YWI=
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## 1.1.0
4
+ - Added support for language aliases in Jekyll config
5
+
6
+ ## 1.0.0
7
+ - Initial release
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
- # Octopress::Codefence
1
+ # Octopress Codefence
2
2
 
3
- TODO: Write a gem description
3
+ Write beautiful fenced code snippets within any template.
4
+
5
+ [![Build
6
+ Status](https://travis-ci.org/octopress/octopress-codefence.png?branch=master)](https://travis-ci.org/octopress/octopress-codefence)
4
7
 
5
8
  ## Installation
6
9
 
data/Rakefile CHANGED
@@ -1 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+ task :test => :spec
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  class Codefence
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -5,7 +5,7 @@ require 'jekyll-page-hooks'
5
5
  module Jekyll
6
6
  class Codefence < PageHooks
7
7
  def pre_render(page)
8
- page.content = Octopress::Codefence.new(page.content, page.ext).render
8
+ page.content = Octopress::Codefence.new(page.content, page.ext, page.site.config['pygments_aliases']).render
9
9
  end
10
10
  end
11
11
  end
@@ -15,9 +15,10 @@ module Octopress
15
15
  AllOptions = /([^\s]+)\s+(.+?)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
16
16
  LangCaption = /([^\s]+)\s*(.+)?/i
17
17
 
18
- def initialize(input, ext=nil)
18
+ def initialize(input, ext=nil, aliases=nil)
19
19
  @input = input
20
20
  @ext = ext
21
+ @aliases = aliases
21
22
  end
22
23
 
23
24
  def render
@@ -59,6 +60,7 @@ module Octopress
59
60
 
60
61
 
61
62
  def get_code(code, options)
63
+ options[:aliases] = @aliases || {}
62
64
  code = Pygments.highlight(code, options)
63
65
  code = "<notextile>#{code}</notextile>" if !@ext.nil? and @ext.match(/textile/)
64
66
  code
@@ -13,9 +13,12 @@ Gem::Specification.new do |gem|
13
13
  gem.homepage = "https://github.com/octopress/octopress-codefence"
14
14
  gem.license = "MIT"
15
15
 
16
- gem.add_runtime_dependency 'octopress-pygments', '>= 1.1.0'
16
+ gem.add_runtime_dependency 'octopress-pygments', '>= 1.2.1'
17
17
  gem.add_runtime_dependency 'jekyll-page-hooks', '>= 1.0.2'
18
18
 
19
+ gem.add_development_dependency 'rake'
20
+ gem.add_development_dependency 'rspec'
21
+
19
22
  gem.files = `git ls-files`.split($/)
20
23
  gem.require_paths = ["lib"]
21
24
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe Octopress::Codefence do
4
+ let(:render) { Proc.new { |str| Octopress::Codefence.new(str).render } }
5
+ context "when converting a code block with surrounding text" do
6
+ let(:content) do
7
+ str = <<-EOF
8
+
9
+ whatever
10
+
11
+ ``` ruby
12
+ puts awesome unless lame
13
+ ```
14
+
15
+ something
16
+
17
+ EOF
18
+ end
19
+
20
+ it "converts the code fence" do
21
+ expect(render.call(content)).to include("<figure class='code'><div class='highlight'><table><tr><td class='line-numbers' aria-hidden='true'><pre><div data-line='0' class='line-number'></div></pre></td><td class='main plain'><pre><div class='line'>puts awesome unless lame</div></pre></td></tr></table></div></figure>")
22
+ end
23
+
24
+ it "doesn't touch the other text" do
25
+ expect(render.call(content)).to include("\nwhatever\n\n")
26
+ expect(render.call(content)).to include("\n\n\nsomething\n\n")
27
+ end
28
+ end
29
+
30
+ end
@@ -0,0 +1,13 @@
1
+ require File.expand_path("../../lib/octopress-codefence.rb", __FILE__)
2
+
3
+ RSpec.configure do |config|
4
+ config.treat_symbols_as_metadata_keys_with_true_values = true
5
+ config.run_all_when_everything_filtered = true
6
+ config.filter_run :focus
7
+
8
+ # Run specs in random order to surface order dependencies. If you find an
9
+ # order dependency and want to debug it, you can fix the order by providing
10
+ # the seed, which is printed after each run.
11
+ # --seed 1234
12
+ config.order = 'random'
13
+ end
data/test/_config.yml CHANGED
@@ -1,3 +1,5 @@
1
1
  name: Your New Jekyll Site
2
2
  markdown: redcarpet
3
3
  pygments: true
4
+ pygments_aliases:
5
+ abc: ruby
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress-codefence
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brandon Mathis
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-16 00:00:00.000000000 Z
11
+ date: 2013-09-11 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: octopress-pygments
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
21
- version: 1.1.0
19
+ version: 1.2.1
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
29
- version: 1.1.0
26
+ version: 1.2.1
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: jekyll-page-hooks
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,11 +34,38 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 1.0.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
46
69
  description: Write beautiful fenced code snippets with in any template.
47
70
  email:
48
71
  - brandon@imathis.com
@@ -51,6 +74,9 @@ extensions: []
51
74
  extra_rdoc_files: []
52
75
  files:
53
76
  - .gitignore
77
+ - .rspec
78
+ - .travis.yml
79
+ - CHANGELOG.md
54
80
  - Gemfile
55
81
  - LICENSE.txt
56
82
  - README.md
@@ -58,6 +84,8 @@ files:
58
84
  - lib/octopress-codefence.rb
59
85
  - lib/octopress-codefence/version.rb
60
86
  - octopress-codefence.gemspec
87
+ - spec/octopress-codefence_spec.rb
88
+ - spec/spec_helper.rb
61
89
  - test/.gitignore
62
90
  - test/Gemfile
63
91
  - test/_config.yml
@@ -70,26 +98,25 @@ files:
70
98
  homepage: https://github.com/octopress/octopress-codefence
71
99
  licenses:
72
100
  - MIT
101
+ metadata: {}
73
102
  post_install_message:
74
103
  rdoc_options: []
75
104
  require_paths:
76
105
  - lib
77
106
  required_ruby_version: !ruby/object:Gem::Requirement
78
- none: false
79
107
  requirements:
80
108
  - - ! '>='
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
83
111
  required_rubygems_version: !ruby/object:Gem::Requirement
84
- none: false
85
112
  requirements:
86
113
  - - ! '>='
87
114
  - !ruby/object:Gem::Version
88
115
  version: '0'
89
116
  requirements: []
90
117
  rubyforge_project:
91
- rubygems_version: 1.8.23
118
+ rubygems_version: 2.0.7
92
119
  signing_key:
93
- specification_version: 3
120
+ specification_version: 4
94
121
  summary: Write beautiful fenced code snippets with in any template.
95
122
  test_files: []