Skip to content

Commit f25060d

Browse files
committed
test
0 parents  commit f25060d

File tree

543 files changed

+16682
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

543 files changed

+16682
-0
lines changed

404.html

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: '404 培鸡诺特方的'
3+
layout: page
4+
---
5+
6+
<script>
7+
var posts =
8+
{
9+
{% for post in site.posts %} {% if post.thread %}
10+
"{{ post.thread }}" : "{{ post.url }}",{% endif %}{% endfor %}
11+
};
12+
13+
var path = location.pathname;
14+
if(path.charAt(path.length - 1) == '/') path = path.substring(0, path.length - 1);
15+
var name = path.substring(path.lastIndexOf('/') + 1);
16+
var url = posts[name];
17+
if (url)
18+
{
19+
document.write("您访问的文章已经转移到新网址,正在为您转跳到 <a href=" + url + ">" + url + "</a>");
20+
location.href = url;
21+
}
22+
else
23+
{
24+
document.write("文章或附件未找到,请转到 <a href='/categories'>分类</a> 或返回 <a href='/'>首页</a>。如有问题请联系 <a href='mailto:{{ site.email }}'>{{ site.email }}</a><iframe scrolling='no' frameborder='0' src='http://yibo.iyiyun.com/js/yibo404/key/7349' width='640' height='462' style='display:block;'></iframe>");
25+
}
26+
</script>

CNAME

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yonsm.net

