publify_textfilter_code 9.0.0.pre1

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,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1da3bae0e46cc0a6de7692b55d615f5cefbdd4a5
4
+ data.tar.gz: 380e1080c2c0f580d789f3a2f706a06c00382c08
5
+ SHA512:
6
+ metadata.gz: f222d4f4d852fdcc4df4b04193428796291bbf7c43816cd2a114a3fb9b3d2cb25654b2786ba7d27e156953472d8606c21d3372eed2df34f0d46bdd8645d3be7a
7
+ data.tar.gz: c8caea0fdcfdbab3537a5890672e010bdffe123ede26729694ffd91ed4dab2de7f2103a2b8291fbdea49e34fb560789e2989f46e9a4ffdf07fbc1aecf6938630
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2016 Matijs van Zuijlen
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,3 @@
1
+ = PublifyTextfilterCode
2
+
3
+ This project rocks and uses MIT-LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
8
+ load 'rails/tasks/engine.rake'
9
+
10
+ load 'rails/tasks/statistics.rake'
11
+
12
+ Bundler::GemHelper.install_tasks
13
+
14
+ require 'rspec/core/rake_task'
15
+
16
+ desc 'Run all specs in spec directory (excluding plugin specs)'
17
+ RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
18
+
19
+ task default: :spec
20
+
21
+ require 'rubocop/rake_task'
22
+ RuboCop::RakeTask.new do |task|
23
+ task.options = ['--config', '.rubocop.yml']
24
+ end
25
+ task default: :rubocop
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
@@ -0,0 +1,70 @@
1
+ require 'coderay'
2
+ require 'htmlentities'
3
+
4
+ class PublifyApp
5
+ class Textfilter
6
+ class Code < TextFilterPlugin::MacroPre
7
+ plugin_display_name 'Code'
8
+ plugin_description 'Apply coderay highlighting to a code block'
9
+
10
+ DEFAULT_OPTIONS = { css: :class,
11
+ wrap: :span,
12
+ line_numbers: nil,
13
+ tab_width: 2,
14
+ bold_every: 5,
15
+ hint: false,
16
+ line_number_start: 1 }.freeze
17
+
18
+ def self.help_text
19
+ %{
20
+ You can use `<publify:code>` to include syntax-highlighted code blocks. Example:
21
+
22
+ <publify:code lang="ruby">
23
+ class Foo
24
+ def bar
25
+ "abcde"
26
+ end
27
+ end
28
+ </publify:code>
29
+
30
+ This uses the Ruby [Syntax](http://coderay.rubychan.de) module. Options:
31
+
32
+ * **lang**. Sets the programming language. Currently supported languages are
33
+ *C, C++ (&#42;), CSS, Delphi, diff, Groovy (&#42;), HTML, Java, JavaScript, JSON,
34
+ PHP (&#42;), Python (&#42;), RHTML, Ruby, Scheme, SQL (&#42;), XHTML, XML, YAML.
35
+ &#42; Only available in CodeRay >= 0.9.1
36
+ * **linenumber**. Turns on line numbering. Use `linenumber="true"` to enable.
37
+ * **title**. Adds a title block to the top of the code block.
38
+ }
39
+ end
40
+
41
+ def self.macrofilter(attrib, text = '')
42
+ lang = attrib['lang']
43
+ title = attrib['title']
44
+ options = if attrib['linenumber'] == 'true'
45
+ DEFAULT_OPTIONS.merge(line_numbers: :table,
46
+ wrap: :div)
47
+ else
48
+ DEFAULT_OPTIONS
49
+ end
50
+
51
+ text = text.to_s.delete("\r").gsub(/\A\n/, '').chomp
52
+
53
+ begin
54
+ text = CodeRay.scan(text, lang.downcase.to_sym).span(options)
55
+ rescue
56
+ text = HTMLEntities.new('xhtml1').encode(text)
57
+ end
58
+ text = "<notextile>#{text}</notextile>"
59
+
60
+ titlecode = if title
61
+ "<div class=\"codetitle\">#{title}</div>"
62
+ else
63
+ ''
64
+ end
65
+
66
+ "<div class=\"CodeRay\"><pre>#{titlecode}#{text}</pre></div>"
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,4 @@
1
+ module PublifyTextfilterCode
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module PublifyTextfilterCode
2
+ VERSION = '9.0.0.pre1'.freeze
3
+ end
@@ -0,0 +1,7 @@
1
+ require 'publify_core'
2
+ require 'publify_textfilter_code/engine'
3
+ require 'text_filter_plugin'
4
+ require 'publify_app/textfilter_code'
5
+
6
+ module PublifyTextfilterCode
7
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :publify_textfilter_code do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: publify_textfilter_code
3
+ version: !ruby/object:Gem::Version
4
+ version: 9.0.0.pre1
5
+ platform: ruby
6
+ authors:
7
+ - Matijs van Zuijlen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-11-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.7
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.7
27
+ - !ruby/object:Gem::Dependency
28
+ name: publify_core
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 9.0.0.pre1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 9.0.0.pre1
41
+ - !ruby/object:Gem::Dependency
42
+ name: coderay
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: htmlentities
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.3'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: sqlite3
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.5.2
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 3.5.2
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.45.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.45.0
111
+ description: Code text filter sidebar for the Publify blogging system.
112
+ email:
113
+ - matijs@matijs.net
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - MIT-LICENSE
119
+ - README.rdoc
120
+ - Rakefile
121
+ - config/routes.rb
122
+ - lib/publify_app/textfilter_code.rb
123
+ - lib/publify_textfilter_code.rb
124
+ - lib/publify_textfilter_code/engine.rb
125
+ - lib/publify_textfilter_code/version.rb
126
+ - lib/tasks/publify_textfilter_code_tasks.rake
127
+ homepage: https://publify.co
128
+ licenses:
129
+ - MIT
130
+ metadata: {}
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">"
143
+ - !ruby/object:Gem::Version
144
+ version: 1.3.1
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 2.5.1
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Code text filter for the Publify blogging system.
151
+ test_files: []