Skip to content

Commit

Permalink
Build pages using jekyll
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangxin committed Dec 4, 2011
1 parent 00d5f16 commit 6e50fb1
Show file tree
Hide file tree
Showing 16 changed files with 498 additions and 125 deletions.
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
/screencast.html
/index.html
/demo*.html
/errata.html
*.json
_site/
26 changes: 1 addition & 25 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ ABS_JS_SHOWTTY_FILE = File.expand_path('html/inc/showtty.js')
ABS_CSS_COMMON_FILE = File.expand_path('html/inc/common.css')
TTYPLAY_TMPL = File.expand_path('html/templates/ttyplay.erb')
SCAST_TMPL = File.expand_path('html/templates/scast.erb')
INDEX_TMPL = File.expand_path('html/templates/index.erb')
SCAST_HTML = File.expand_path('screencast.html')
INDEX_HTML = File.expand_path('index.html')
DEMO_INDEX_HTML = File.expand_path('demo_index.html')
ERRATA_HTML = File.expand_path('errata.html')

class ArgsBinding
def initialize(args)
Expand Down Expand Up @@ -65,7 +61,7 @@ desc 'compile ttyrec files to json files'
task :json

desc 'create index.html and other html files for ttyplay.'
task :html => [:html_chunks, :html_screencast, INDEX_HTML, ERRATA_HTML]
task :html => [:html_chunks, :html_screencast ]

task :html_chunks do
FileList["html/**/*.json"].each do |t|
Expand Down Expand Up @@ -151,23 +147,6 @@ def mkd2html args
puts "built %s from %s" % [args[:output], args[:source]]
end


file INDEX_HTML => ['README.mkd', INDEX_TMPL] do |t|
mkd2html :title => "《Git权威指南》", :subtitle => "参考资料",
:source => t.prerequisites[0], :template => t.prerequisites[1], :output => INDEX_HTML,
:extra_js => ['html/inc/jquery-1.6.2.min.js', 'html/inc/click_more.js']

mkd2html :title => "《Git权威指南》", :subtitle => "参考资料",
:source => t.prerequisites[0], :template => t.prerequisites[1], :output => DEMO_INDEX_HTML
end

file ERRATA_HTML => ['errata.mkd', INDEX_TMPL] do |t|
mkd2html :title => "《Git权威指南》", :subtitle => "勘误",
:source => t.prerequisites[0], :template => t.prerequisites[1], :output => ERRATA_HTML,
:extra_css => ['html/inc/errata.css'],
:extra_js => ['html/inc/jquery-1.6.2.min.js', 'html/inc/click_more.js']
end

desc 'clean *.json and *.html files'
task :clean => [:clean_json, :clean_html]

Expand All @@ -181,9 +160,6 @@ task :clean_html do
FileList["html/**/*.html"].each do |t|
File.unlink t
end
File.unlink SCAST_HTML if File.exists?(SCAST_HTML)
File.unlink INDEX_HTML if File.exists?(INDEX_HTML)
File.unlink ERRATA_HTML if File.exists?(ERRATA_HTML)
end

task :default => [:json, :html]
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
markdown: rdiscount
pygments: true
57 changes: 57 additions & 0 deletions _layouts/master.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Git权威指南 - {{ page.title }}</title>
{% for style in page.stylesheets %}
<link rel="stylesheet" href="{{ style }}" type="text/css" media="screen" charset="utf-8"/>
{% endfor %}
{% for script in page.javascripts %}
<script src="{{ script }}"></script>
{% endfor %}
<link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8"/>
<link rel="stylesheet" href="/stylesheets/syntax.css" type="text/css" media="screen" charset="utf-8"/>
</head>
<body>
<div id='wrapper'>
<div id='header'>
<h1><a href='/'>World Hello</a></h1>

<div id='menu'>
<ul>
<li><a href='/' id='home_link' title='Home'>首页</a></li>
<li><a href='/blog.html' id='blog_link' title='Blog'>博客</a></li>
<li><a href='/doc/' id='docs_link' title='Docs'>文章</a></li>
<li><a href='/about.html' id='about_link' title='About'>关于</a></li>
<li><a href='http://github.com/gotgit' target='_blank' title='GitHub' rel='me' id='github_link'>GitHub</a></li>
<li><a href='http://weibo.com/gotgit' title='微博' target='_blank' id='weibo_link'>微博</a></li>
</ul>
</div>
</div>

<div class="home_box" id='gotgit_left'>
<div id='submenu'>
<h2>目录</h2>
<ul>
<li><a href="index.html">关于本书</a>
<li><a href="bookstore.html">如何购买</a>
<li><a href="recommends.html">业界评价</a>
<li><a href="errata.html">本书勘误</a>
<li><a href="demo.html">操作回放</a>
</ul>
</div>
</div>

