templates/guide/fulldoc/html/setup.rb in yard-0.9.5 vs templates/guide/fulldoc/html/setup.rb in yard-0.9.6
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
include T('default/fulldoc/html')
module OverrideFileLinks
def resolve_links(text)
result = ''
@@ -18,15 +19,15 @@
Template.extra_includes << OverrideFileLinks
def init
class << options.serializer
- def serialized_path(object)
+ define_method(:serialized_path) do |object|
if CodeObjects::ExtraFileObject === object
- super.sub(/^file\./, '').downcase
+ super(object).sub(/^file\./, '').downcase
else
- super
+ super(object)
end
end
end if options.serializer
return serialize_onefile if options.onefile
@@ -36,11 +37,11 @@
options.files.each {|file| serialize_file(file) }
serialize_file(options.readme) if options.readme
end
def generate_assets
- %w( js/jquery.js js/app.js css/style.css css/common.css ).each do |file|
+ %w(js/jquery.js js/app.js css/style.css css/common.css).each do |file|
asset(file, file(file, true))
end
end
def serialize_file(file)
@@ -63,11 +64,11 @@
options.delete(:file)
end
def serialize_onefile
layout = Object.new.extend(T('layout'))
- options.css_data = layout.stylesheets.map {|sheet| file(sheet,true) }.join("\n")
- options.js_data = layout.javascripts.map {|script| file(script,true) }.join("")
+ options.css_data = layout.stylesheets.map {|sheet| file(sheet, true) }.join("\n")
+ options.js_data = layout.javascripts.map {|script| file(script, true) }.join("")
Templates::Engine.with_serializer('onefile.html', options.serializer) do
T('onefile').run(options)
end
end