templates/api/fulldoc/html/setup.rb in yard-api-0.1.2 vs templates/api/fulldoc/html/setup.rb in yard-api-0.1.3

- old
+ new

@@ -10,11 +10,11 @@ build_json_objects_map generate_assets serialize_index serialize_static_pages - serialize_mega_index if api_options['resource_index'] + serialize_resource_index if api_options['resource_index'] options.delete(:objects) options[:resources].each do |resource, controllers| serialize_resource(resource, controllers) @@ -36,18 +36,30 @@ end options.delete(:controllers) end def serialize_index + return serialize_onefile_index if api_options.one_file + options[:file] = api_options['readme'] serialize('index.html') options.delete(:file) end -def serialize_mega_index +def serialize_onefile_index options[:all_resources] = true + Templates::Engine.with_serializer('index.html', options[:serializer]) do + T('onefile').run(options) + end + + options.delete(:all_resources) +end + +def serialize_resource_index + options[:all_resources] = true + Templates::Engine.with_serializer("all_resources.html", options[:serializer]) do T('layout').run(options) end options.delete(:all_resources) @@ -56,12 +68,12 @@ def asset(path, content) options[:serializer].serialize(path, content) if options[:serializer] end def generate_assets - asset_root = Pathname.new(File.dirname(__FILE__)) - (Dir[asset_root + "css/**/*.css"] + Dir[asset_root + "js/**/*.js"]).each do |file| - file = Pathname.new(file).relative_path_from(asset_root).to_s + layout = Object.new.extend(T('layout')) + + [].concat(layout.stylesheets).concat(layout.javascripts).uniq.each do |file| asset(file, file(file, true)) end end def serialize_static_pages