Giter Site home page Giter Site logo

nico-arale's Introduction

Theme for Arale Documentation

CMD 模块可统一使用 nico-cmd 作为主题,本仓库不再维护。

这是一个为 aralejs.org 文档设计的 nico 主题。

安装

1. 安装 node

请自己安装 node。

2. 安装 nico

参考 http://lab.lepture.com/nico/zh/

另外,如果你安装了 socket.io 的话,将有 livereload 功能。

$ npm install socket.io -g

3. 安装 arale theme

Linux & Mac 用户一键安装:

curl https://raw.github.com/aralejs/nico-arale/master/bootstrap.sh | sh

Windows 用户安装:

1.切换到.spm目录

2.创建一个themes的目录并切换进入

3.从git上拉一份arale的theme

4.重命名nico-arale目录为arale

5.切换到arale目录,把里面的make.bat文件复制到一个全局PATH下(保证make命令可用即可)

P.S. 注意千万别把C:\Users\{{username}}\.spm\themes\arale目录设置为全局PATH,这样nico命令会失效,切记!

cd C:\Users\{{username}}\.spm

mkdir themes
cd themes

git clone https://github.com/aralejs/nico-arale.git

rename nico-arale arale

cd arale

使用说明

复制一份 Makefile 到你的项目下:

Windows 用户可使用 make.bat

  • make build-doc 用于生成文档。

  • make debug 是开启本地服务器,可用来预览文档,并提供自动构建和 live reload 支持。(从本地 sea-modules 中加载依赖)

  • make watch 是开启本地服务器,可用来预览文档,并提供自动构建和 live reload 支持。 (从线上加载依赖)

  • make server 普通服务器,无自动刷新功能。

  • make publish 发布站点到 gh pages,你需要安装 ghp-import

    sudo easy_install -U ghp-import
    

Windows 用户注意,如果报错,说找不到 nico,请设置环境变量 NODE_PATH。 请根据实际情况自行解决,一般来说应该设置为:

NODE_PATH = C:\Users\{{username}}\AppData\Roaming\npm\node_modules

文档编辑

nico 还会用到模块根目录下的 package.json 文件,具体项的含义请参考:spm package.json

其中 repository.url 用来生成 View the Project 链接, bugs.url 用来生成讨论链接。

特有功能

用三个 ` 会高亮显示代码

```js
function something() {
}
```

用四个 ` 会高亮显示代码,还会将代码插入到生成的 HTML 页面中

````js
function something() {
}
````

插入 iframe

````iframe
<link rel="stylesheet" href="css/some.css">
<button>click</button>
<script>
    seajs.use('jquery', function($) {
        $('button').click(function() { alert('hello'); })
    });
</script>
````

还可以设置 iframe 的高度

````iframe:400
````

生成 iframe 的模板是 templates/iframe.html,不用写头写尾。

输出

假设模块的目录结构为:

package.json
Makefile
src/
    hello-world.js
examples/
    hello-world.md
docs/
    hello-world.md
README.md

执行 make build-doc 后会生成:

package.json
Makefile
_site/
    index.html
    src/
        hello-world.js
    examples/
        hello-world.html
    docs/
        hello-world.html
src/
    hello-world.js
examples/
    hello-world.md
docs/
    hello-world.md
README.md

所有生成的文件都在 _site 目录下。

测试

nico-arale's People

Contributors

afc163 avatar hotoo avatar lepture avatar lifesinger avatar lizzie avatar popomore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nico-arale's Issues

mac环境下,make debug 报错 ,显示Cannot find module 'nico/lib/utils/urilib',请问如何处理呢

bash-3.2# make debug
nico: 0.3.0a3
load: ../../.spm/themes/arale/nico.js

module.js:340
throw err;
^
Error: Cannot find module 'nico/lib/utils/urilib'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/Users/swind/.spm/themes/arale/nico.js:6:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)

nico如何禁用缓存

make watch浏览器可以自动刷新,但是改动没有应用,貌似是.cache的问题。
现在每次都是

rm .cache/ -rf
make server

挺麻烦的。
求教如何不使用cache

nico帮助中只有选项设置cache目录,貌似没有禁用选项

注意:自动关联 HISTORY.md 中的 issues 链接

我简单添加了一个自动关联 #issues 链接的功能,会将 HISTORY.md 中 #1 这样的文本自动转换成对应 issues 链接。但这个会影响之前直接在 HISTORY 中写 [#1](package.bugs.url+issuesId) 这样的链接。

watch 不稳定

make watch 同时再 spm build

fs.js:524
  return binding.stat(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory '/Users/popomore/code/arale/widget/.build/dist/widget-debug.js'
    at Object.fs.statSync (fs.js:524:18)
    at Object.file.stat (/Users/popomore/nvm/v0.8.20/lib/node_modules/nico/lib/sdk/file.js:138:13)
    at Object.file.copy (/Users/popomore/nvm/v0.8.20/lib/node_modules/nico/lib/sdk/file.js:119:12)
    at FileWriter.run (/Users/popomore/nvm/v0.8.20/lib/node_modules/nico/lib/writers/core.js:111:10)
    at Array.forEach (native)
    at FileWriter.run (/Users/popomore/nvm/v0.8.20/lib/node_modules/nico/lib/writers/core.js:108:22)
    at FileWriter.BaseWriter.process (/Users/popomore/nvm/v0.8.20/lib/node_modules/nico/lib/writers/base.js:31:20)
    at /Users/popomore/nvm/v0.8.20/lib/node_modules/nico/lib/build.js:43:28
    at Array.forEach (native)
    at module.exports (/Users/popomore/nvm/v0.8.20/lib/node_modules/nico/lib/build.js:42:11)

这个也出现过 spmjs/spm2#31

可能是之前生成时监听了,之后又没了

需求:多个 runner 的支持

现在在 test 目录下写多个 *-spec.md 文件,最终会被自动合并到同一个 runner.html 中。
这对于需要多个独立的 runner (各 runner 相互间场景独立不干扰)就无法达成。
对于开发者来说,写多个 spce 文件的目标,更多的应该还是希望生成多个 runner,
现在的合并方案其实差不多跟多个 describe 相同。

所以我建议不同的 spec 文件,生成不同的 runner 文件。
至于 totoro 方面也应有对应的多 runner 自动化支持。

没有.spm目录该怎么破?

cd C:\Users{{username}}.spm

进行到这一步的时候发现C:\Users{{username}}\下是没有.spm目录的。
确定已经从git上安装了spm -g,查了一下路径发现spm是放在npm\node_module\spm这里的,是不是我弄错了什么。求大神指教。

.travis.yml 中jscoverage和coveralls在执行时报错 [nico-cmd 连issue都没开]


/home/travis/build/airyland/seedit.GA-event-tracker/node_modules/jscoverage/bin/jscoverage:50
      exclude.forEach(function (v) {
              ^
TypeError: Cannot call method 'forEach' of undefined
    at help (/home/travis/build/airyland/seedit.GA-event-tracker/node_modules/jscoverage/bin/jscoverage:50:15)
    at /home/travis/build/airyland/seedit.GA-event-tracker/node_modules/jscoverage/node_modules/xfs/lib/async.js:222:9
    at Object.oncomplete (fs.js:107:15)

[warn] "2014-04-14T02:51:08.724Z"  'Repo token could not be determined.  Continuing without it.'
[error] "2014-04-14T02:51:08.751Z"  'error from lcovParse: ' 'Failed to parse string'
[error] "2014-04-14T02:51:08.751Z"  'input: ' ''
[error] "2014-04-14T02:51:08.751Z"  'error from convertLcovToCoveralls'

spm watch 失败

[hotoo@mbp monitor.js]$make watch

           nico: 0.4.1
           load: ../../../.spm/themes/arale/nico.js
           load: PageWriter
           load: StaticWriter
           load: FileWriter
           load: fail to load nico.MochaWriter
            run: PageWriter
          write: 12 pages

/usr/local/lib/node_modules/nico/node_modules/swig/lib/swig.js:169
      throw excp;
            ^
Error: ENOENT, no such file or directory '/Users/hotoo/.spm/themes/arale/templates/page.html'
    at Object.fs.openSync (fs.js:427:18)
    at Object.fs.readFileSync (fs.js:284:15)
    at getSingle (/usr/local/lib/node_modules/nico/node_modules/swig/lib/swig.js:152:19)
    at get (/usr/local/lib/node_modules/nico/node_modules/swig/lib/swig.js:164:9)
    at Object.exports.compileFile (/usr/local/lib/node_modules/nico/node_modules/swig/lib/swig.js:174:5)
    at Object.exports.render (/usr/local/lib/node_modules/nico/lib/engines/swig.js:32:18)
    at PageWriter.BaseWriter.render (/usr/local/lib/node_modules/nico/lib/writers/base.js:57:21)
    at PageWriter._create (/usr/local/lib/node_modules/nico/lib/writers/core.js:94:8)
    at /usr/local/lib/node_modules/nico/lib/writers/core.js:111:10
    at Array.forEach (native)

解析 IE 缓存下 document.body 读取问题

原始问题: totorojs/browsers#31

分析后,发现原因是:

在 IE10 有缓存情况下,原来的 runner.html 中,所有 dialog / overlay / widget 的初始化、实例化都是在 head 中就完成的,这时 document.body 还不存在,导致 render 时,默认的 parentNode 是 null,因此压根儿就没有插入到文档流中。

解决办法:

runner.html 中,相关代码移动到 body 后面。

mac下安装出错

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1236  100  1236    0     0    695      0  0:00:01  0:00:01 --:--:--  1063
install nico
npm http GET https://registry.npmjs.org/nico
npm http 304 https://registry.npmjs.org/nico
npm http GET https://registry.npmjs.org/colorful
npm http GET https://registry.npmjs.org/arale
npm http GET https://registry.npmjs.org/highlight.js
npm http GET https://registry.npmjs.org/moment
npm http GET https://registry.npmjs.org/jinja
npm http GET https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/robotskirt
npm http GET https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/arale
npm http 304 https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/highlight.js
npm http 304 https://registry.npmjs.org/robotskirt
npm WARN package.json [email protected] No README.md file found!
npm http 304 https://registry.npmjs.org/moment
npm http 304 https://registry.npmjs.org/jinja
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/colorful
npm http GET https://registry.npmjs.org/keypress

> [email protected] install /usr/local/lib/node_modules/nico/node_modules/robotskirt
> node-gyp rebuild

  CC(target) Release/obj.target/sundown/src/autolink.o
mkdir: Release/obj.target/sundown/src/: Permission denied
mkdir: ./Release/.deps/Release/obj.target/sundown/src/: Permission denied
make: *** [Release/obj.target/sundown/src/autolink.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:215:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack     at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Darwin 12.2.1
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/nico/node_modules/robotskirt
gyp ERR! node -v v0.8.16
gyp ERR! node-gyp -v v0.6.3
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the robotskirt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls robotskirt
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.2.1
npm ERR! command "node" "/usr/local/bin/npm" "install" "nico" "-g"
npm ERR! cwd /Users/liusiemen
npm ERR! node -v v0.8.16
npm ERR! npm -v 1.1.48
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/keypress
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/liusiemen/npm-debug.log
npm ERR! not ok code 0
update nico arale theme
error: cannot open .git/FETCH_HEAD: Permission denied

you have installed jscoverage
you have installed jade
you have installed mocha
you have installed mocha-phantomjs

使用的是这行命令

curl https://raw.github.com/aralejs/nico-arale/master/bootstrap.sh | sh

项目为静态文件,请问可否直接用nico build指令生成?

目前只是想先将arale主题正确调用下看效果,却对Makefile不熟悉,不知道如何按教程上说的处理。
于是想能否直接修改nico.json文件,再用build指令生成。

{
"source": "content",
"output": "_site",
"theme": "$(HOME)/.spm/themes/arale",
"permalink": "{{directory}}/{{filename}}.html",
"writers": [
"nico.PostWriter",
"nico.FileWriter",
"nico.StaticWriter"
]
}

返回的结果貌似告诉我找不到该主题

template: no templates available

请问theme路径该如何编写?(Mac系统)

把 keywords:widget 的判断去掉

现在是否加载 plugin-text 是判断 keywords 里有没有 widget,这个不太人性化,而且两者并没有必然的联系,经常被人咨询这个问题。

加的原因是 @lepture 之前遇到了某个问题,请回复提供。

可以先去掉,如果那个问题出现再用其他方式解决。

请教如何判断处于debug模式

之前的版本可以判断是否是debug模式

{%- if config.args|debug %}
    <script src="../sea-modules/seajs/1.3.0/sea.js"></script>
{%- else %}
    <script src="http://static.alipayobjects.com/seajs/1.3.1/sea.js"></script>
{%- endif %}

现在好像不能使用了?请指教。
版本为:nico 0.3.1

建议 HISTROY.md 中使用列表

现在的 HISTORY.md 中使用段落来书写各个修改项的描述,但是我觉得使用列表更符合语义。

* `tag:new` #2, descriptions.
* `tag:fixed` #1, desc...

linux下无法使用nico

如题,已经设置了NODE_PATH, PATH,通过Makefile运行报错

image

还是无法找到nico模块,还需要如何设置??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.