radiant-kramdown_filter-extension 1.0.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.
@@ -0,0 +1,3 @@
1
+ # Kramdown Filter
2
+
3
+ Radiant extension that wraps the _pure-Ruby_ **kramdown** Markdown converter. For more information refer to the [**kramdown** website](http://kramdown.rubyforge.org/index.html).
@@ -0,0 +1,136 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gem|
4
+ gem.name = "radiant-kramdown_filter-extension"
5
+ gem.summary = %Q{kramdown Filter Extension for Radiant CMS}
6
+ gem.description = %Q{kramdown is a fast pure-Ruby Markdown converter.}
7
+ gem.email = "git@johnmuhl.com"
8
+ gem.homepage = "http://github.com/johnmuhl/radiant-kramdown_filter-extension"
9
+ gem.authors = ["johnmuhl"]
10
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
11
+ end
12
+ rescue LoadError
13
+ puts "Jeweler (or a dependency) not available. This is only required if you plan to package kramdown_filter as a gem."
14
+ end
15
+
16
+ # In rails 1.2, plugins aren't available in the path until they're loaded.
17
+ # Check to see if the rspec plugin is installed first and require
18
+ # it if it is. If not, use the gem version.
19
+
20
+ # Determine where the RSpec plugin is by loading the boot
21
+ unless defined? RADIANT_ROOT
22
+ ENV["RAILS_ENV"] = "test"
23
+ case
24
+ when ENV["RADIANT_ENV_FILE"]
25
+ require File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot"
26
+ when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
27
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot"
28
+ else
29
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot"
30
+ end
31
+ end
32
+
33
+ require 'rake'
34
+ require 'rake/rdoctask'
35
+ require 'rake/testtask'
36
+
37
+ rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
38
+ $LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
39
+ require 'spec/rake/spectask'
40
+ require 'cucumber'
41
+ require 'cucumber/rake/task'
42
+
43
+ # Cleanup the RADIANT_ROOT constant so specs will load the environment
44
+ Object.send(:remove_const, :RADIANT_ROOT)
45
+
46
+ extension_root = File.expand_path(File.dirname(__FILE__))
47
+
48
+ task :default => :spec
49
+ task :stats => "spec:statsetup"
50
+
51
+ desc "Run all specs in spec directory"
52
+ Spec::Rake::SpecTask.new(:spec) do |t|
53
+ t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
54
+ t.spec_files = FileList['spec/**/*_spec.rb']
55
+ end
56
+
57
+ task :features => 'spec:integration'
58
+
59
+ namespace :spec do
60
+ desc "Run all specs in spec directory with RCov"
61
+ Spec::Rake::SpecTask.new(:rcov) do |t|
62
+ t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
63
+ t.spec_files = FileList['spec/**/*_spec.rb']
64
+ t.rcov = true
65
+ t.rcov_opts = ['--exclude', 'spec', '--rails']
66
+ end
67
+
68
+ desc "Print Specdoc for all specs"
69
+ Spec::Rake::SpecTask.new(:doc) do |t|
70
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
71
+ t.spec_files = FileList['spec/**/*_spec.rb']
72
+ end
73
+
74
+ [:models, :controllers, :views, :helpers].each do |sub|
75
+ desc "Run the specs under spec/#{sub}"
76
+ Spec::Rake::SpecTask.new(sub) do |t|
77
+ t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""]
78
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
79
+ end
80
+ end
81
+
82
+ desc "Run the Cucumber features"
83
+ Cucumber::Rake::Task.new(:integration) do |t|
84
+ t.fork = true
85
+ t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
86
+ # t.feature_pattern = "#{extension_root}/features/**/*.feature"
87
+ t.profile = "default"
88
+ end
89
+
90
+ # Setup specs for stats
91
+ task :statsetup do
92
+ require 'code_statistics'
93
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models)
94
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views)
95
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers)
96
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/views)
97
+ ::CodeStatistics::TEST_TYPES << "Model specs"
98
+ ::CodeStatistics::TEST_TYPES << "View specs"
99
+ ::CodeStatistics::TEST_TYPES << "Controller specs"
100
+ ::CodeStatistics::TEST_TYPES << "Helper specs"
101
+ ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
102
+ end
103
+
104
+ namespace :db do
105
+ namespace :fixtures do
106
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y"
107
+ task :load => :environment do
108
+ require 'active_record/fixtures'
109
+ ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
110
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
111
+ Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
117
+
118
+ desc 'Generate documentation for the kramdown_filter extension.'
119
+ Rake::RDocTask.new(:rdoc) do |rdoc|
120
+ rdoc.rdoc_dir = 'rdoc'
121
+ rdoc.title = 'KramdownFilterExtension'
122
+ rdoc.options << '--line-numbers' << '--inline-source'
123
+ rdoc.rdoc_files.include('README')
124
+ rdoc.rdoc_files.include('lib/**/*.rb')
125
+ end
126
+
127
+ # For extensions that are in transition
128
+ desc 'Test the kramdown_filter extension.'
129
+ Rake::TestTask.new(:test) do |t|
130
+ t.libs << 'lib'
131
+ t.pattern = 'test/**/*_test.rb'
132
+ t.verbose = true
133
+ end
134
+
135
+ # Load any custom rakefiles for extension
136
+ Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
@@ -0,0 +1,14 @@
1
+ if File.exist? "#{File.dirname(__FILE__)}/vendor/gems/kramdown-0.4.0"
2
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/vendor/gems/kramdown-0.4.0/lib"
3
+ end
4
+ require 'kramdown'
5
+
6
+ class KramdownFilterExtension < Radiant::Extension
7
+ version "1.0"
8
+ description "kramdown is a fast pure-Ruby Markdown converter."
9
+ url "http://kramdown.rubyforge.org/index.html"
10
+
11
+ def activate
12
+ KramdownFilter
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ class KramdownFilter < TextFilter
2
+ description_file File.dirname(__FILE__) + "/../markdown.html"
3
+ def filter(text)
4
+ Kramdown::Document.new(RubyPants.new(text).to_html).to_html
5
+ end
6
+ end
@@ -0,0 +1,12 @@
1
+ namespace :radiant do
2
+ namespace :extensions do
3
+ namespace :kramdown_filter do
4
+ task :migrate do
5
+ puts("The kramdown_filter doesn't have any migrate tasks to run.")
6
+ end
7
+ task :update do
8
+ puts("The kramdown_filter doesn't have any static assets to copy.")
9
+ end
10
+ end
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: radiant-kramdown_filter-extension
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - johnmuhl
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-26 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: kramdown
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - "="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.4.0
24
+ version:
25
+ description: Radiant CMS extension that wraps the pure-Ruby kramdown Markdown converter.
26
+ email: git@johnmuhl.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files:
34
+ - kramdown_filter_extension.rb
35
+ - lib/kramdown_filter.rb
36
+ - lib/tasks/kramdown_filter_extension_tasks.rake
37
+ - Rakefile
38
+ - README.markdown
39
+ has_rdoc: true
40
+ homepage: http://johnmuhl.com/junk/markdown
41
+ licenses: []
42
+
43
+ post_install_message:
44
+ rdoc_options: []
45
+
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
60
+ requirements: []
61
+
62
+ rubyforge_project:
63
+ rubygems_version: 1.3.5
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: kramdown filter for Radiant CMS
67
+ test_files: []
68
+