2014-06-20 04:44:06 +00:00
|
|
|
def stylesheets
|
|
|
|
%w(css/solarized.css css/bootstrap.css css/global.css) + super
|
|
|
|
end
|
|
|
|
|
|
|
|
def javascripts
|
|
|
|
javascripts = super
|
|
|
|
javascripts.insert 1, 'js/jquery.stickyheaders.js', 'js/underscore.min.js'
|
|
|
|
end
|
2014-06-21 23:28:47 +00:00
|
|
|
|
|
|
|
def diskfile
|
|
|
|
@file.attributes[:markup] ||= markup_for_file('', @file.filename)
|
|
|
|
|
|
|
|
if @file.filename == 'README.md'
|
|
|
|
contents = preprocess_index(@file.contents)
|
|
|
|
else
|
|
|
|
contents = @file.contents
|
|
|
|
end
|
|
|
|
|
|
|
|
data = htmlify(contents, @file.attributes[:markup])
|
2020-09-04 14:38:31 +00:00
|
|
|
"<div id='filecontents'>" + data + '</div>'
|
2014-06-21 23:28:47 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def preprocess_index(contents)
|
2015-03-26 20:46:03 +00:00
|
|
|
regex = /\[ (\w+) \] \( lib \/ ([^()]+) \.rb (?:\#L\d+)? \)/x
|
2014-06-21 23:28:47 +00:00
|
|
|
|
|
|
|
contents.gsub(regex) do
|
|
|
|
method_name, file_path = $1, $2
|
|
|
|
|
|
|
|
module_name = file_path.split('/')[0..2].
|
|
|
|
map do |value|
|
|
|
|
value.
|
|
|
|
split('_').
|
|
|
|
map { |word| word[0].upcase + word[1..-1] }.
|
|
|
|
join
|
|
|
|
end.
|
|
|
|
join('::')
|
|
|
|
|
|
|
|
"{#{module_name}##{method_name} #{method_name}}"
|
|
|
|
end
|
|
|
|
end
|