mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Update the custom YARD CSS to use the proper YARD methodology.
This commit is contained in:
parent
cb04561385
commit
6d887f78ae
4 changed files with 14 additions and 20 deletions
13
Rakefile
13
Rakefile
|
@ -225,6 +225,17 @@ end
|
||||||
begin
|
begin
|
||||||
require 'yard'
|
require 'yard'
|
||||||
|
|
||||||
|
namespace :yard do
|
||||||
|
task :sass do
|
||||||
|
require File.dirname(__FILE__) + '/lib/sass'
|
||||||
|
Dir[File.dirname(__FILE__) + "/yard/default/**/*.sass"].each do |sass|
|
||||||
|
File.open(sass.gsub(/sass$/, 'css'), 'w') do |f|
|
||||||
|
f.write(Sass::Engine.new(File.read(sass)).render)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
YARD::Rake::YardocTask.new do |t|
|
YARD::Rake::YardocTask.new do |t|
|
||||||
t.files = FileList.new('lib/**/*.rb') do |list|
|
t.files = FileList.new('lib/**/*.rb') do |list|
|
||||||
list.exclude('lib/haml/template/*.rb')
|
list.exclude('lib/haml/template/*.rb')
|
||||||
|
@ -234,7 +245,9 @@ begin
|
||||||
t.options += FileList.new('yard/*.rb').to_a.map {|f| ['-e', f]}.flatten
|
t.options += FileList.new('yard/*.rb').to_a.map {|f| ['-e', f]}.flatten
|
||||||
files = FileList.new('doc-src/*').to_a.sort_by {|s| s.size} + %w[MIT-LICENSE VERSION]
|
files = FileList.new('doc-src/*').to_a.sort_by {|s| s.size} + %w[MIT-LICENSE VERSION]
|
||||||
t.options << '--files' << files.join(',')
|
t.options << '--files' << files.join(',')
|
||||||
|
t.options << '--template-path' << File.dirname(__FILE__) + '/yard'
|
||||||
end
|
end
|
||||||
|
Rake::Task['yard'].prerequisites.insert(0, 'yard:sass')
|
||||||
Rake::Task['yard'].instance_variable_set('@comment', nil)
|
Rake::Task['yard'].instance_variable_set('@comment', nil)
|
||||||
|
|
||||||
desc "Generate Documentation"
|
desc "Generate Documentation"
|
||||||
|
|
1
yard/default/.gitignore
vendored
Normal file
1
yard/default/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*.css
|
|
@ -1,20 +0,0 @@
|
||||||
require File.dirname(__FILE__) + "/../lib/sass"
|
|
||||||
|
|
||||||
class YARD::Generators::FullDocGenerator
|
|
||||||
protected
|
|
||||||
|
|
||||||
def generate_assets_with_haml
|
|
||||||
generate_assets_without_haml
|
|
||||||
|
|
||||||
if format == :html && serializer
|
|
||||||
template_file = find_template template_path(css_file)
|
|
||||||
haml_style = Sass::Engine.new(File.read(
|
|
||||||
File.dirname(__FILE__) + "/haml-style.sass")).render
|
|
||||||
serializer.serialize(css_file, File.read(template_file) + haml_style)
|
|
||||||
end
|
|
||||||
|
|
||||||
true
|
|
||||||
end
|
|
||||||
alias_method :generate_assets_without_haml, :generate_assets
|
|
||||||
alias_method :generate_assets, :generate_assets_with_haml
|
|
||||||
end
|
|
Loading…
Add table
Reference in a new issue