discorb-lib/discorb

View on GitHub
template-replace/scripts/sidebar.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true
def replace_sidebar(file)
  html = File.read(file)
  files_html = <<-HTML
            <span><a target="_self" href="file_list.html">
              Files
            </a></span>
  HTML
  index = html.index(files_html)
  html.insert(
    index + files_html.length,
    '<!--od--><span><a target="_self" href="version_list.html">Versions</a></span><!--eod-->'
  )
  File.write(file, html)
end