README.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[Yonsm.NET](http://www.yonsm.net) 的博客
2+
3+
本博客运行于 [Jekyll](http://jekyllrb.com) @ [GitHub](http://github.com/Yonsm/NET),博客模板修改自 [WebFrog](http://webfrogs.me/) 的博客。本博客模板已经全部通用化,使用极其简单。
4+
5+
6+
## 安装
7+
8+
1. [Fork](https://github.com/Yonsm/NET/fork) [http://github.com/Yonsm/NET](http://github.com/Yonsm/NET)
9+
10+
2. 所有个人相关的配置都在 _config.yml 中,修改其中内容:
11+
* markdown: rdiscount ***(建议不修改)***
12+
* permalink: /:title/ ***固定链接(建议别修改)***
13+
* url: http://yonsm.net ***网站链接***
14+
* name: Yonsm.NET ***网站名***
15+
* author: Yonsm ***作者***
16+
* qq: 123018 ***用于关于页面的QQ号(可选)***
17+
* email: [email protected] ***电子邮件***
18+
* duoshuo: yonsm ***多说评论帐号***
19+
* beian: 浙ICP备12026616号 ***备案号(可选)***
20+
* cnzz: 119959 ***站长统计(可选)***
21+
* weibo: 1885061391 ***用于关于页面微博帐号***
22+
* github: Yonsm ***GitHub帐号***
23+
* pygments: true ***语法高亮(建议不修改)***
24+
* safe: true ***安全模式(建议不修改)***
25+
* paginate: 20 ***首页分页***
26+
* truncate: 300 ***首页文章摘要字数(省略则不显示摘要,摘要风格尚需进一步美化,建议不使用)***
27+
* about: "这里是我的博客。" ***关于介绍页面的内容***
28+
29+
3. 删除掉 _posts 目录下的所有文章,然后创建你的文章即可。
30+
31+
所有安装操作均可在浏览器中线操作,不需要在本地做任何额外工作。
32+
33+
## 迁移
34+
35+
**如果你不需要迁移,请跳过此步骤**
36+
37+
如果你之前在使用 WordPress,可以非常完美地导入到此博客中,分类、标签、评论都能完美迁移。
38+
39+
1. 安装 多说 插件来转移评论。
40+
2. 安装 WP Slug 插件并批量编辑更新文章,以便生成英文的固定链接。
41+
3. 可以使用 exitwp 导入文章。
42+
4. 用文本编辑器批量替换所有导出文章中的 **wordpress_id:****thread:**,以便关联文章和多说评论。
43+
5. 如果以前的 WordPress 固定链接是 **/post/123** 这种格式,迁移后链接依然能正常工作(实际上是 404 页面做了转跳处理)。
44+
45+
迁移需要在本地座比较多的准备工作,详细步骤略过,请仔细操作。
46+
47+
## 使用
48+
49+
* 点击 Powered by 里面的 **Po** 撰写新文章;点击 **ed** 编辑当前页面。
50+
* 虽然可以用在线的编辑器来编辑和发布文章,但为了批量修改方便,还是推荐 Check Out 后修改。
51+
52+
Yonsm
53+
54+
2013-07-17

Rakefile

+309
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,309 @@
1+
require "rubygems"
2+
require 'rake'
3+
require 'yaml'
4+
require 'time'
5+
6+
SOURCE = "."
7+
CONFIG = {
8+
'version' => "0.2.13",
9+
'themes' => File.join(SOURCE, "_includes", "themes"),
10+
'layouts' => File.join(SOURCE, "_layouts"),
11+
'posts' => File.join(SOURCE, "_posts"),
12+
'post_ext' => "md",
13+
'theme_package_version' => "0.1.0"
14+
}
15+
16+
# Path configuration helper
17+
module JB
18+
class Path
19+
SOURCE = "."
20+
Paths = {
21+
:layouts => "_layouts",
22+
:themes => "_includes/themes",
23+
:theme_assets => "assets/themes",
24+
:theme_packages => "_theme_packages",
25+
:posts => "_posts"
26+
}
27+
28+
def self.base
29+
SOURCE
30+
end
31+
32+
# build a path relative to configured path settings.
33+
def self.build(path, opts = {})
34+
opts[:root] ||= SOURCE
35+
path = "#{opts[:root]}/#{Paths[path.to_sym]}/#{opts[:node]}".split("/")
36+
path.compact!
37+
File.__send__ :join, path
38+
end
39+
40+
end #Path
41+
end #JB
42+
43+
# Usage: rake post title="A Title" [date="2012-02-09"]
44+
desc "Begin a new post in #{CONFIG['posts']}"
45+
task :post do
46+
abort("rake aborted: '#{CONFIG['posts']}' directory not found.") unless FileTest.directory?(CONFIG['posts'])
47+
title = ENV["title"] || "new-post"
48+
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
49+
begin
50+
date = (ENV['date'] ? Time.parse(ENV['date']) : Time.now).strftime('%Y-%m-%d')
51+
rescue Exception => e
52+
puts "Error - date format must be YYYY-MM-DD, please check you typed it correctly!"
53+
exit -1
54+
end
55+
filename = File.join(CONFIG['posts'], "#{date}-#{slug}.#{CONFIG['post_ext']}")
56+
if File.exist?(filename)
57+
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
58+
end
59+
60+
puts "Creating new post: #{filename}"
61+
open(filename, 'w') do |post|
62+
post.puts "---"
63+
post.puts "layout: post"
64+
post.puts "title: \"#{title.gsub(/-/,' ')}\""
65+
post.puts "categories:"
66+
post.puts "- "
67+
post.puts "tags:"
68+
post.puts "- "
69+
post.puts ""
70+
post.puts ""
71+
post.puts "---"
72+
end
73+
end # task :post
74+
75+
# Usage: rake page name="about.html"
76+
# You can also specify a sub-directory path.
77+
# If you don't specify a file extention we create an index.html at the path specified
78+
desc "Create a new page."
79+
task :page do
80+
name = ENV["name"] || "new-page.md"
81+
filename = File.join(SOURCE, "#{name}")
82+
filename = File.join(filename, "index.html") if File.extname(filename) == ""
83+
title = File.basename(filename, File.extname(filename)).gsub(/[\W\_]/, " ").gsub(/\b\w/){$&.upcase}
84+
if File.exist?(filename)
85+
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
86+
end
87+
88+
mkdir_p File.dirname(filename)
89+
puts "Creating new page: #{filename}"
90+
open(filename, 'w') do |post|
91+
post.puts "---"
92+
post.puts "layout: page"
93+
post.puts "title: \"#{title}\""
94+
post.puts 'description: ""'
95+
post.puts "---"
96+
end
97+
end # task :page
98+
99+
desc "Launch preview environment"
100+
task :preview do
101+
system "jekyll --auto --server"
102+
end # task :preview
103+
104+
# Public: Alias - Maintains backwards compatability for theme switching.
105+
task :switch_theme => "theme:switch"
106+
107+
namespace :theme do
108+
109+
# Public: Switch from one theme to another for your blog.
110+
#
111+
# name - String, Required. name of the theme you want to switch to.
112+
# The the theme must be installed into your JB framework.
113+
#
114+
# Examples
115+
#
116+
# rake theme:switch name="the-program"
117+
#
118+
# Returns Success/failure messages.
119+
desc "Switch between Jekyll-bootstrap themes."
120+
task :switch do
121+
theme_name = ENV["name"].to_s
122+
theme_path = File.join(CONFIG['themes'], theme_name)
123+
settings_file = File.join(theme_path, "settings.yml")
124+
non_layout_files = ["settings.yml"]
125+
126+
abort("rake aborted: name cannot be blank") if theme_name.empty?
127+
abort("rake aborted: '#{theme_path}' directory not found.") unless FileTest.directory?(theme_path)
128+
abort("rake aborted: '#{CONFIG['layouts']}' directory not found.") unless FileTest.directory?(CONFIG['layouts'])
129+
130+
Dir.glob("#{theme_path}/*") do |filename|
131+
next if non_layout_files.include?(File.basename(filename).downcase)
132+
puts "Generating '#{theme_name}' layout: #{File.basename(filename)}"
133+
134+
open(File.join(CONFIG['layouts'], File.basename(filename)), 'w') do |page|
135+
if File.basename(filename, ".html").downcase == "default"
136+
page.puts "---"
137+
page.puts File.read(settings_file) if File.exist?(settings_file)
138+
page.puts "---"
139+
else
140+
page.puts "---"
141+
page.puts "layout: default"
142+
page.puts "---"
143+
end
144+
page.puts "{% include JB/setup %}"
145+
page.puts "{% include themes/#{theme_name}/#{File.basename(filename)} %}"
146+
end
147+
end
148+
149+
puts "=> Theme successfully switched!"
150+
puts "=> Reload your web-page to check it out =)"
151+
end # task :switch
152+
153+
# Public: Install a theme using the theme packager.
154+
# Version 0.1.0 simple 1:1 file matching.
155+
#
156+
# git - String, Optional path to the git repository of the theme to be installed.
157+
# name - String, Optional name of the theme you want to install.
158+
# Passing name requires that the theme package already exist.
159+
#
160+
# Examples
161+
#
162+
# rake theme:install git="https://github.com/jekyllbootstrap/theme-twitter.git"
163+
# rake theme:install name="cool-theme"
164+
#
165+
# Returns Success/failure messages.
166+
desc "Install theme"
167+
task :install do
168+
if ENV["git"]
169+
manifest = theme_from_git_url(ENV["git"])
170+
name = manifest["name"]
171+
else
172+
name = ENV["name"].to_s.downcase
173+
end
174+
175+
packaged_theme_path = JB::Path.build(:theme_packages, :node => name)
176+
177+
abort("rake aborted!
178+
=> ERROR: 'name' cannot be blank") if name.empty?
179+
abort("rake aborted!
180+
=> ERROR: '#{packaged_theme_path}' directory not found.
181+
=> Installable themes can be added via git. You can find some here: http://github.com/jekyllbootstrap
182+
=> To download+install run: `rake theme:install git='[PUBLIC-CLONE-URL]'`
183+
=> example : rake theme:install git='[email protected]:jekyllbootstrap/theme-the-program.git'
184+
") unless FileTest.directory?(packaged_theme_path)
185+
186+
manifest = verify_manifest(packaged_theme_path)
187+
188+
# Get relative paths to packaged theme files
189+
# Exclude directories as they'll be recursively created. Exclude meta-data files.
190+
packaged_theme_files = []
191+
FileUtils.cd(packaged_theme_path) {
192+
Dir.glob("**/*.*") { |f|
193+
next if ( FileTest.directory?(f) || f =~ /^(manifest|readme|packager)/i )
194+
packaged_theme_files << f
195+
}
196+
}
197+
198+
# Mirror each file into the framework making sure to prompt if already exists.
199+
packaged_theme_files.each do |filename|
200+
file_install_path = File.join(JB::Path.base, filename)
201+
if File.exist? file_install_path
202+
next if ask("#{file_install_path} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
203+
else
204+
mkdir_p File.dirname(file_install_path)
205+
cp_r File.join(packaged_theme_path, filename), file_install_path
206+
end
207+
end
208+
209+
puts "=> #{name} theme has been installed!"
210+
puts "=> ---"
211+
if ask("=> Want to switch themes now?", ['y', 'n']) == 'y'
212+
system("rake switch_theme name='#{name}'")
213+
end
214+
end
215+
216+
# Public: Package a theme using the theme packager.
217+
# The theme must be structured using valid JB API.
218+
# In other words packaging is essentially the reverse of installing.
219+
#
220+
# name - String, Required name of the theme you want to package.
221+
#
222+
# Examples
223+
#
224+
# rake theme:package name="twitter"
225+
#
226+
# Returns Success/failure messages.
227+
desc "Package theme"
228+
task :package do
229+
name = ENV["name"].to_s.downcase
230+
theme_path = JB::Path.build(:themes, :node => name)
231+
asset_path = JB::Path.build(:theme_assets, :node => name)
232+
233+
abort("rake aborted: name cannot be blank") if name.empty?
234+
abort("rake aborted: '#{theme_path}' directory not found.") unless FileTest.directory?(theme_path)
235+
abort("rake aborted: '#{asset_path}' directory not found.") unless FileTest.directory?(asset_path)
236+
237+
## Mirror theme's template directory (_includes)
238+
packaged_theme_path = JB::Path.build(:themes, :root => JB::Path.build(:theme_packages, :node => name))
239+
mkdir_p packaged_theme_path
240+
cp_r theme_path, packaged_theme_path
241+
242+
## Mirror theme's asset directory
243+
packaged_theme_assets_path = JB::Path.build(:theme_assets, :root => JB::Path.build(:theme_packages, :node => name))
244+
mkdir_p packaged_theme_assets_path
245+
cp_r asset_path, packaged_theme_assets_path
246+
247+
## Log packager version
248+
packager = {"packager" => {"version" => CONFIG["theme_package_version"].to_s } }
249+
open(JB::Path.build(:theme_packages, :node => "#{name}/packager.yml"), "w") do |page|
250+
page.puts packager.to_yaml
251+
end
252+
253+
puts "=> '#{name}' theme is packaged and available at: #{JB::Path.build(:theme_packages, :node => name)}"
254+
end
255+
256+
end # end namespace :theme
257+
258+
# Internal: Download and process a theme from a git url.
259+
# Notice we don't know the name of the theme until we look it up in the manifest.
260+
# So we'll have to change the folder name once we get the name.
261+
#
262+
# url - String, Required url to git repository.
263+
#
264+
# Returns theme manifest hash
265+
def theme_from_git_url(url)
266+
tmp_path = JB::Path.build(:theme_packages, :node => "_tmp")
267+
abort("rake aborted: system call to git clone failed") if !system("git clone #{url} #{tmp_path}")
268+
manifest = verify_manifest(tmp_path)
269+
new_path = JB::Path.build(:theme_packages, :node => manifest["name"])
270+
if File.exist?(new_path) && ask("=> #{new_path} theme package already exists. Override?", ['y', 'n']) == 'n'
271+
remove_dir(tmp_path)
272+
abort("rake aborted: '#{manifest["name"]}' already exists as theme package.")
273+
end
274+
275+
remove_dir(new_path) if File.exist?(new_path)
276+
mv(tmp_path, new_path)
277+
manifest
278+
end
279+
280+
# Internal: Process theme package manifest file.
281+
#
282+
# theme_path - String, Required. File path to theme package.
283+
#
284+
# Returns theme manifest hash
285+
def verify_manifest(theme_path)
286+
manifest_path = File.join(theme_path, "manifest.yml")
287+
manifest_file = File.open( manifest_path )
288+
abort("rake aborted: repo must contain valid manifest.yml") unless File.exist? manifest_file
289+
manifest = YAML.load( manifest_file )
290+
manifest_file.close
291+
manifest
292+
end
293+
294+
def ask(message, valid_options)
295+
if valid_options
296+
answer = get_stdin("#{message} #{valid_options.to_s.gsub(/"/, '').gsub(/, /,'/')} ") while !valid_options.include?(answer)
297+
else
298+
answer = get_stdin(message)
299+
end
300+
answer
301+
end
302+
303+
def get_stdin(message)
304+
print message
305+
STDIN.gets.chomp
306+
end
307+
308+
#Load custom rake scripts
309+
Dir['_rake/*.rake'].each { |r| load r }

0 commit comments

Comments
 (0)