Simiki

Simiki

一個簡單的wiki框架

Simiki 是一个简单的 wiki 框架, 适合分类记录一些技术文档.

"Simiki" 名称的由来

Simki 是取 Simple Wiki 的前三个字母和后三个字母拼起来的.

依赖

安装

pip install simiki

更新

pip install -U simiki

初始化网站

mkdir mywiki && cd mywiki
simiki init

创建一个新的wiki

simiki new -t "Hello Simiki" -c first-category

产生

simiki generate

预览

simiki preview

Configuration

site

配置文件是_config.yml

选项描述

url

网站网址

title

网站标题

keywords

网站关键词

description

网站描述

author

现场笔者

root

如果你的网站是一个子目录,如http://example.com/wiki/,设置URL作为http://example.com/wiki/和根为/wiki/

source

保存源文件,只支持降价的文件至今。默认为content,你最好不要去改变它,除非必要的。

destination

存储输出的HTML文件。默认为output,你最好不要去改变它,除非必要

themes_dir
存储所有的主题。默认为主题,除非必要,你最好不要去改变它。

theme

选择主题,他的名字是相同的目录下,名称themes_dir,如主题:简单

default_ext

创建一个新的页面时默认的扩展,默认是MD

pygments

启用代码lighlight功能,默认情况下启用。

debug

调试模式,默认为禁用。

index

设置true用“index.md”源代码目录下,如索引页或设置任何维基文件,如“工具/ git.md”.DEFAULT是false,Simiki将自动生成目录的索引页。

初始内容

初始配置文件的内容如下:

url:网址
title: 标题
keywords:关键字
description:描述
author:作者

所有其他配置项使用默认值。

警告!

这只是一个例子,不要简单地复制并使用它!

一个配置文件的例子:

url: http://wiki.tankywoo.com
title: Wiki · Tanky Woo
keywords: wiki, makrdown, linux, python, cpp, ops, simiki
description: "Focus on Python, C/C++, Linux, Ops-Dev, Gentoo, and so on."
author: Tanky Woo

root: /
source: content
destination: output
themes_dir: themes
theme: yasimple

default_ext: "markdown"
pygments: true
debug: false
index: true

目录结构

初始Simiki网站看起来是这样的:

. 
├──  _config . yml 
├──  content 
├──  fabfile . py 
├──  output 
└──  themes 
    └──  simple

文件/目录描述

_config.yml

配置文件。看配置

content

