├── .gitignore ├── Makefile ├── README.md ├── _plugins ├── __init__.py ├── data_uri.py ├── extract_toc │ ├── README.md │ ├── __init__.py │ └── extract_toc.py ├── glider-small.png ├── glider-small.png.base64 ├── gzip_cache │ ├── Readme.rst │ ├── __init__.py │ ├── gzip_cache.py │ └── test_gzip_cache.py ├── hacker.png ├── hacker.png.base64 └── sitemap │ ├── Readme.rst │ ├── __init__.py │ └── sitemap.py ├── _themes └── pelican-bootstrap3 │ ├── LICENSE │ ├── README.md │ ├── screenshot-article.png │ ├── screenshot.png │ ├── static │ ├── PyChina_logo_131217_zq_h60.png │ ├── css │ │ ├── bootstrap-glyphicons.css │ │ ├── bootstrap.amelia.min.css │ │ ├── bootstrap.cerulean.min.css │ │ ├── bootstrap.cosmo.min.css │ │ ├── bootstrap.cyborg.min.css │ │ ├── bootstrap.flatly.min.css │ │ ├── bootstrap.journal.min.css │ │ ├── bootstrap.min.css │ │ ├── bootstrap.readable.min.css │ │ ├── bootstrap.simplex.min.css │ │ ├── bootstrap.slate.min.css │ │ ├── bootstrap.spacelab.min.css │ │ ├── bootstrap.united.min.css │ │ ├── font-awesome.min.css │ │ ├── pygments.css │ │ ├── pygments │ │ │ ├── README.rst │ │ │ ├── autumn.css │ │ │ ├── borland.css │ │ │ ├── bw.css │ │ │ ├── colorful.css │ │ │ ├── default.css │ │ │ ├── emacs.css │ │ │ ├── friendly.css │ │ │ ├── fruity.css │ │ │ ├── github.css │ │ │ ├── manni.css │ │ │ ├── monokai.css │ │ │ ├── murphy.css │ │ │ ├── native.css │ │ │ ├── pastie.css │ │ │ ├── perldoc.css │ │ │ ├── tango.css │ │ │ ├── trac.css │ │ │ ├── vim.css │ │ │ ├── vs.css │ │ │ └── zenburn.css │ │ └── style.css │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ └── js │ │ ├── bootstrap.min.js │ │ ├── github.js │ │ ├── jXHR.js │ │ └── respond.min.js │ └── templates │ ├── 404.html │ ├── archives.html │ ├── article.html │ ├── author.html │ ├── authors.html │ ├── base.html │ ├── categories.html │ ├── category.html │ ├── includes │ ├── addthis.html │ ├── announce.html │ ├── article_info.html │ ├── comment_count.html │ ├── comments.html │ ├── disqus_script.html │ ├── ga.html │ ├── github.html │ ├── links.html │ ├── page_comments.html │ ├── powerded.html │ ├── sidebar.html │ ├── taglist.html │ ├── translations.html │ └── utteranc_script.html │ ├── index.html │ ├── page.html │ ├── tag.html │ └── tags.html ├── content ├── IMHO │ ├── 140916-pycon-slogen.md │ └── 2014-09-18-cooperate-guider.md ├── Volunteer │ ├── sting.md │ └── zoomquiet.md ├── _extra │ ├── .nojekyll │ ├── CNAME │ ├── LICENSE │ ├── README.md │ ├── favicon.ico │ └── robots.txt ├── _images │ └── PyChina_logo_131217_zq_h200.png ├── events │ ├── 2013-12-08-et16-pycon-zh.md │ ├── 2014-11-18-et-pycon-zh.md │ ├── 2014-11-25-et-pycon-bj.md │ ├── 2015-07-14-et-pycon-proposals.md │ ├── 2017-09-11-et-pycon-proposals.md │ ├── 2019-09-14-et-pycon-zh.md │ └── 2019-10-26-et-pycon-nn.md ├── handbook │ └── cafe2hub.md └── pages │ └── about.md ├── develop_server.sh ├── fabfile.py ├── pelicanconf.py ├── publishconf.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | output/ 2 | output 3 | 4 | cache/ 5 | .ropeproject 6 | 7 | *.pyc 8 | .python-version 9 | local_settings.ini 10 | .DS_Store 11 | bin/ 12 | include/ 13 | lib/ 14 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PY=python 2 | PELICAN=pelican 3 | PELICANOPTS= 4 | 5 | BASEDIR=$(CURDIR) 6 | INPUTDIR=$(BASEDIR)/content 7 | OUTPUTDIR=$(BASEDIR)/output 8 | CONFFILE=$(BASEDIR)/pelicanconf.py 9 | PUBLISHCONF=$(BASEDIR)/publishconf.py 10 | 11 | FTP_HOST=localhost 12 | FTP_USER=anonymous 13 | FTP_TARGET_DIR=/ 14 | 15 | SSH_HOST=localhost 16 | SSH_PORT=22 17 | SSH_USER=root 18 | SSH_TARGET_DIR=/var/www 19 | 20 | S3_BUCKET=my_s3_bucket 21 | 22 | CLOUDFILES_USERNAME=my_rackspace_username 23 | CLOUDFILES_API_KEY=my_rackspace_api_key 24 | CLOUDFILES_CONTAINER=my_cloudfiles_container 25 | 26 | DROPBOX_DIR=~/Dropbox/Public/ 27 | 28 | DEBUG ?= 0 29 | ifeq ($(DEBUG), 1) 30 | PELICANOPTS += -D 31 | endif 32 | 33 | help: 34 | @echo 'Makefile for a pelican Web site ' 35 | @echo ' ' 36 | @echo 'Usage: ' 37 | @echo ' make html (re)generate the web site ' 38 | @echo ' make clean remove the generated files ' 39 | @echo ' make regenerate regenerate files upon modification ' 40 | @echo ' make publish generate using production settings ' 41 | @echo ' make serve [PORT=8000] serve site at http://localhost:8000' 42 | @echo ' make devserver [PORT=8000] start/restart develop_server.sh ' 43 | @echo ' make stopserver stop local server ' 44 | @echo ' make ssh_upload upload the web site via SSH ' 45 | @echo ' make rsync_upload upload the web site via rsync+ssh ' 46 | @echo ' make dropbox_upload upload the web site via Dropbox ' 47 | @echo ' make ftp_upload upload the web site via FTP ' 48 | @echo ' make s3_upload upload the web site via S3 ' 49 | @echo ' make cf_upload upload the web site via Cloud Files' 50 | @echo ' make github upload the web site via gh-pages ' 51 | @echo ' ' 52 | @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html' 53 | @echo ' ' 54 | 55 | html: 56 | $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) 57 | 58 | clean: 59 | [ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR) 60 | 61 | regenerate: 62 | $(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) 63 | 64 | serve: 65 | ifdef PORT 66 | cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT) 67 | else 68 | cd $(OUTPUTDIR) && $(PY) -m pelican.server 69 | endif 70 | 71 | devserver: 72 | ifdef PORT 73 | $(BASEDIR)/develop_server.sh restart $(PORT) 74 | else 75 | $(BASEDIR)/develop_server.sh restart 76 | endif 77 | 78 | stopserver: 79 | kill -9 `cat pelican.pid` 80 | kill -9 `cat srv.pid` 81 | @echo 'Stopped Pelican and SimpleHTTPServer processes running in background.' 82 | 83 | publish: 84 | $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS) 85 | 86 | ssh_upload: publish 87 | scp -P $(SSH_PORT) -r $(OUTPUTDIR)/* $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) 88 | 89 | rsync_upload: publish 90 | rsync -e "ssh -p $(SSH_PORT)" -P -rvz --delete $(OUTPUTDIR)/ $(SSH_USER)@$(SSH_HOST):$(SSH_TARGET_DIR) --cvs-exclude 91 | 92 | dropbox_upload: publish 93 | cp -r $(OUTPUTDIR)/* $(DROPBOX_DIR) 94 | 95 | ftp_upload: publish 96 | lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit" 97 | 98 | s3_upload: publish 99 | s3cmd sync $(OUTPUTDIR)/ s3://$(S3_BUCKET) --acl-public --delete-removed 100 | 101 | cf_upload: publish 102 | cd $(OUTPUTDIR) && swift -v -A https://auth.api.rackspacecloud.com/v1.0 -U $(CLOUDFILES_USERNAME) -K $(CLOUDFILES_API_KEY) upload -c $(CLOUDFILES_CONTAINER) . 103 | 104 | github: publish 105 | ghp-import $(OUTPUTDIR) 106 | git push origin gh-pages 107 | 108 | .PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github 109 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PyChina.org 2 | 3 | in fact from 2003 there is CZUG.org ~ the 1st(and only one) focus Zope tech community be set up; 4 | 5 | so years ago, there is soooooooo many python tech abt. commuity in China 6 | 7 | but never group as one unify community brand, 8 | like as: perl-china/ruby-china etc. 9 | 10 | so after PyCon2013China, some `old` Chinese Pythonista together and building: 11 | 12 | ![](PyChina_logo_131217_zq_h200.png) 13 | 14 | ## goal 15 | 16 | - by Pythonner in China Operations 17 | - as Pythonner in China Deleloping 18 | - for Pythonista in Global support events organizing srvice 19 | 20 | 21 | ## organizer 22 | 23 | - Zoom.Quiet 24 | 25 | ## volunteer 26 | cnpycon-volunteer 27 | 28 | # usage 29 | How to update the site contents? 30 | 31 | as summary: 32 | 33 | - generating all pages in local by `Pelican` 34 | - usage `qrsync` push into pychina.qiniudn.com 35 | - finally Nginx+DNS publish as http://pychina.org/ 36 | 37 | depending: 38 | 39 | - Python 40 | - Pelican 41 | - git 42 | - fabric 43 | 44 | install: 45 | 46 | $ pip install -r requirements.txt 47 | 48 | 49 | ## flow 50 | > 配置好环境 51 | 52 | - 安装 fabric 1.0 53 | - 将本地目录按照这样部署: 54 | 55 | 56 | path/2/PyChina.org/blog༽ 57 | 58 | ༄ git br -a 59 | * master 60 | remotes/origin/HEAD -> origin/master 61 | remotes/origin/gh-pages 62 | remotes/origin/gitcafe-pages 63 | remotes/origin/master 64 | 65 | ༄ ll 66 | total 48 67 | -rw-r--r-- 1 zoomq staff 3758 8 7 2015 Makefile 68 | -rw-r--r-- 1 zoomq staff 4280 9 15 09:41 README.md 69 | ... 70 | lrwxr-xr-x 1 zoomq staff 12 8 23 21:59 output -> ../blog_ghp/ 71 | ... 72 | 73 | 74 | path/2/PyChina.org/blog_ghp༽ 75 | 76 | ༄ git br -a 77 | * gh-pages 78 | master 79 | remotes/origin/HEAD -> origin/master 80 | remotes/origin/gh-pages 81 | remotes/origin/master 82 | 83 | 然后, 想编译发布时: 84 | 85 | ༄ fab pub 86 | [localhost] local: pelican content -o output -s pelicanconf.py 87 | WARNING: MD_EXTENSIONS is deprecated use MARKDOWN instead. Falling back to the default. 88 | ERROR: Skipping _extra/README.md: could not find information about 'title' 89 | Done: Processed 11 articles, 0 drafts, 1 page and 0 hidden pages in 2.15 seconds. 90 | [localhost] local: cd output && pwd && git st && git add --all . && git ci -am "re-build from local by markdoc @MBP111216ZQ" && git pu && date 91 | /Users/zoomq/Sites/PyChina.org/blog/output 92 | On branch gh-pages 93 | Your branch is up-to-date with 'origin/gh-pages'. 94 | 95 | ... 96 | 97 | 98 | Delta compression using up to 4 threads. 99 | Compressing objects: 100% (46/46), done. 100 | Writing objects: 100% (46/46), 21.91 KiB | 1.15 MiB/s, done. 101 | Total 46 (delta 42), reused 0 (delta 0) 102 | remote: Resolving deltas: 100% (42/42), completed with 22 local objects. 103 | To github.com:PyChina/blog.git 104 | 82e099c..7954fee gh-pages -> gh-pages 105 | 日 9 15 09:38:25 CST 2019 106 | 107 | 108 | 当前内置的运营指令: 109 | 110 | ༄ fab ? 111 | 112 | Warning: Command(s) not found: 113 | ? 114 | 115 | Available commands: 116 | 117 | build 118 | gh_pages 119 | pub 120 | reserve 121 | serve 122 | 123 | 124 | 125 | 126 | ## main loop: 127 | 128 | 1. git clone 129 | 1. edit some .md in `content/` 130 | 1. `fab build` for test local 131 | 1. `fab put7niu` published all 132 | 1. git add->ci->push 133 | 134 | in fact because github only embded Jekll, 135 | but we r PyChina.org, so play with pure Python tools! 136 | 137 | so, the site is generating in local, push into github, 138 | but be sync into pychina.qiniudn.com, 139 | publish as bind pychina.org ;-) 140 | 141 | ### writing 142 | 143 | - fork https://gitcafe.com/CPyUG/PyChina into local 144 | - or becamed https://gitcafe.com/CPyUG member hold the repo. ACL 145 | - cd into content/ 146 | - the sub-dir means: 147 | 148 | content/ 149 | +- Events 首字母大写的是分类目录 收集对应文章 150 | +- Volunteer ...志愿者 151 | +- _extra 扩展功能文件 e.g robots.txt 152 | +- _files 站内文件 153 | +- _images 样式图片 154 | `- pages 类似 about 的导航栏文档 155 | 156 | #### 文章格式 157 | - 标准 Markdown 格式 158 | - 以 .md 为后缀 159 | - 文件名不得使用中文/空格/符号 160 | - 内容模板: 161 | 162 | Title: 中E可以混杂的标题 163 | Date: 2013-12-09 164 | Tags: people, shanghai 165 | Slug: sting-chen 166 | Author: Zoom.Quiet 167 | 168 | - 其中: 169 | - `Date:` 如果没有将使用文件的系统时间 170 | - `Tags:` 使用逗号作间隔, 不宜过多,建议三个为界,以人物/行为/目标领域 为方向进行定义 171 | - 参考: [如何规划blog的标签(tag)和分类 - 心内求法 - 博客园](http://www.cnblogs.com/holbrook/archive/2012/11/05/2755268.html) 172 | - `Slug:` 是实际输出的页面文件名, 建议全部小写E文, 使用中划线, 不使用特殊符号 173 | 174 | `注意:` 175 | 176 | - 所有图片,应该事先发布到 7ni 空间中以便引用, 而不应该 push 到 git 仓库中 177 | - 参考: [我们是如何使用7牛云储存的](http://blog.zhgdg.org/2013-08/usage7niu/) 178 | - 自然的, 要加入协同编辑团队, 首先要获得 7niu 相关空间的配置文件 179 | - 获取流程: 180 | + 注册 gitcafe 181 | + 针对 [CPyUG/PyChina - GitCafe](https://gitcafe.com/CPyUG/PyChina) 发起一个有效的 `pull-request` , 证明你懂的 182 | + 向社区说明意愿 support@pychina.org 183 | + 获得 `7niu4pychina.json` 184 | 185 | ### deploy 186 | 187 | 支持本地调试! 使用 `fabric` 进行管理, 支持的命令: 188 | 189 | fab 190 | Available commands: 191 | 192 | build 编译所有页面 193 | put7niu 本地完成编译,通过工具上传到 7niu 194 | reserve 重编译所有页面再启动本地服务 195 | serve 启动本地服务 localhost:8000 196 | 197 | 198 | 参考: [qrsync 命令行同步工具 | 七牛云存储](http://developer.qiniu.com/docs/v6/tools/qrsync.html) 199 | 200 | ### design 201 | 202 | 基于 [pelican-bootstrap3](https://github.com/getpelican/pelican-themes/tree/master/pelican-bootstrap3) 深度定制 203 | 204 | - 配置: `pelicanconf.py` 205 | - 样式: `_themes/pelican-bootstrap3/` 206 | - 插件: `_plugins/` 207 | 208 | ## changelog 209 | 210 | - 190818 ZQ ++ CNZZ WA support 211 | - 141120 增补文档,明确协同流程 212 | - 141119 upgrade as 3.5.0 base [issue #264](https://github.com/getpelican/pelican-plugins/issues/264) fixed sitemap.py 213 | - 131218 base pelican build and through qiniu.com publish 214 | 215 | 216 | -------------------------------------------------------------------------------- /_plugins/__init__.py: -------------------------------------------------------------------------------- 1 | from .gzip_cache import * 2 | -------------------------------------------------------------------------------- /_plugins/data_uri.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #!/usr/bin/env python 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | if 3 != len(sys.argv) : 7 | print '''Usage: 8 | data_uri.py /path/2/imgfile exp.base64 9 | ''' 10 | else: 11 | imgf = sys.argv[1] 12 | expf = sys.argv[2] 13 | data_uri = open(imgf, "rb").read().encode("base64").replace("\n", "") 14 | img_tag = 'data:image/png;base64,{0}'.format(data_uri) 15 | open(expf,"w").write(img_tag) 16 | #print img_tag 17 | -------------------------------------------------------------------------------- /_plugins/extract_toc/README.md: -------------------------------------------------------------------------------- 1 | Extract Table of Content 2 | ======================== 3 | 4 | A Pelican plugin to extract table of contents (ToC) from `article.content` and 5 | place it in its own `article.toc` variable. 6 | 7 | Copyright (c) Talha Mansoor 8 | 9 | Author | Talha Mansoor 10 | ----------------|----- 11 | Author Email | talha131@gmail.com 12 | Author Homepage | http://onCrashReboot.com 13 | Github Account | https://github.com/talha131 14 | 15 | Acknowledgement 16 | --------------- 17 | 18 | Thanks to [Avaris](https://github.com/avaris) for going out of the way to help 19 | me fix Unicode issues and doing a thorough code review. 20 | 21 | Why do you need it? 22 | =================== 23 | 24 | Pelican can generate ToC of reST and Markdown files, using markup's respective 25 | directive and extension. ToC is generated and placed at the beginning of 26 | `article.content`. You cannot place the ToC in `