lib/jsduck/index_html.rb in jsduck-4.3.1 vs lib/jsduck/index_html.rb in jsduck-4.3.2

- old
+ new

@@ -15,11 +15,10 @@ # # When --seo enabled, creates index.php, template.html and print-template.html. def write if @opts.seo FileUtils.cp(@opts.template_dir+"/index.php", @opts.output_dir+"/index.php") - FileUtils.cp(@opts.template_dir+"/Mobile_Detect.php", @opts.output_dir+"/Mobile_Detect.php") create_template_html(@opts.template_dir+"/template.html", @opts.output_dir+"/template.html") create_print_template_html(@opts.template_dir+"/print-template.html", @opts.output_dir+"/print-template.html") create_index_template_html(@opts.template_dir+"/index-template.html", @opts.output_dir+"/index-template.html") else create_template_html(@opts.template_dir+"/template.html", @opts.output_dir+"/index.html") @@ -29,10 +28,11 @@ private def create_template_html(in_file, out_file) write_template(in_file, out_file, { "{title}" => @opts.title, + "{mobile_redirect}" => @opts.seo ? include_script(@opts.template_dir+"/mobile-redirect.js") : "", "{header}" => @opts.header, "{footer}" => "<div id='footer-content' style='display: none'>#{@opts.footer}</div>", "{extjs_path}" => @opts.extjs_path, "{welcome}" => @assets.welcome.to_html("display:none"), "{categories}" => @assets.categories.to_html("display:none"), @@ -57,9 +57,13 @@ "{title}" => @opts.title, "{header}" => @opts.header, "{categories}" => categories ? "<h1>API Documentation</h1> #{categories}" : "", "{guides}" => guides ? "<h1>Guides</h1> #{guides}" : "", }) + end + + def include_script(filename) + "<script type='text/javascript'>\n" + Util::IO.read(filename) + "\n</script>" end # Opens in_file, replaces {keys} inside it, writes to out_file def write_template(in_file, out_file, replacements) Logger.log("Writing", out_file)