存储源文件(content/linux/bash.md作为第二层次结构。注意:Simiki只支持顶级和第二级为止。

output

通过Simiki生成的HTML文件。建议加上此目录中.gitignore

themes

把主题在此目录中,每个主题是一个子目录。配置主题_config.yml

部署

Github上页

Github上的页面是部署你的网站最简单的方法。

阅读Github上网页文件的更多细节。

用户页面

创建用户页面

  1. 创建一个名为库<用户名> .github.io<用户名>是您的Github上的用户名。

  2. 到你的本地站点,设置输出目录中的主分支:

cd output
git init
git add .
git commit -m 'your comment'
# These steps will be shown when you create a repo in Github:
git remote add origin https://github.com/<username>/<username>.github.io.git
git push -u origin master
  1. 回到父目录,并触摸.gitignore文件:
cd ../
touch .gitignore
  1. 编辑.gitignore的内容:
*.pyc
output
  1. 安装源分支:
git init
git checkout -b source
git add .
git commit -m 'your comment'
# These steps will be shown when you create a repo in Github:
git remote add origin https://github.com/<username>/<username>.github.io.git
git push -u origin source

等待一段时间,访问HTTP:// <用户名> .github.io /

项目页面

与自定义域

  1. 创建与任何名称的库<项目>

  2. 到你的本地站点,设置输出目录中的主分支:

cd output
git init
git checkout -b gh-pages
# Write your domain in file named CNAME
echo "<yourdomain.com>" > CNAME
git add .
git commit -m 'your comment'
# These steps will be shown when you create a repo in Github:
git remote add origin git@github.com:<username>/<projectname>.git
git push -u origin gh-pages
  1. 回到父目录,并触摸的.gitignore文件:
cd ../
touch .gitignore
  1. 编辑的.gitignore的内容:
*.pyc
output
  1. 安装源分支:
git init
git add .
git commit -m 'your comment'
# These steps will be shown when you create a repo in Github:
git remote add origin git@github.com:<username>/<projectname>.git
git push -u origin master

稍等片刻,参观的http:// <yourdomain.com>

注意:

更多参考:

举个例子:

如果没有自定义域

该项目的网页网址是HTTP:// <用户名> .github.io / <项目>,所以你应该设置root在你的项目名_config.yml

root / < 项目名称>

别人是一样的Project Pages with Custom Doamin以上。

举个例子:

注意

如果被设置好的在_config.yml,你应该使用--ignore-root时,要在本地环境预览。并没有再生--ignore-root,当你准备部署到远程服务器。

simiki generate --ignore-root

自我管理的服务器

使用SCPrsync所有文件转移output目录到相应的Web根目录的Web服务器。

Simiki还支持Fabric传输文件。配置fabfile.py并使用晶圆厂部署进行部署。

FTP

上传的所有文件output通过FTP工具到你的服务器目录。

元数据

每个页面使用YAML格式的元数据,如:

--- 
布局: 网页
标题: “元数据” 
日期: 2014年- 05 - 14  00 :15 
---

支持元数据:

元描述

layout

指定布 ​​局文件,支持网页指数至今。

title

该页面的标题。

date

页面创建的日期时间。

代码高亮

使用Pygments生成语法的CSS:

得到的颜色主题名称:

pygmentize -L styles

生成CSS:

pygmentize -f html -S [colortheme name] -a .hlcode > syntax.css

最简单的方法是使用缩进代码块

1
2
3
4
5
#!/usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    print("Hello World!")

或用围栏代码块

PHP额外的语法:

```

1
2
3
4
5
#!/usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    print("Hello World!")
定义的语言:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    print("Hello World!")

!/usr/bin/env python

-- coding: utf-8 --

if name == "main":
print("Hello World!")

或:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    print("Hello World!")

!/usr/bin/env python

-- coding: utf-8 --

if name == "main":
print("Hello World!")

Github上围栏代码块:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    print("Hello World!")

!/usr/bin/env python

-- coding: utf-8 --

if name == "main":
print("Hello World!")

突出一些线路:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    print("Hello World!")
或:
import sys

if __name__ == __main__:
    sys.exit()

import sys

if name == main:
sys.exit()

更详细的使用可以看出,在[Python的降价](https://pythonhosted.org/Markdown/)文件:

  * [围栏代码块](https://pythonhosted.org/Markdown/extensions/fenced_code_blocks.html)
  * [CodeHilite](https://pythonhosted.org/Markdown/extensions/code_hilite.html)


 # 变量

## 站点变量

`site`:从配置`_config.yml`。详细描述中[Configuration](http://simiki.org/docs/configuration.html)

  * `site.url`
  * `site.title`
  * `site.keyword`
  * `site.description`
  * `site.author`
  * `site.root`
  * `site.source`
  * `site.destination`
  * `site.themes_dir`
  * `site.theme`
  * `site.default_ext`
  * `site.pygments`
  * `site.debug`
  * `site.index`

## 页面变量

`page`:从单一的wiki页面的页眉YAML配置。详细描述中[Metadata](http://simiki.org/docs/metadata.html)

  * `page.title`
  * `page.category`
  * `page.date`
  * `page.content`
  * `page.filename`


# 主题

Simiki主题使用[Jinja2](http://jinja.pocoo.org/),一个全功能的模板引擎为Python。

一个简单的主题应具备`index.html`和`page.html`,`index.html`用于索引页的目录,`page.html`用于每个wiki页面。


# 常问问题

## 常问问题

### 使用Simiki在Windows

Simiki不是Windows很好的支持。如果可能的话,使用它在Unix / Linux/ Mac的。

Windows下,你应该安装[`pycrypto`](http://www.voidspace.org.uk/python/modules.shtml#pycrypto)(用于[`fabfile`](http://www.fabfile.org/),也许在以后的版本中删除):

easy_install http://www.voidspace.org.uk/downloads/pycrypto26/pycrypto-2.6.win32-py2.7.exe

and ecsda:

pip install ecsda
```