Created
May 28, 2014 12:31
-
-
Save hirofumi/2eee3797ade87a73e1d1 to your computer and use it in GitHub Desktop.
Create Python 2.7ja docset and add to Dash.app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
temporary="$(mktemp -d -t doc2dash_python-2.7ja)" | |
trap 'rm -rf "${temporary}"' EXIT ERR | |
cd "${temporary}" | |
virtualenv . | |
. ./bin/activate | |
pip install 'doc2dash==1.2.0' | |
cd 'lib/python2.7/site-packages/doc2dash/parsers' | |
mv -n sphinx.py sphinx.py.orig | |
{ | |
echo '# -*- coding: utf-8 -*-' | |
cat sphinx.py.orig - <<EOS | |
TYPE_MAPPING.extend([ | |
(re.compile(ur'(.*)\(\S+ のメソッド\)$'), types.METHOD), | |
(re.compile(ur'(.*)\(.*の関数\)$'), types.FUNCTION), | |
(re.compile(ur'(.*)\(\S+ の属性\)$'), types.ATTRIBUTE), | |
(re.compile(ur'(.*)\(\S+ のメンバ変数\)$'), types.ATTRIBUTE), | |
(re.compile(ur'(.*)\(\S+ のクラス\)$'), types.CLASS), | |
(re.compile(ur'(.*)\(組み込みクラス\)$'), types.CLASS), | |
(re.compile(ur'(.*)\(組み込み変数\)$'), types.CONSTANT), | |
(re.compile(ur'(.*)\(組み込み関数\)$'), types.FUNCTION), | |
(re.compile(ur'(.*)\(モジュール\)$'), types.PACKAGE), | |
(re.compile(ur'(.*)\(opcode\)$'), types.CONSTANT), | |
(re.compile(ur'(.*)\(\S+ モジュール\)$'), _IN_MODULE) | |
]) | |
EOS | |
} > sphinx.py | |
cd "${temporary}" | |
name='python-doc-2.7ja1-html' | |
curl -O "https://python-doc-ja.googlecode.com/files/${name}.tar.gz" | |
tar xzf "${name}.tar.gz" | |
doc2dash -A "${name}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment