var multimatch=require('mulimatch'),
config = options.config;
var pattern ='grunt-*';
multimatch(config['dependencies'],patterns).forEach(grunt.loadNpmTasks);
<%
var title = page.title;
if (is_archive()){
title ='Archives';
if (is_month()){
title +=': ' + page.year +'/' + page.month;
}elseif (is_year()){
title +=': ' + page.year;
}
}elseif (is_category()){
title ='Category: ' + page.category;
}elseif (is_tag()){
title ='Tag: ' + page.tag;
}
%>
<title><% if (title){ %><%= title %> | <% } %><%= config.title %></title>
<%
var title = [];
if (page.current >1) title.push(__('page', page.current));
if (page.title) title.push(page.title);
if (page.category) title.push(page.category);
if (page.tag) title.push(page.tag);
if (page.archive){
if (page.year) title.push(__('archive_b', page.year + (page.month ?'/' + page.month :'')));
else title.push(__('archive_a'));
}
title.push(config.title);
%>
<title><%= title.join(' | ') %></title>
通过判断page.current来处理。所以我们在head.ejs中的代码修改为
<%
var title = page.title;
if (is_archive()){
title ='Archives';
if (is_month()){
title +=': ' + page.year +'/' + page.month;
}elseif (is_year()){
title +=': ' + page.year;
}
}elseif (is_category()){
title ='Category: ' + page.category;
}elseif (is_tag()){
title ='Tag: ' + page.tag;
}elseif(page.current >1){
title ='第'+page.current+'页';
}
%>
<title><% if (title){ %><%= title %> | <% } %><%= config.title %></title>
git init
git remote add web username@host:~/path/to/www
之后只需要用Hexo生成页面,然后本地git add .之后push就可以了。
receive.denyCurrentBranch问题
当然没有那么顺利,执行push以后报错
remote: error: refusing toupdate checked out branch: refs/heads/master
remote: error:Bydefault, updating thecurrent branchin a non-bare repository
remote: error:is denied, because it will make theindexandwork tree inconsistent
remote: error:with what you pushed,and will require'git reset --hard'tomatch
remote: error: thework treeto HEAD.
var assertNotHasOwnProperty =function(name, context) {
if (name ==='hasOwnProperty') {
throw ngMinErr('badname','hasOwnProperty is not a valid {0} name', context);
}
};
assertNotHasOwnProperty(name,'module');
其实就是判断名字是不是module ⊙﹏⊙b汗。
然后是判断是否提供了依赖声明,现有模块中是否已经有了,如果有了重置之。
if (requires && modules.hasOwnProperty(name)) {
modules[name] =null;
}
modules是该方法中的一个变量
var modules = {};
然后是判断是否声明了依赖,如果没有报错。当然如果你的模块不需要依赖其他的,使用[]即可。
if (!requires) {
throw $injectorMinErr('nomod',"Module '{0}' is not available! You either misspelled " +
"the module name or forgot to load it. If registering a module ensure that you " +
"specify the dependencies as the second argument.", name);
}
var version = {
full:'"NG_VERSION_FULL"',
major:"NG_VERSION_MAJOR",
minor:"NG_VERSION_MINOR",
dot:"NG_VERSION_DOT",
codeName:'"NG_VERSION_CODENAME"'
};
if (isString(element)) {
var div =document.createElement('div');
// Read about the NoScope elements here:
// http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx
div.innerHTML ='<div> </div>' + element;// IE insanity to make
NoScope elements work!
div.removeChild(div.firstChild);// remove the superfluous div
jqLiteAddNodes(this, div.childNodes);
var fragment = jqLite(document.createDocumentFragment());
fragment.append(this);// detach the elements from the temporary DOM div.
}else {
jqLiteAddNodes(this, element);
}