📄 svnlog2html.rb
字号:
#!/usr/bin/env rubyrequire "erb"require "svn/client"include ERB::Utilpath = File.expand_path(ARGV.shift || Dir.pwd)html = <<-HEADER<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <style type="text/css">div.entry{ border: 1px solid red; border-width: 1px 0 0 1px; margin: 2em 2em 2em 3em; padding: 0 2em;}pre.message{ border-left: 1px solid red; margin: 1em 2em; padding-left: 1em;}div.info{ text-align: right;}span.info{ border-bottom: 1px solid red; padding: 0 5px 1px 1em;}span.author{ font-style: italic;}span.date{ color: #999;}li.action-A{ color: blue;}li.action-M{ color: green;}li.action-D{ color: red; text-decoration: line-through;} </style> <title>#{h path}</title></head><body><h1>#{h path}</h1>HEADERctx = Svn::Client::Context.newctx.log(path, "HEAD", 0, 40, true, true) do |changed_paths, rev, author, date, message| html << <<-ENTRY_HEADER<div class="entry"> <h2>r#{h rev}</h2> <pre class="message">#{h message}</pre> <div class="info"> <span class="info"> by <span class="author">#{h author}</span> at <span class="date">#{date}</span> </span> </div> <div class="changed-path">ENTRY_HEADER changed_paths.sort.each do |path, changed_path| action = changed_path.action html << <<-ENTRY_PATH <ul> <li class="action-#{h action}"> <span class="action">#{h action}</span>: <span class="changed-path">#{h path}</span> </li> </ul>ENTRY_PATH end html << <<-ENTRY_FOOTER </div></div>ENTRY_FOOTERendhtml << <<-FOOTER</body></html>FOOTERputs html
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -