In Files
Parent
- Server
Class Index
- WebRI
- WebRI::Blackfish
- WebRI::Component
- WebRI::Generator
- WebRI::GeneratorOne
- WebRI::GitHub
- WebRI::Heirarchy
- WebRI::Highlight
- WebRI::Icons
- WebRI::JSONFile
- WebRI::Longfish
- WebRI::Metadata
- WebRI::Newfish
- WebRI::Oldfish
- WebRI::Onefish
- WebRI::Prettify
- WebRI::Redfish
- WebRI::RiService
- WebRI::Search
- WebRI::Search::FilesTree
- WebRI::Server
- WebRI::Subversion
- WebRI::Template
- WebRI::TimeDelta
- WebRI::Twofish
- RDoc
- RDoc::AnyMethod
- RDoc::ClassModule
- RDoc::Options
- RDoc::Parser
- RDoc::Parser::C
- RDoc::TopLevel
- Syckle
- Syckle::Plugins
- Syckle::Plugins::WebRI
- Object
- OpEsc
GeneratorOne
This is the static website generator which creates a single page.
Public Class Methods
Public Instance Methods
asset(name)
click to toggle source
# File lib/webri/server/generator1.rb, line 189 def asset(name) @assets[name] ||= File.read(File.join(directory, 'assets', name)) end
css()
click to toggle source
# File lib/webri/server/generator1.rb, line 194 def css asset('css/style1.css') end
current_content()
click to toggle source
# File lib/webri/server/generator1.rb, line 184 def current_content @current_content end
generate(output=".")
click to toggle source
generate webpages
# File lib/webri/server/generator1.rb, line 71 def generate(output=".") @output = File.expand_path(output) @assets = {} # traverse the the hierarchy #generate_recurse(heirarchy) # heirarchy.class_methods.each do |name| # p name # end # heirarchy.instance_methods.each do |name| # p name # end heirarchy.subspaces.each do |name, entry| #p name, entry generate_recurse(entry) end generate_support_files end
generate_recurse(entry)
click to toggle source
# File lib/webri/server/generator1.rb, line 95 def generate_recurse(entry) keyword = entry.full_name if keyword puts keyword @current_content = service.info(keyword) #lookup(keyword) else keyword = '' @current_content = "Welcome" end file = entry.file_name #file = File.join(output, file) #file = keyword #file = file.gsub('::', '--') #file = file.gsub('.' , '--') #file = file.gsub('#' , '-') #file = File.join(output, file + '.html') html << %[<h1>#{entry.full_name}</h1>] html << %[\n<div id="#{file}" class="slot module">\n] html << service.info(keyword) html << %[\n</div>\n] #html << %[<h1>Class Methods</h1>] cmethods = entry.class_methods.map{ |x| x.to_s }.sort cmethods.each do |name| mname = "#{entry.full_name}.#{name}" mfile = WebRI.entry_to_path(mname) #mfile = File.join(output, mfile) #mfile = File.join(output, "#{entry.file_name}/c-#{esc(name)}.html") html << %[\n<div id="#{mfile}" name="#{mfile}" class="slot cmethod">\n] html << service.info(mname) html << %[\n</div>\n] #write(mfile, service.info(mname)) end #html << %[<h1>Instance Methods</h1>] imethods = entry.instance_methods.map{ |x| x.to_s }.sort imethods.each do |name| mname = "#{entry.full_name}##{name}" mfile = WebRI.entry_to_path(mname) #mfile = File.join(output, mfile) #mfile = File.join(output, "#{entry.file_name}/i-#{esc(name)}.html") html << %[\n<div id="#{mfile}" name="#{mfile}" class="slot imethod">\n] html << service.info(mname) html << %[\n</div>\n] #write(mfile, service.info(mname)) end entry.subspaces.each do |child_name, child_entry| next if child_entry == entry @directory_depth += 1 generate_recurse(child_entry) @directory_depth -= 1 end end
generate_support_files()
click to toggle source
# File lib/webri/server/generator1.rb, line 163 def generate_support_files FileUtils.mkdir_p(output) index = render(template('index1')) #base = base.strip.chomp('</html>').strip.chomp('</body>').strip.chomp('</div>') #base = base + html #base = base + "</div>\n</body>\n</html>" write(File.join(output, 'webri.html'), index) #write(File.join(output, 'header.html'), page_header) #write(File.join(output, 'tree.html'), page_tree) #write(File.join(output, 'main.html'), page_main) # copy assets #dir = File.join(directory, 'assets') #FileUtils.cp_r(dir, output) end
jquery()
click to toggle source
# File lib/webri/server/generator1.rb, line 199 def jquery '' # asset('js/jquery.js') end
Disabled; run with --debug to generate this.