<div class="home_box" id='gotgit_right'>

{{ content }}
<div class='clearfix'></div>
</div>
</div>
<div id='footer'>
Copyright &copy; 2011 Jiang Xin. Hosted by <a href='http://github.com/gotgit/gotgit.github.com/' target='_blank'>GitHub</a> and powered by <a href='http://github.com/mojombo/jekyll'>Jekyll</a>. Templates from <a href='http://github.com/mbleigh/mbleigh.github.com/' target='_blank'>Michael Bleigh</a>.
</div>
</body>
</html>
6 changes: 6 additions & 0 deletions _layouts/master_with_jquery.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: master
javascripts: [ "/javascripts/jquery.js", "/javascripts/jquery.github.js" ]
---

{{ content }}
13 changes: 13 additions & 0 deletions _layouts/ttyrecord.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
layout: master
stylesheets: [ "/gotgit/html/inc/common.css", "/gotgit/html/inc/tty.css" ]
javascripts: [ "/gotgit/html/inc/prototype.js", "/gotgit/html/inc/showtty.js" ]
---

<div class="document">
<h2>{{ page.title }}</h2>
<div id="tty">Enable JavaScript to see the animation.</div>
<script>
showTTYURL( document.getElementById("tty"), "{{ page.json_file }}" );
</script>
</div>
33 changes: 33 additions & 0 deletions bookstore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
layout: master_with_jquery
title: 如何购买
---

<a name="bookstore"></a>

## 如何购买

* China-pub 互动出版网
<http://product.china-pub.com/194010>

* 卓越网
<http://www.amazon.cn/gp/product/B0058FLC40/>

* 当当网
<http://product.dangdang.com/product.aspx?product_id=21108669>

* 京东商城
<http://book.360buy.com/10697183.html>

<a class="click-more"></a>

* 中关村图书大厦网上书店
<http://www.zgcbb.com/detail.aspx?bid=760959>

* 广购书城:广州购书中心网上书店
<http://www.gg1994.com/Product.do?id=1120692>

* 北京图书大厦网络书店
<http://www.bjbb.com/bookdetail.aspx?pid=3775188>


66 changes: 66 additions & 0 deletions demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
layout: master
title: 操作回放
---

<a name="playback"></a>

## 操作回放

本书的部分操作用 ttyrec 录制,查看请访问:[《Git权威指南》——操作回放](screencast.html)
读者除了可以看到“活”的操作外,还可以从回放当中复制操作的代码。

如果该网页不存在、无法访问,或是您想在本地回放,或者想在其中添加您自己的操作回放,
有两种方式:

方式一:你可以从 Github 上克隆本版本库,编译相关网页。

<a class="click-more"></a>

* 克隆版本库。

$ git clone git://github.com/gotgit/gotgit.git

* 确认系统中安装了 ruby 和 perl,并通过 rubygems 安装 redcarpet。

$ gem install redcarpet

* 执行编译。

$ rake

* 点击生成的页面:[《Git权威指南》——操作回放](screencast.html)

方式二:版本库中本来就保存了一份已编译文档,只不过缺省没有克隆出来。

> 如果您的系统上缺乏相应的工具软件而无法成功编译,
在版本库中实际上保存了一份已经编译好的文件,可以通过Git下载,
并检出到工作区。

<a class="click-more"></a>

* 克隆版本库。

$ git clone git://github.com/gotgit/gotgit.git

* 添加新的配置,以便获取首次克隆未获取到的远程分支。

