slodown.py 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ce4d2006d0dc58039267525cdf0af59337ebba82
4
+ data.tar.gz: c902356f9a6141604c801d8f88aad5a752982c36
5
+ SHA512:
6
+ metadata.gz: d925b7b64eca390b6b1044b7a10b861b47dd9c7c0875e231e6d812eaf6871b283a42028dc8cde5d680aa211d9cdfa15c880b9bd6bd92c2dbf6f76b72cb0f4c45
7
+ data.tar.gz: 8fcf147a2f600b1791066171b9aeb48e2446b16bdabf163063fedadb720a32d5309a975e5c55bceaf392e7ecfed3b471990f79be4a71920e9b7fee0faa2e8a25
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .idea/
2
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format progress
3
+ --order random
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,46 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ slodown.py (1.0.0)
5
+ pygments.rb
6
+ slodown
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ coderay (1.1.0)
12
+ diff-lcs (1.2.5)
13
+ kramdown (1.3.0)
14
+ mini_portile (0.5.2)
15
+ nokogiri (1.6.1)
16
+ mini_portile (~> 0.5.0)
17
+ posix-spawn (0.3.8)
18
+ pygments.rb (0.5.4)
19
+ posix-spawn (~> 0.3.6)
20
+ yajl-ruby (~> 1.1.0)
21
+ rinku (1.7.3)
22
+ rspec (2.14.1)
23
+ rspec-core (~> 2.14.0)
24
+ rspec-expectations (~> 2.14.0)
25
+ rspec-mocks (~> 2.14.0)
26
+ rspec-core (2.14.7)
27
+ rspec-expectations (2.14.4)
28
+ diff-lcs (>= 1.1.3, < 2.0)
29
+ rspec-mocks (2.14.4)
30
+ ruby-oembed (0.8.9)
31
+ sanitize (2.0.6)
32
+ nokogiri (>= 1.4.4)
33
+ slodown (0.1.3)
34
+ coderay (>= 1.0.0)
35
+ kramdown (>= 0.14.0)
36
+ rinku (>= 1.7.0)
37
+ ruby-oembed (~> 0.8.8)
38
+ sanitize (>= 2.0.0)
39
+ yajl-ruby (1.1.0)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ rspec
46
+ slodown.py!
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ slodown.py
2
+ ==========
@@ -0,0 +1,3 @@
1
+ module SlodownPy
2
+ VERSION = '1.0.0'
3
+ end
data/lib/slodown_py.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'kramdown'
2
+ require 'kramdown/converter/slodown_html'
3
+ require 'slodown'
4
+ require 'pygments'
5
+ require 'slowdown_html'
6
+
7
+ module SlodownPy
8
+
9
+ end
@@ -0,0 +1,26 @@
1
+ # Replace method to use Pygments for syntax highlighting instead of Coderay
2
+
3
+ Kramdown::Converter::SlodownHtml.class_eval do
4
+
5
+ # Transform markdown code blocks into HTML with syntax highlighting based on Pygments
6
+ #
7
+ # @param element [Kramdown::Element]
8
+ # element containing the code block
9
+ # @param indent [Fixnum]
10
+ # number of indent spaces (not used here)
11
+ #
12
+ # @return [String]
13
+ # HTML for highlighted code block
14
+ #
15
+ def convert_codeblock(element, indent)
16
+ attribute = element.attr.dup
17
+ code = element.value
18
+ language = extract_code_language!(attribute)
19
+
20
+ options = {:stripall => true}
21
+ options[:startinline] = true if language == 'php'
22
+
23
+ Pygments.highlight(code, :lexer => language, :options => options)
24
+ end
25
+
26
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path('../lib/slodown_py/version', __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'slodown.py'
5
+ s.version = SlodownPy::VERSION
6
+
7
+ s.summary = 'Slodown with syntax highlighting from pygments.rb'
8
+ s.description = 'slodown.py replaces the Coderay-based syntax highlighting in Slodown with Pygments.rb'
9
+
10
+ s.homepage = 'https://github.com/WebCodr/slodown.py'
11
+ s.has_rdoc = false
12
+
13
+ s.authors = 'David Henning'
14
+ s.email = 'david@webcodr.de'
15
+
16
+ s.add_dependency 'slodown'
17
+ s.add_dependency 'pygments.rb'
18
+ s.add_development_dependency 'rspec'
19
+
20
+ s.require_paths = ['lib']
21
+
22
+ s.license = 'MIT'
23
+
24
+ s.files = `git ls-files`.split("\n")
25
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe SlodownPy, 'monkey patch for Kramdown::Converter::SlodownHtml#convert_codeblock' do
4
+ it 'returns highlighted code from Pygments.rb' do
5
+ formatter = Slodown::Formatter.new("~~~ ruby\n puts foo\n~~~")
6
+ result = formatter.complete.to_s
7
+ result.should eql("<div class=\"highlight\"><pre><span class=\"nb\">puts</span> <span class=\"n\">foo</span>\n</pre></div>")
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'slodown_py'
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: slodown.py
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - David Henning
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: slodown
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pygments.rb
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
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
+ description: slodown.py replaces the Coderay-based syntax highlighting in Slodown
56
+ with Pygments.rb
57
+ email: david@webcodr.de
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .rspec
64
+ - Gemfile
65
+ - Gemfile.lock
66
+ - LICENSE
67
+ - README.md
68
+ - lib/slodown_py.rb
69
+ - lib/slodown_py/version.rb
70
+ - lib/slowdown_html.rb
71
+ - slodown.py.gemspec
72
+ - spec/convert_spec.rb
73
+ - spec/spec_helper.rb
74
+ homepage: https://github.com/WebCodr/slodown.py
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.0.6
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Slodown with syntax highlighting from pygments.rb
98
+ test_files: []
99
+ has_rdoc: false