mkblog 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/mkblog_version.rb +1 -1
- data/templates/_layouts/master.html.erb +0 -1
- data/templates/_posts/2012-03-16-setup-blog-in-5minutes.mkd.erb +1 -1
- data/templates/blog.html +1 -1
- data/templates/index.html.erb +1 -1
- metadata +7 -39
- data/templates/_site/README.markdown +0 -24
- data/templates/_site/Rakefile +0 -46
- data/templates/_site/about.html +0 -55
- data/templates/_site/atom.xml +0 -936
- data/templates/_site/blog.html +0 -581
- data/templates/_site/drafts/outsource-your-blog.html +0 -96
- data/templates/_site/favicon.ico +0 -0
- data/templates/_site/images/about.gif +0 -0
- data/templates/_site/images/alm-overview.jpg +0 -0
- data/templates/_site/images/blog.gif +0 -0
- data/templates/_site/images/build-matrix.png +0 -0
- data/templates/_site/images/building-status-tag.png +0 -0
- data/templates/_site/images/gerrit-demo.jpg +0 -0
- data/templates/_site/images/github.gif +0 -0
- data/templates/_site/images/green_gradient.gif +0 -0
- data/templates/_site/images/header_bg.gif +0 -0
- data/templates/_site/images/header_gradient.gif +0 -0
- data/templates/_site/images/jenkins-jobs.jpg +0 -0
- data/templates/_site/images/jenkins-logo.jpg +0 -0
- data/templates/_site/images/linkedin.gif +0 -0
- data/templates/_site/images/subscribe-icon.gif +0 -0
- data/templates/_site/images/subscribe.png +0 -0
- data/templates/_site/images/title.gif +0 -0
- data/templates/_site/images/twitter.gif +0 -0
- data/templates/_site/images/weibo.gif +0 -0
- data/templates/_site/images/whiteboard.jpg +0 -0
- data/templates/_site/index.html +0 -471
- data/templates/_site/javascripts/jquery.github.js +0 -3
- data/templates/_site/javascripts/jquery.js +0 -19
- data/templates/_site/open-source.html +0 -78
- data/templates/_site/stylesheets/master.css +0 -296
- data/templates/_site/stylesheets/syntax.css +0 -60
@@ -1,96 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3
|
-
|
4
|
-
<html>
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
7
|
-
<title>Larry Cai - Outsource Your Blog</title>
|
8
|
-
<link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8"/>
|
9
|
-
<link rel="stylesheet" href="/stylesheets/syntax.css" type="text/css" media="screen" charset="utf-8"/>
|
10
|
-
<script src="/javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
|
11
|
-
<script src="/javascripts/jquery.github.js" type="text/javascript" charset="utf-8"></script>
|
12
|
-
<link rel='alternate' type='application/rss+xml' href='http://feeds2.feedburner.com/larrycai' />
|
13
|
-
</head>
|
14
|
-
<body>
|
15
|
-
<div id='wrapper'>
|
16
|
-
<div id='header'>
|
17
|
-
<h1><a href='/'>Larry Cai</a></h1>
|
18
|
-
|
19
|
-
<div id='menu'>
|
20
|
-
<ul>
|
21
|
-
<li><a href='/blog.html' id='blog_link' title='Blog'>Blog</a></li>
|
22
|
-
<li><a href='/about.html' id='about_link' title='About'>About</a></li>
|
23
|
-
<li><a href='http://github.com/larrycai' target='_blank' title='GitHub' rel='me' id='github_link'>GitHub</a></li>
|
24
|
-
<li><a href='http://cn.linkedin.com/in/larrycaiyu' title='LinkedIn' target='_blank' rel='me' id='linkedin_link'>LinkedIn</a></li>
|
25
|
-
<li><a href='http://weibo.com/larrycaiyu' title='Weibo' target='_blank' rel='me' id='weibo_link'>Weibo</a></li>
|
26
|
-
</ul>
|
27
|
-
</div>
|
28
|
-
</div>
|
29
|
-
<div id='content'>
|
30
|
-
<div class='post'>
|
31
|
-
<span class='date'>Liquid error: undefined method `strftime' for nil:NilClass</span>
|
32
|
-
<h1><a href='/drafts/outsource-your-blog.html'>Outsource Your Blog</a></h1>
|
33
|
-
<div class='body'><p>Blogs are simple pieces of software. It’s the penultimate “sample application” that you build when learning frameworks like <a href="http://rubyonrails.org/">Rails</a>. But what I’ve found is, the more familiar I am with writing and managing blogging applications, the less I have any interest in doing it. Everything is too heavyweight, with themes and databases and complex administrative interfaces. I found myself yearning for something simple, uncluttered, and under my control.</p>
|
34
|
-
<p>When <a href="http://github.com/blog/272-github-pages">GitHub announced support for user pages</a> I knew in the back of my mind that this was going to be a big deal. At the time I didn’t really know how it could be used for a blog since it seemed to just serve up static pages, but I definitely liked what I was hearing. After a couple of months went by, I finally decided to take the plunge and see what I could accomplish. Surprisingly, everything I wanted in a blog!</p>
|
35
|
-
<h3>Dead Simple Publishing</h3>
|
36
|
-
<p>GitHub Pages are as simple as:</p>
|
37
|
-
<ul>
|
38
|
-
<li>Create a GitHub repository called yourname.github.com</li>
|
39
|
-
<li>Push a ‘master’ branch to that repository</li>
|
40
|
-
<li>GitHub will automatically build your page using <a href="http://github.com/mojombo/jeyll">Jekyll</a></li>
|
41
|
-
</ul>
|
42
|
-
<p>You may not have heard of Jekyll before (at least outside of the context of GitHub pages), but it is essentially an <span class="caps">HTML</span> generator that allows you to generate static <span class="caps">HTML</span> sites based on some very simple rules. Once you learn those rules, it’s extremely simple to build sites that can be deployed anywhere that can serve up <span class="caps">HTML</span> (no server-side required).</p>
|
43
|
-
<p>You can also use a <code>CNAME</code> to redirect your own domain to GitHub.</p>
|
44
|
-
<h3>What About Comments? Images?</h3>
|
45
|
-
<p>New tools have appeared that not only take care of all of the functionality I need for handling blog comments and image uploads, but do them better than any blog engine I have ever used.</p>
|
46
|
-
<p><a href="http://www.disqus.com/">Disqus</a> completely offloads blog post comments, and does a ridiculously good job of it. You get message threading, a great e-mail notification system, spam protection, and best of all it’s as simple as a Javascript include in your blog post template.</p>
|
47
|
-
<p>Images are easy enough to add to a directory structure, but I find it even easier to use <a href="http://www.skitch.com/">Skitch</a>, drag an image to it, webpost it, and then use the direct image <span class="caps">URL</span> to embed it in the post.</p>
|
48
|
-
<h3>Why Do It?</h3>
|
49
|
-
<p>I like using Ruby. I like writing my posts in Textile. I hate managing comments and complicated blog systems. If that sounds like you, you may want to look into outsourcing your own blog.</p></div>
|
50
|
-
</div>
|
51
|
-
|
52
|
-
<div class="related">
|
53
|
-
<h3>Related Posts</h3>
|
54
|
-
<table class="post-list">
|
55
|
-
|
56
|
-
</table>
|
57
|
-
</div>
|
58
|
-
|
59
|
-
<script type="text/javascript" charset="utf-8">
|
60
|
-
var disqus_url = "http://larrycai.github.com//drafts/outsource-your-blog.html";
|
61
|
-
</script>
|
62
|
-
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
63
|
-
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
|
64
|
-
|
65
|
-
<div id="disqus_thread"></div>
|
66
|
-
<script type="text/javascript">
|
67
|
-
var disqus_shortname = 'larrycaiyu'; // required: replace example with your forum shortname
|
68
|
-
|
69
|
-
/* * * DON'T EDIT BELOW THIS LINE * * */
|
70
|
-
(function() {
|
71
|
-
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
72
|
-
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
|
73
|
-
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
74
|
-
})();
|
75
|
-
</script>
|
76
|
-
|
77
|
-
<div class='clearfix'></div>
|
78
|
-
</div>
|
79
|
-
</div>
|
80
|
-
<div id='footer'>
|
81
|
-
Copyright © 2011 Larry Cai. Hosted by <a href='http://github.com/larrycai/larrycai.github.com/' target='_blank'>GitHub</a> and powered by <a href='http://github.com/mojombo/jekyll'>Jekyll</a>, and reuse the template from <a href='http://github.com/mbleigh/mbleigh.github.com/'>Michael Bleigh</a>.
|
82
|
-
</div>
|
83
|
-
<script type="text/javascript">
|
84
|
-
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
|
85
|
-
var disqus_shortname = 'larrycaiyu'; // required: replace example with your forum shortname
|
86
|
-
|
87
|
-
/* * * DON'T EDIT BELOW THIS LINE * * */
|
88
|
-
(function () {
|
89
|
-
var s = document.createElement('script'); s.async = true;
|
90
|
-
s.type = 'text/javascript';
|
91
|
-
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
|
92
|
-
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
93
|
-
}());
|
94
|
-
</script>
|
95
|
-
</body>
|
96
|
-
</html>
|
data/templates/_site/favicon.ico
DELETED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/templates/_site/index.html
DELETED
@@ -1,471 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3
|
-
|
4
|
-
<html>
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
7
|
-
<title>Larry Cai - Larry Cai's blog on the github</title>
|
8
|
-
<link rel="stylesheet" href="/stylesheets/master.css" type="text/css" media="screen" charset="utf-8"/>
|
9
|
-
<link rel="stylesheet" href="/stylesheets/syntax.css" type="text/css" media="screen" charset="utf-8"/>
|
10
|
-
<script src="/javascripts/jquery.js" type="text/javascript" charset="utf-8"></script>
|
11
|
-
<script src="/javascripts/jquery.github.js" type="text/javascript" charset="utf-8"></script>
|
12
|
-
<link rel='alternate' type='application/rss+xml' href='http://feeds2.feedburner.com/larrycai' />
|
13
|
-
</head>
|
14
|
-
<body>
|
15
|
-
<div id='wrapper'>
|
16
|
-
<div id='header'>
|
17
|
-
<h1><a href='/'>Larry Cai</a></h1>
|
18
|
-
|
19
|
-
<div id='menu'>
|
20
|
-
<ul>
|
21
|
-
<li><a href='/blog.html' id='blog_link' title='Blog'>Blog</a></li>
|
22
|
-
<li><a href='/about.html' id='about_link' title='About'>About</a></li>
|
23
|
-
<li><a href='http://github.com/larrycai' target='_blank' title='GitHub' rel='me' id='github_link'>GitHub</a></li>
|
24
|
-
<li><a href='http://cn.linkedin.com/in/larrycaiyu' title='LinkedIn' target='_blank' rel='me' id='linkedin_link'>LinkedIn</a></li>
|
25
|
-
<li><a href='http://weibo.com/larrycaiyu' title='Weibo' target='_blank' rel='me' id='weibo_link'>Weibo</a></li>
|
26
|
-
</ul>
|
27
|
-
</div>
|
28
|
-
</div>
|
29
|
-
<div id='content'>
|
30
|
-
<div class='home_box' id='home_left'>
|
31
|
-
<h2><a href='http://feeds.feedburner.com/~u/14174549791849888941' class='float-right'><img src='/images/subscribe-icon.gif' alt='Subscribe'/></a
|
32
|
-
>最新博客 (<a href='/blog.html'>更多</a>)</h2>
|
33
|
-
|
34
|
-
|
35
|
-
<div class='post'>
|
36
|
-
<span class='date'>06 Mar 2012</span>
|
37
|
-
<h1><a href='/2012/03/06/travis-ci-is-evolution.html'>Travis CI会替代Jenkins吗?</a></h1>
|
38
|
-
<div class='body'><h1>介绍</h1>
|
39
|
-
|
40
|
-
<p>你可能用Github了。但是你是怎么自动构建你的开源项目的呢?你的Github项目有“构建状态”标签吗?</p>
|
41
|
-
|
42
|
-
<p><img src="http://larrycai.github.com/images/building-status-tag.png" alt="Github上的项目构建状态" /></p>
|
43
|
-
|
44
|
-
<p>如果你还不知道这个,你就有些落伍了,因为这是Travis CI带来的持续集成的革新,它可能会替代Jenkins现在的地位。</p>
|
45
|
-
|
46
|
-
<p>让我们一起来看看Travis-ci到底带来了什么,先从Jenkins说起。</p>
|
47
|
-
|
48
|
-
<p>在写这篇博客时,发现好友晓斌也写了一篇<a href="http://www.juvenxu.com/2012/03/06/travis-ci/">Travis CI,翩翩而至的CI云</a>,可以参考阅读。</p>
|
49
|
-
|
50
|
-
<h2>Jenkins介绍</h2>
|
51
|
-
|
52
|
-
<p>持续集成是敏捷软件开发的一个重要工具,开源工具<a href="http://jenkins-ci.org/">Jenkins</a>是实施持续集成首选,大概占据了半壁江山。</p>
|
53
|
-
|
54
|
-
<p><img src="http://larrycai.github.com//images/jenkins-jobs.jpg" alt="Jenkins界面" /></p>
|
55
|
-
|
56
|
-
<p>Jenkins以前叫Hudson,后来由于Oracle收购了Sun公司,Oracle与开源软件社区谈崩了。Hudson创始人Kohsuke Kawaguchi(简称 KK)一怒之下,和社区的人其他人重起炉灶,建立了Jenkins社区。详细可以看看InfoQ的文章<a href="http://www.infoq.com/cn/news/2011/01/hudson-jenkins2">Hudson社区提议将项目更名为Jenkins</a>。</p>
|
57
|
-
|
58
|
-
<h3>Jenkins功能</h3>
|
59
|
-
|
60
|
-
<p>它有很多极佳的特性:</p>
|
61
|
-
|
62
|
-
<ol>
|
63
|
-
<li>易于安装:一个命令就可启动,也方便部署到各种Web容器中(如tomcat)。</li>
|
64
|
-
<li>易于配置:所有的配置都在Web界面实现,权限控制得也不错。</li>
|
65
|
-
<li>插件支持:基本上所有的扩展都是有插件完成的,开发插件也很方便,由此产生了庞大的社区。</li>
|
66
|
-
<li>支持分布式构建:Jenkins能够让通过主从模式(master/slave)多台机器一起构建。</li>
|
67
|
-
</ol>
|
68
|
-
|
69
|
-
|
70
|
-
<h3>Jenkins在企业中常见步骤</h3>
|
71
|
-
|
72
|
-
<p>Jenkins服务器一般先架设在一台服务器上,有配置管理人员管理。</p>
|
73
|
-
|
74
|
-
<p>产品有构建需求后,配置管理人员就新建一个任务,配好源码仓库,设置构建时间,指定运行脚本来编译测试产品,并且设置报告输出。一切都可以在Web界面中运行。</p>
|
75
|
-
|
76
|
-
<h2>Jenkins的一些弊端</h2>
|
77
|
-
|
78
|
-
<p>Jenkins虽然非常好用,但还是有些弊端。</p>
|
79
|
-
|
80
|
-
<h3>多平台或依赖的包</h3>
|
81
|
-
|
82
|
-
<p>如果你的软件想在不同的操作系统软件构建并验证,这将是相当有难度和技巧性,一般主要是准备不同的操作系统的机器,然后使用主/从模式进行分布式构建。</p>
|
83
|
-
|
84
|
-
<p>在C++中你可以使用有关的交叉编译器,一个不错的解决方案。</p>
|
85
|
-
|
86
|
-
<p>但是再进一步如果你的第三方软件和不同的依赖比较多,那么这个环境的准备是非常困难的,因为这个组合将很大。</p>
|
87
|
-
|
88
|
-
<p>当然你可有使用虚拟机的技术vagrant/virtualbox,参见<a href="http://larrycai.github.com/2011/10/25/vagrant-jenkins-ci.html">使用vagrant+jenkins来管理虚拟机的技巧</a>。可以工作,不太优雅。因为它不是原生的,有点复杂。</p>
|
89
|
-
|
90
|
-
<h3>配置管理人员的工作</h3>
|
91
|
-
|
92
|
-
<p>一般来说Jenkins的构建任务,它是集中控制的。大多来说都是有专职的配置管理人员来管理,否者权限会混乱。</p>
|
93
|
-
|
94
|
-
<p>当有需求时,他们负责在CI服务器创建任务(记住:这些配置文件不是有版本控制的)。这个就涉及到了沟通成本,你有变化需求,很难及时满足。</p>
|
95
|
-
|
96
|
-
<p>由于服务器是有限的,它主要构建重要分支的内容。在你自己的私有分支上运行CI是比较奢侈的,而且环境不一样,也不推荐。</p>
|
97
|
-
|
98
|
-
<p>你可以想象如果在一个C/C++产品的公司,你要为一个Lisp的项目创建CI要花多久?</p>
|
99
|
-
|
100
|
-
<p>作为开发者,为什么不能随时构建你想要的东西呢?这就是Travis CI想做的。</p>
|
101
|
-
|
102
|
-
<h2>Travis CI 介绍</h2>
|
103
|
-
|
104
|
-
<p>Travis CI 这里就不介绍怎么使用了具体可以先看<a href="http://www.juvenxu.com/2012/03/06/travis-ci/">晓斌的博客</a>和<a href="http://saberma.me/other/2011/11/29/travis-ci-is-a-free-continuous-integration-test-server.html">免费的持续集成测试服务</a>,强烈建议你先试一下。</p>
|
105
|
-
|
106
|
-
<p>初看Travis CI象和Jenkins没啥区别,指定你Github中的项目,然后他帮你编译,而且它使用的也是Vagrant/Virtualbox技术。但实际上里面有很多好点子。</p>
|
107
|
-
|
108
|
-
<h2>Travis CI带来的变革</h2>
|
109
|
-
|
110
|
-
<h3>配置本地化和可读性</h3>
|
111
|
-
|
112
|
-
<p>不像以前,构建的任务是在Jenkins服务器上的,现在构建的配置文件直接就和源码放在一起,而且配置文件使用DSL写的,可读性更高。</p>
|
113
|
-
|
114
|
-
<pre><code>before_script:
|
115
|
-
- sudo apt-get install pandoc
|
116
|
-
- sudo apt-get install ttf-arphic-gbsn00lp ttf-arphic-ukai ttf-wqy-microhei ttf-wqy-zenhei
|
117
|
-
- sudo apt-get install texlive-xetex texlive-latex-recommended texlive-latex-extra
|
118
|
-
- gem install mkbok
|
119
|
-
|
120
|
-
rvm:
|
121
|
-
- 1.9.3
|
122
|
-
- 1.8.7
|
123
|
-
script: mkbok --lang zh --build pdf
|
124
|
-
|
125
|
-
after_script:
|
126
|
-
- which curl ; curl -v --upload-file sdcamp.zh.pdf http://blobs.ge.tt/3iBcNNC/sdcamp.zh.pdf?sig=-TY5O1GAx8xHwWiCqd8aySlQiroFAnHK2o4
|
127
|
-
</code></pre>
|
128
|
-
|
129
|
-
<p>作为用户,关心的是要哪些依赖包,然后怎么构建就行了,上面的配置每一行都没有浪费。</p>
|
130
|
-
|
131
|
-
<h3>多版本支持</h3>
|
132
|
-
|
133
|
-
<p>像上面的例子中,我要求在两个Ruby环境中运行,它就帮我做到了,我并不关心它是怎么切换的。</p>
|
134
|
-
|
135
|
-
<p><img src="http://larrycai.github.com/images/build-matrix.png" alt="多版本构建结果" /></p>
|
136
|
-
|
137
|
-
<h3>原生的云技术来分布式构建</h3>
|
138
|
-
|
139
|
-
<p>Travis CI使用的Ruby语言,一开始考虑的就是分布式构建,比Jenkins的插件式进了一步。</p>
|
140
|
-
|
141
|
-
<p>虽然Travis CI并不是直接用到了云机器,它的虚拟机部分只是Vagrant/Virtualbox,但是这一块是很容易迁移到其他的技术的。</p>
|
142
|
-
|
143
|
-
<h1>总结</h1>
|
144
|
-
|
145
|
-
<p>Jenkins有点可惜,改了名字以后,功能上面并没有突破。当然这就是开源竞争的好处,总有新的理念,新的工具产生。你不前进,别人就迎头赶上。</p>
|
146
|
-
|
147
|
-
<p>Travis CI现在只是支持Github的公开项目,但已经爆发出它的优点了。要不了多久,我相信就能运行在你公司内部了。</p>
|
148
|
-
|
149
|
-
<p>让我们一起期待这个革新吧!</p>
|
150
|
-
|
151
|
-
<h1>相关阅读</h1>
|
152
|
-
|
153
|
-
<ol>
|
154
|
-
<li>Juven Xu的“Travis CI,翩翩而至的CI云” <a href="http://www.juvenxu.com/2012/03/06/travis-ci/">http://www.juvenxu.com/2012/03/06/travis-ci/</a></li>
|
155
|
-
<li>免费的持续集成测试服务 <a href="http://saberma.me/other/2011/11/29/travis-ci-is-a-free-continuous-integration-test-server.html">http://saberma.me/other/2011/11/29/travis-ci-is-a-free-continuous-integration-test-server.html</a></li>
|
156
|
-
</ol>
|
157
|
-
|
158
|
-
</div>
|
159
|
-
<a href='/2012/03/06/travis-ci-is-evolution.html#disqus_thread'>View Comments</a>
|
160
|
-
</div>
|
161
|
-
|
162
|
-
<div class='post'>
|
163
|
-
<span class='date'>13 Jan 2012</span>
|
164
|
-
<h1><a href='/2012/01/13/ebook-chinese-fonts.html'>开源书和开源技术-PDF中蛋疼的中文字体</a></h1>
|
165
|
-
<div class='body'><h1>介绍</h1>
|
166
|
-
|
167
|
-
<p>上次我介绍了一个用<a href="http://www.ituring.com.cn/article/828">Markdown格式来写开源书和相关的开源技术</a>,还留了个在Linux下产生PDF所需要的中文字体这个大尾巴。这次我想借用我写<a href="http://weibo.com/2104936813/y0oXC350t">【跟我学企业敏捷开发】</a>的一点经验,给不太了解这一块知识的朋友一起探讨一下。</p>
|
168
|
-
|
169
|
-
<p>有些问题还是没有解决,希望有Latex的高手解答。</p>
|
170
|
-
|
171
|
-
<p>不管怎样,还是希望能借此机会推动国内电子书,特别是开源电子书的发展。</p>
|
172
|
-
|
173
|
-
<h1>Linux下的中文编码和字体</h1>
|
174
|
-
|
175
|
-
<p>首先,我用的是Linux环境并且选用的是<strong>UTF-8</strong>的编码,而不是GBK,否者在github上显示会有问题,不了解这方面的朋友自己找找资料吧,够讲个把小时的。</p>
|
176
|
-
|
177
|
-
<p>在产生PDF时,一般建议内嵌中文字体的,但是真正能用的中文字体实际很少,极大多数是有版权的:</p>
|
178
|
-
|
179
|
-
<ul>
|
180
|
-
<li><a href="http://www.arphic.com.tw/">文鼎</a>开放的四套字体(简报宋、细上海宋、简中楷、中楷),没有一点版权问题,是大部分的中文Linux的缺省安装。</li>
|
181
|
-
<li><a href="http://wenq.org/">文泉驿</a>的几套字体(微米黑、正黑、点阵宋体)是开放但是GPL性质的,所以不是随便可以商用的。</li>
|
182
|
-
<li>Adobe有两套开放字体(宋体、黑体)我认为是可以随便用的,忘了在哪里看到这个解释的了。</li>
|
183
|
-
</ul>
|
184
|
-
|
185
|
-
|
186
|
-
<p>可以看看<a href="http://wiki.ubuntu.org.cn/�%8D费中文字体">Ubuntu免费中文字体</a>的介绍有个认识。</p>
|
187
|
-
|
188
|
-
<h2>怎么选择对应字体</h2>
|
189
|
-
|
190
|
-
<p>一般缺省中文正文字体是宋体、细明体,对应英文Serif类的英文字体:Georgia、Times New Roman等。</p>
|
191
|
-
|
192
|
-
<p>标题和重要内容可以选楷体和黑体,对应英文Sans Serif类的英文字体:Arial、Tahoma、Verdana等</p>
|
193
|
-
|
194
|
-
<p>技术文章中常见的代码典型的等宽体用黑体,对应英文Monospace类的英文字体:Courier New等</p>
|
195
|
-
|
196
|
-
<p>所以对应的在<a href="https://github.com/larrycai/sdcamp/blob/master/latex/config.yml">我的中文Latex配置</a>中可选的是:</p>
|
197
|
-
|
198
|
-
<ul>
|
199
|
-
<li>font:文鼎的简报宋、细上海宋,文泉驿的点阵宋体,Adobe的宋体</li>
|
200
|
-
<li>bold: 文鼎的简中楷、中楷,文泉驿的微米黑、正黑,Adobe的黑体</li>
|
201
|
-
<li>mono: 文泉驿的微米黑、正黑,Adobe的黑体</li>
|
202
|
-
</ul>
|
203
|
-
|
204
|
-
|
205
|
-
<h2>如何安装字体</h2>
|
206
|
-
|
207
|
-
<p>我用的试验环境是Ubuntu 11.04 (Natty),大部分可以直接从Ubuntu源中下载了。</p>
|
208
|
-
|
209
|
-
<p>你可以用命令<code>fc-list :lang=zh-cn</code>查看安装好的中文字体,结果中前半部分就是字体名称(如<code>AR PL UMing CN</code>)。</p>
|
210
|
-
|
211
|
-
<pre><code>user@puppet1:~$ fc-list :lang=zh-cn | grep CN
|
212
|
-
AR PL UMing CN:style=Light
|
213
|
-
AR PL UKai CN:style=Book
|
214
|
-
</code></pre>
|
215
|
-
|
216
|
-
<p>文鼎开放的四套字体的Ubuntu包、字体名字和名称如下:</p>
|
217
|
-
|
218
|
-
<pre><code>ttf-arphic-gbsn00lp "AR PL SungtiL GB" 文鼎PL简报宋
|
219
|
-
ttf-arphic-gkai00mp "AR PL KaitiM GB" 文鼎PL简中楷
|
220
|
-
ttf-arphic-ukai "AR PL UKai" 文鼎PL中楷
|
221
|
-
ttf-arphic-uming "AR PL UMing" 文鼎PL细上海宋
|
222
|
-
</code></pre>
|
223
|
-
|
224
|
-
<p>文泉驿字体的Ubuntu包、字体名字和名称如下</p>
|
225
|
-
|
226
|
-
<pre><code>ttf-wqy-microhei "WenQuanYi Micro Hei" 文泉驿的微米黑
|
227
|
-
ttf-wqy-zenhei "WenQuanYi Zen Hei" 文泉驿的正黑
|
228
|
-
xfonts-wqy "WenQuanYi Bitmap Song" 文泉驿的点阵宋体
|
229
|
-
</code></pre>
|
230
|
-
|
231
|
-
<p>Adobe的中文字体有<a href="http://www.adobe.com/support/downloads/detail.jsp?ftpID=4421">官方下载</a></p>
|
232
|
-
|
233
|
-
<pre><code>$ tar -jzxf FontPack910_chs_i486-linux.tar.bz2
|
234
|
-
$ tar -xvf CHSKIT/LANGCHS.TAR
|
235
|
-
$ mkdir ~/.fonts
|
236
|
-
$ cp Adobe/Reader9/Resource/CIDFont/*.otf ~/.fonts
|
237
|
-
$ fc-cache -f -v
|
238
|
-
$ fc-list :lang=zh | grep Adobe
|
239
|
-
</code></pre>
|
240
|
-
|
241
|
-
<h2>蛋疼的问题</h2>
|
242
|
-
|
243
|
-
<p>只可惜现在正文在产生PDF时没有一种字体是有完美表现的。</p>
|
244
|
-
|
245
|
-
<ol>
|
246
|
-
<li>文鼎贡献的字体中台湾字形的细上海宋的句号在中间,出来的效果不伦不类的。</li>
|
247
|
-
<li>文鼎贡献的字体中大陆字形的简中楷和简报宋,标点符号的位置是对的,但是当碰到条目(Item)的时候条目的点没能显示出来。</li>
|
248
|
-
<li>Adobe的宋体,条目的时候显示一个田子框,很难看。</li>
|
249
|
-
<li>文泉驿的点阵宋体老是转化Latex时出错,搞不定。</li>
|
250
|
-
</ol>
|
251
|
-
|
252
|
-
|
253
|
-
<p>现在将就着用文鼎的细上海宋。</p>
|
254
|
-
|
255
|
-
<p>【更新】
|
256
|
-
2、3 条目的问题,我hack成其他字符(*)显示就没问题了(如下),不知道缺省的圆点显示不对。<a href="http://wiki.ctex.org/index.php/LaTeX/%E5%88%97%E8%A1%A8">http://wiki.ctex.org/index.php/LaTeX/%E5%88%97%E8%A1%A8</a>,现在就用文鼎的细上海宋了。</p>
|
257
|
-
|
258
|
-
<pre><code>\begin{itemize}\setlength{\itemsep}{1pt}\setlength{\parskip}{0pt}\setlength{\parsep}{0pt}
|
259
|
-
\item[*]
|
260
|
-
% 原来是
|
261
|
-
% \item
|
262
|
-
</code></pre>
|
263
|
-
|
264
|
-
<h1>其他</h1>
|
265
|
-
|
266
|
-
<p>本文也是我用git记录在<a href="https://github.com/larrycai/larrycai.github.com">github</a>上的,你可以看到每次的变化。</p>
|
267
|
-
|
268
|
-
<p>如果对此文有兴趣,帮忙顶一下,别忘了 <a href="http://weibo.com/larrycaiyu">@larrycaiyu</a>。</p>
|
269
|
-
|
270
|
-
<h1>参考</h1>
|
271
|
-
|
272
|
-
<ol>
|
273
|
-
<li>中文字体没有版权问题的解决方案?http://bbs.ctex.org/viewthread.php?tid=46106&extra=&page=1</li>
|
274
|
-
</ol>
|
275
|
-
|
276
|
-
</div>
|
277
|
-
<a href='/2012/01/13/ebook-chinese-fonts.html#disqus_thread'>View Comments</a>
|
278
|
-
</div>
|
279
|
-
|
280
|
-
<div class='post'>
|
281
|
-
<span class='date'>31 Dec 2011</span>
|
282
|
-
<h1><a href='/2011/12/31/ebook-by-markdown.html'>开源书和开源技术-Markdown篇</a></h1>
|
283
|
-
<div class='body'><h1>开源书和开源技术-Markdown篇</h1>
|
284
|
-
|
285
|
-
<h1>背景</h1>
|
286
|
-
|
287
|
-
<p>看到<a href="http://weibo.com/1404949082/xDeyDEaDq">霍泰稳关于infoq的架构师电子书问题的微博</a>和图灵社区的文章<a href="http://www.ituring.com.cn/article/details/764">为什么写作自由书籍?</a>,我就想通过一个用Markdown格式写的<a href="http://progit.org/">Pro Git</a>开源书 的例子来介绍其中用到的技术。希望能借此机会推动国内电子书,特别是开源电子书的发展。</p>
|
288
|
-
|
289
|
-
<p>【声明】我并没有写书的经历,这里只是对电子书出版技术的入门介绍而已。</p>
|
290
|
-
|
291
|
-
<h1>从Pro Git说起</h1>
|
292
|
-
|
293
|
-
<p>如果你了解Git,或者想了解Git。那么你就应该知道<a href="http://progit.org/">Pro Git</a>,它是Git的书中写得最好的一本(至少是之一),可是你是否知道它有网络中文版,而且能在iPad上极其漂亮得阅读。并且是免费的,不是盗版的免费!如果你想要最新的,你甚至可以自己生成它。哈哈,我就是这么干的。</p>
|
294
|
-
|
295
|
-
<p>这一切就归功于开源社区和它后面用到的技术。</p>
|
296
|
-
|
297
|
-
<h1>开源书</h1>
|
298
|
-
|
299
|
-
<p>这里我不用多讲,开源书就像其他的开源产品(如维基百科)一样,只要是开放的,社区就有人会贡献。<a href="http://progit.org/">Pro Git</a>的作者Scott很慷慨得把书的内容全部共享在<a href="http://github.com/progit/progit">github/progit</a>库中,使用得是<a href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/">CC BY-NC-SA 3.0</a>。</p>
|
300
|
-
|
301
|
-
<p>Scott只负责英文版,其他许许多多语言的翻译都是社区贡献的,中国翻译相当有质量,你可以在线读<a href="http://progit.org/book/zh/">Pro Git中文版</a>。</p>
|
302
|
-
|
303
|
-
<h1>开源技术生成电子书</h1>
|
304
|
-
|
305
|
-
<p>这本书不仅仅开源了内容,使用的技术也是开源的。让我们看看他是怎么做的。</p>
|
306
|
-
|
307
|
-
<h2>markdown原始文件</h2>
|
308
|
-
|
309
|
-
<p>首先书的内容是用markdown格式写的。markdown格式的普及要归功于<a href="github.com">Github</a>和<a href="http://stackoverflow.com/">StackOverflow</a>。因为它们越来越流行,它们支持markdown格式也越来越流行。这里要赞一个的是,国内的<a href="http://www.ituring.com.cn/">图灵社区</a>也支持markdown,用起来超级方便。</p>
|
310
|
-
|
311
|
-
<p>简单来说,markdown格式的文件看着像一般的文本文件,里面只是加了很少的格式标记,因此看文本文件也不影响理解,这种格式也有很多工具帮你去转化,而且很容自动化解决。并且这些技术大多数是开源或免费的。</p>
|
312
|
-
|
313
|
-
<p>你可以直接看一下【Pro Git】的<a href="https://raw.github.com/progit/progit/master/zh/01-introduction/01-chapter1.markdown">“第一章 介绍” 的markdown原始文件</a>,顺便看看github自动生成的简单<a href="https://github.com/progit/progit/blob/master/zh/01-introduction/01-chapter1.markdown">“第一章 介绍” 的html</a>。</p>
|
314
|
-
|
315
|
-
<h2>产生电子书</h2>
|
316
|
-
|
317
|
-
<h3>epub/mobi格式</h3>
|
318
|
-
|
319
|
-
<p>Ruby的<a href="https://github.com/rtomayko/rdiscount">rdiscount</a>帮你从markdown转成html格式,然后有<a href="calibre">Calibre</a>附带的命令<code>ebook-convert</code>生成最终的<code>.mobi</code> (Kindle) 和 <code>.epub</code> (iPad)。</p>
|
320
|
-
|
321
|
-
<h3>PDF格式</h3>
|
322
|
-
|
323
|
-
<p>为了能达到出版的质量,Latex是一个常用的格式,PDF也能很容易的产生出来,有关Latex,自己看看参考链接学习吧。</p>
|
324
|
-
|
325
|
-
<p><a href="http://johnmacfarlane.net/pandoc/">pandoc</a>能帮着从markdown转换出latex格式,然后<a href="http://www.tug.org/texlive/">TexLive</a>软件中的<code>xelatex</code>再转成PDF格式。</p>
|
326
|
-
|
327
|
-
<h2>试验环境</h2>
|
328
|
-
|
329
|
-
<p>你只需要一台Linux机器(虚拟机就可以了)和简单的Linux命令就可以试验了。有git和ruby的知识那就更方便了。</p>
|
330
|
-
|
331
|
-
<p>我用的试验环境是Ubuntu 11.04 (Natty)</p>
|
332
|
-
|
333
|
-
<h3>下载Pro Git开源书</h3>
|
334
|
-
|
335
|
-
<p>很简单,<code>git clone</code>一下就可以了,下载它的源文件包我觉得还是烦了点。</p>
|
336
|
-
|
337
|
-
<pre><code>$ git clone https://github.com/progit/progit.git
|
338
|
-
</code></pre>
|
339
|
-
|
340
|
-
<h3>epub/mobi格式</h3>
|
341
|
-
|
342
|
-
<p>做电子书相对简单一点,因为要求没有PDF的高,<a href="http://calibre-ebook.com/">calibre</a>就可以满足了。</p>
|
343
|
-
|
344
|
-
<p>如果装的Ubuntu是服务器版的(没有X-Windows),建议安装<a href="http://en.wikipedia.org/wiki/Xvfb">xvfb</a>无头(headless)X服务器,因为不知道什么原因有几个命令需要。XMing还不行,因为需要<code>X-Input</code></p>
|
345
|
-
|
346
|
-
<pre><code>$ sudo apt-get install ruby rubygems # ruby 1.8.7 is used
|
347
|
-
$ sudo apt-get install calibre # calibre 0.7.44 for ubuntu 11.04
|
348
|
-
$ gem install rdiscount ruby-debug
|
349
|
-
$ xvfb-run ./makeebooks zh # 缺省.mobi格式
|
350
|
-
$ export FORMAT=epub
|
351
|
-
$ xvfb-run ./makeebooks zh # .epub格式
|
352
|
-
</code></pre>
|
353
|
-
|
354
|
-
<h3>PDF格式</h3>
|
355
|
-
|
356
|
-
<p>生成PDF是一个比较复杂的东西,<a href="http://johnmacfarlane.net/pandoc/">pandoc</a>用Ubuntu库里的,TexLive建议下载最新的<a href="http://www.tug.org/texlive/">TexLive</a>包安装,并配置到搜索路径中。</p>
|
357
|
-
|
358
|
-
<pre><code>$ sudo apt-get install pandoc
|
359
|
-
$ # 安装texlive 2011
|
360
|
-
</code></pre>
|
361
|
-
|
362
|
-
<p>因为是中文PDF,需要把字体嵌入在文件中,因此需要安装字体文件(如果不是Ubuntu中文版)</p>
|
363
|
-
|
364
|
-
<pre><code>$ sudo apt-get install language-support-fonts-zh-hans
|
365
|
-
</code></pre>
|
366
|
-
|
367
|
-
<p>现在你就可以生成pdf文件了。</p>
|
368
|
-
|
369
|
-
<pre><code>$ ./makepdfs zh
|
370
|
-
</code></pre>
|
371
|
-
|
372
|
-
<h1>其他常用的格式</h1>
|
373
|
-
|
374
|
-
<p>计算机类图书对格式要求不是很多,图文、章节、源代码基本就够了,就算有些复杂公式,也可用图来显示。这也从理论上说明,它不需要复杂的格式。现在对这类技术书出版我的理解主要有几种:</p>
|
375
|
-
|
376
|
-
<ol>
|
377
|
-
<li>Microsoft的Word格式,虽然国内出版界如日中天,缺省就认它(对技术没追求,鄙视)。简单好学,但是不擅长自动化,是开源的死敌。</li>
|
378
|
-
<li>Latex格式(就是Donald E. Knuth(高德纳)发明的,这是很棒的东西,特别适合学术类的各种复杂的公式等,不过学习曲线很高,国内也只有几家学术期刊使用。</li>
|
379
|
-
<li>docbook格式是最有名的(从SGML演化过来?),Orielly和Pragmatic出版社缺省就用它,它能 很方便的转化出出版要的各种样式。如<a href="http://www.wakaleo.com/books/jenkins-the-definitive-guide">Jenkins - the definition guide</a>开源书就是采用docbook。但由于是XML格式,很多人不习惯,而且多人网上协作不是很方便。</li>
|
380
|
-
<li>通过蒋鑫的<a href="http://www.worldhello.net/gotgithub/">Got Github</a>开源书,我也了解reStructureText也是和markdown差不多纯文本(plain text)的,也是蛮流行的。</li>
|
381
|
-
</ol>
|
382
|
-
|
383
|
-
|
384
|
-
<p>如果有机会,我再介绍一下docbook和reStructureText的相关技术。</p>
|
385
|
-
|
386
|
-
<h1>其他</h1>
|
387
|
-
|
388
|
-
<p>本文也是我用git记录在<a href="https://github.com/larrycai/larrycai.github.com">github</a>上的,你可以看到每次的变化。</p>
|
389
|
-
|
390
|
-
<p>如果对此文有兴趣,帮忙顶一下,别忘了 <a href="http://weibo.com/larrycaiyu">@larrycaiyu</a>。</p>
|
391
|
-
|
392
|
-
<h1>Latex的参考</h1>
|
393
|
-
|
394
|
-
<ol>
|
395
|
-
<li>http://share.chinatex.org/</li>
|
396
|
-
<li>http://manual.calibre-ebook.com/conversion.html</li>
|
397
|
-
<li>http://calibre-ebook.com/download_linux</li>
|
398
|
-
<li>http://johnmacfarlane.net/pandoc/</li>
|
399
|
-
<li>http://latex.yo2.cn/articles/latex-introduction0.html</li>
|
400
|
-
<li>http://product.china-pub.com/54569</li>
|
401
|
-
</ol>
|
402
|
-
|
403
|
-
</div>
|
404
|
-
<a href='/2011/12/31/ebook-by-markdown.html#disqus_thread'>View Comments</a>
|
405
|
-
</div>
|
406
|
-
|
407
|
-
</div>
|
408
|
-
|
409
|
-
<div class='home_box' id='home_right'>
|
410
|
-
|
411
|
-
<h2>联系方式</h2>
|
412
|
-
<div class='sidebar'>
|
413
|
-
<div class="sidebar-item">
|
414
|
-
<dl>
|
415
|
-
<dt>邮件:</dt>
|
416
|
-
<dd>larry.caiyu AT gmail.com </dd>
|
417
|
-
|
418
|
-
<dt>微博:</dt>
|
419
|
-
<dd><a href="http://weibo.com/larrycaiyu">http://weibo.com/larrycaiyu</a></dd>
|
420
|
-
|
421
|
-
</dl>
|
422
|
-
|
423
|
-
</div>
|
424
|
-
</div>
|
425
|
-
<h2>Open Source</h2>
|
426
|
-
<div id='github-projects'>
|
427
|
-
<div class="repo"> <h3><a href="http://github.com/larrycai/doxia-module-markdown">doxia-module-markdown</a></h3> <span class="desc">markdown plugin for maven site</span></div>
|
428
|
-
<div class="repo"> <h3><a href="http://github.com/larrycai/astyleclipse">astyleclipse</a></h3> <span class="desc">astyle c++ format plugin for eclipse 3.1 (doesn't works now)</span></div>
|
429
|
-
<div class="repo"> <h3><a href="http://github.com/larrycai/redmine-plugin">redmine-plugin (forked)</a></h3> <span class="desc">redmine plugin inside jenkins to connect with redmine</span></div>
|
430
|
-
</div>
|
431
|
-
</div>
|
432
|
-
|
433
|
-
<script type="text/javascript" charset="utf-8">
|
434
|
-
$.githubUser('larrycai', function(data) {
|
435
|
-
$('#github-projects').html('');
|
436
|
-
|
437
|
-
var repos = data.user.repositories;
|
438
|
-
repos.sort(function(a,b) {
|
439
|
-
return b.watchers - a.watchers;
|
440
|
-
});
|
441
|
-
|
442
|
-
$(repos.slice(0,6)).each(function() {
|
443
|
-
$('#github-projects').append("\
|
444
|
-
<div class='repo'>\
|
445
|
-
<h3><a href='" + this.url + "'>" + this.name + "</a></h3>\
|
446
|
-
<span class='desc'>"+this.description+"</span>\
|
447
|
-
</div>");
|
448
|
-
});
|
449
|
-
});
|
450
|
-
</script>
|
451
|
-
|
452
|
-
<div class='clearfix'></div>
|
453
|
-
</div>
|
454
|
-
</div>
|
455
|
-
<div id='footer'>
|
456
|
-
Copyright © 2011 Larry Cai. Hosted by <a href='http://github.com/larrycai/larrycai.github.com/' target='_blank'>GitHub</a> and powered by <a href='http://github.com/mojombo/jekyll'>Jekyll</a>, and reuse the template from <a href='http://github.com/mbleigh/mbleigh.github.com/'>Michael Bleigh</a>.
|
457
|
-
</div>
|
458
|
-
<script type="text/javascript">
|
459
|
-
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
|
460
|
-
var disqus_shortname = 'larrycaiyu'; // required: replace example with your forum shortname
|
461
|
-
|
462
|
-
/* * * DON'T EDIT BELOW THIS LINE * * */
|
463
|
-
(function () {
|
464
|
-
var s = document.createElement('script'); s.async = true;
|
465
|
-
s.type = 'text/javascript';
|
466
|
-
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
|
467
|
-
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
468
|
-
}());
|
469
|
-
</script>
|
470
|
-
</body>
|
471
|
-
</html>
|