$ git config --add remote.origin.fetch +refs/remotes/*:refs/remotes/*

* 执行获取操作。

$ git fetch

* 检出分支 refs/remotes/compiled 分支中的内容到工作区。

$ git checkout compiled -- .

* 执行重置,将已编译文档撤出暂存区,当然工作区中仍然保留。

$ git reset

* 点击检出的页面:[《Git权威指南》——操作回放](screencast.html)

如果您自己想把自己录制的操作与他人共享,可以将录制的文件以 ".ttyrec" 扩展名保存到 ttyrec 目录下。
执行 rake 命令,可以自动生成新的播放页面。

18 changes: 16 additions & 2 deletions errata-others.mkd → errata-others.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
---
layout: master
title: 勘误表
---

## 缺陷跟踪
## 参与勘误

访问 [缺陷追踪系统(Github)](https://github.com/gotgit/gotgit/issues/new)[缺陷追踪系统(Redmine)](http://redmine.ossxp.com/redmine/projects/gotgit/issues/new) ,报告本书中的错误,会在下次印刷时纠正。
您发现了新的错误么?贡献出来吧,这厢有礼了。Orz

1. 记录您发现的问题。

访问 [缺陷追踪系统(Github)](https://github.com/gotgit/gotgit/issues/new) 报告问题。

2. 修改本Git版本库中的勘误表。

* 在 GitHub 上从本版本库 <https://github.com/gotgit/gotgit/> 派生后,直接修改勘误表。
* 将您的修改通过 Github 的 Pull Request 工具通知我。
* 您还可以直接通过 [新浪微博](http://weibo.com/gotgit/) @群英汇蒋鑫。

## 勘误表

Expand Down
18 changes: 16 additions & 2 deletions errata.mkd → errata.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
---
layout: master
title: 勘误表
---

## 缺陷跟踪
## 参与勘误

访问 [缺陷追踪系统(GitHub)](https://github.com/gotgit/gotgit/issues/new)[缺陷追踪系统(Redmine)](http://redmine.ossxp.com/redmine/projects/gotgit/issues/new) ,报告本书中的错误,会在下次印刷时纠正。
您发现了新的错误么?贡献出来吧,这厢有礼了。Orz

1. 记录您发现的问题。

访问 [缺陷追踪系统(Github)](https://github.com/gotgit/gotgit/issues/new) 报告问题。

2. 修改本Git版本库中的勘误表。

* 在 GitHub 上从本版本库 <https://github.com/gotgit/gotgit/> 派生后,直接修改勘误表。
* 将您的修改通过 Github 的 Pull Request 工具通知我。
* 您还可以直接通过 [新浪微博](http://weibo.com/gotgit/) @群英汇蒋鑫。

## 勘误表

Expand Down
1 change: 1 addition & 0 deletions html/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.html
*.json
57 changes: 4 additions & 53 deletions html/templates/scast.erb
Original file line number Diff line number Diff line change
@@ -1,51 +1,7 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Git权威指南——操作回放</title>
<% css_files.each do |t| %>
<LINK rel="stylesheet" href="<%= t %>" type="text/css">
<% end %>
<LINK rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8"/>
<LINK rel="stylesheet" href="/stylesheets/syntax.css" type="text/css" media="screen" charset="utf-8"/>
</head>
<body>
<div id='header'>
<h1><a href='/'>World Hello</a></h1>

<div id='menu'>
<ul>
<li><a href='/' id='home_link' title='Home'>首页</a></li>
<li><a href='/blog.html' id='blog_link' title='Blog'>博客</a></li>
<li><a href='/doc/' id='docs_link' title='Docs'>文章</a></li>
<li><a href='/about.html' id='about_link' title='About'>关于</a></li>
<li><a href='http://github.com/gotgit' target='_blank' title='GitHub' rel='me' id='github_link'>GitHub</a></li>
<li><a href='http://weibo.com/gotgit' title='微博' target='_blank' id='weibo_link'>微博</a></li>
</ul>
</div>
</div>

<div class='document'>

<h1 class="title">《Git权威指南》</h1>
<h2 class="subtitle" id="id1">操作回放</h2>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
<tbody valign="top">
<tr class="field"><th class="docinfo-name">作者:</th><td class="field-body"><a class="reference external" href="http://weibo.com/gotgit/">蒋鑫</a></td>

</tr>
<tr class="field"><th class="docinfo-name">网址:</th><td class="field-body"><a class="reference external" href="http://gotgit.github.com/gotgit/">http://gotgit.github.com/gotgit/</a></td>
</tr>
<tr class="field"><th class="docinfo-name">版本:</th><td class="field-body"><%= version %></td>
</tr>
<tr class="field"><th class="docinfo-name">日期:</th><td class="field-body"><%= compile_time %></td>
</tr>
<tr class="field"><th class="docinfo-name">版权信息:</th><td class="field-body"><a class="reference external" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons" src="html/inc/cc-icon.png" /></a></td>
</tr>
</tbody>

</table>
---
layout: master
title: 操作回放
---

<p>点击下面相应的链接通过Web网页观看操作回放。网页回放技术来自于 <a href="http://encryptio.com/code/jsttyplay">jsttyplay</a>
<p>如需要更好的控制回复的速度、暂停等,请使用 <a href="http://0xcc.net/ttyrec/">ttyplay (Linux)</a>, <a href="http://angband.pl/termrec.html">termrec (Windows)</a> 等软件回放扩展名为 ".ttyrec" 的文件。
Expand Down Expand Up @@ -78,8 +34,3 @@ parts = { '1' => '第1篇:初识Git',
<% end %>
</ul>
<% end %>

</div>
</body>
</html>

Loading

0 comments on commit 6e50fb1

Please sign in to comment.