colorful rat Ratfactor.com > Dave's Repos

reporat

A static website generator for Git repos written in Ruby.
git clone http://ratfactor.com/repos/reporat/reporat.git

reporat/reporat.conf.rb

Download raw file: reporat.conf.rb

1 # Root directory for all repo html mini-sites. 2 def my_output_dir 3 return "#{ENV['HOME']}/wiki/ratf/src/repos" 4 end 5 6 # Common header for all pages 7 def my_header(vals) 8 rrp = vals[:root_rel_prefix] 9 name = vals[:name] 10 11 # page title starting with default for :main 12 title = "#{name} - #{vals[:description]}" 13 if vals[:page_type] == :file 14 title = "#{name}/#{vals[:file_fname]}" 15 elsif vals[:page_type] == :files_list 16 title = "#{name} files" 17 elsif vals[:page_type] == :commits 18 title = "#{name} commit history" 19 end 20 21 og_img = "#{name}.jpg" 22 og_img_local = "#{my_output_dir}/og_imgs/#{og_img}" 23 og_img_url = "http://ratfactor.com/repos/og_imgs/#{og_img}" 24 og_img_tag = '' 25 if File.exist?(og_img_local) 26 og_img_tag = "<meta property=\"og:image\" content=\"#{og_img_url}\">" 27 end 28 29 # Return header html as string 30 <<~HTML 31 <!DOCTYPE html> 32 <html lang="en"> 33 <head> 34 <title>#{title}</title> 35 <meta charset="utf-8"> 36 <meta name="viewport" content="width=device-width, initial-scale=1"> 37 <!-- open graph stuff so this looks good on mastodon, etc. --> 38 <meta property="og:title" content="#{name}"> 39 <meta property="og:type" content="website"> 40 <meta property="og:description" content="#{vals[:description]}"> 41 #{og_img_tag} 42 <!-- end of open graph stuff --> 43 <link rel="stylesheet" href="#{rrp}../repos.css"> 44 </head> 45 <body> 46 <header> 47 <a href="/"> 48 <img src="/images/rat-logo.svg" alt="colorful rat"> 49 Ratfactor.com 50 </a> 51 &gt; 52 <a href="/repos/">Dave's Repos</a> 53 <h1>#{name}</h1> 54 <div class="description">#{vals[:description]}</div> 55 <div class="nav"> 56 <a href="#{rrp}.">About</a> 57 <a href="#{rrp}files.html">Files</a> 58 <a href="#{rrp}commits.html">Commits</a> 59 <code>git clone http://ratfactor.com/repos/#{name}/#{name}.git</code> 60 </div> 61 </header> 62 HTML 63 end 64 65 # Common footer for all pages 66 def my_footer() 67 datetime = Time.now 68 69 <<~HTML 70 <footer> 71 Generated #{datetime} by 72 <a href="http://ratfactor.com/repos/reporat/">RepoRat</a> 73 </footer> 74 </body> 75 </html> 76 HTML 77 end