SlideShare a Scribd company logo
1 of 52
Download to read offline
Building document
with the Sphinx
2013-09
Public edtion
Wednesday, September 11, 13
この資料?
• チームでアプリケーションつくってます
• APIリファレンスを管理しやすく・見やすく
しよう
• チームメンバ向けにSphinxを紹介した時の
スライドです
• 公開向けに加工しました
• 画像のぼかし
• 字幕
2
Wednesday, September 11, 13
2008 Word
3
2008年、プロジェクトのドキュメントはWordで作られていました
この方式の欠点はみなさんご存知のとおりでしょう
Wednesday, September 11, 13
2010 Dokuwiki
4
2010年のプロジェクトではphpのアプリケーションを使いました。
版の管理、手軽さは飛躍的に向上しました、環境の管理が必要でした。
Wednesday, September 11, 13
2012 markdown based
5
2012年にはmarkdownを変換する自作のRubyアプリケーションで
APIリファレンスを提供しました。
Wednesday, September 11, 13
2013 Github pages ?
6
そして2013年、GithubのWikiにリファレンスを書き始めましたが...
Wednesday, September 11, 13
Github Pages are...
• Poor search
• Grow much bigger!!
• kindless to reading
• No indexing
• No relasionship
7
本当にそれでいいのでしょうか、いいえ
Wednesday, September 11, 13
Lighitweight Documentation
8
http://www.slideshare.net/shimizukawa/blockdiag-jus20116
もっとコラボレーションしやすいものがあるのでは?
Wednesday, September 11, 13
2013 Sphinx!!
9
そうだ、Sphinxでいこうよ。
これはGithub wikiのMarkdownを単純に変換したものです。
Wednesday, September 11, 13
The Sphinx
10
• Document Builder
• Python project
• install with pip, easy_install
• (But) Don t need any knowledge of Python.
• Write once publish anywere.(with pahdoc)
• write reST (reStructuredText)
or Markdown
• to html, epub, man, TeX, etc...
たぶんすばらしいSphinxの世界
Wednesday, September 11, 13
Tool: Pandoc
universal docoment converter
11
ありがとうPandoc
Wednesday, September 11, 13
Getting started
with the Sphinx !!
今夜できる、Sphinx ドキュメンテーション
Wednesday, September 11, 13
sphinx-quickstart
$ sphinx-quickstart
Welcome to the Sphinx 1.2b1 quickstart utility.
Please enter values for the following settings (just press Enter
to
accept a default value, if one is given in brackets).
Enter the root path for documentation.
> Root path for the documentation [.]:
13
簡単スタートツール、sphinx-quickstartとの対話を
フルコーラスでご覧ください
Wednesday, September 11, 13
You have two options for placing the build directory for Sphinx
output.
Either, you use a directory "_build" within the root path, or you
separate
"source" and "build" directories within the root path.
> Separate source and build directories (y/N) [n]: y
14
赤い所が入力箇所!
といっても、ほとんど入力する必要は無いんだけどね。
Wednesday, September 11, 13
The project name will occur in several places in the built
documentation.
> Project name: sphinx_sinatra_example
> Author name(s): sawanoboly
15
まだ対話が続くよ、
あと6ページほどやる。
Wednesday, September 11, 13
Sphinx has the notion of a "version" and a "release" for the
software. Each version can have multiple releases. For example,
for
Python the version is something like 2.5 or 3.0, while the release
is
something like 2.5.1 or 3.0a1. If you don't need this dual
structure,
just set both to the same value.
> Project version: 1.0
> Project release [1.0]:
16
まだ対話が続くよ、
あと5ページほど。
Wednesday, September 11, 13
The file name suffix for source files. Commonly, this is either
".txt"
or ".rst". Only files with this suffix are considered documents.
> Source file suffix [.rst]:
17
まだ対話が続くよ、あと4ページほど。
ああ、ここは好みで.txtに変えたりするね。
Wednesday, September 11, 13
One document is special in that it is considered the top node of
the
"contents tree", that is, it is the root of the hierarchical structure
of the documents. Normally, this is "index", but if your "index"
document is a custom template, you can also set this to another
filename.
> Name of your master document (without suffix) [index]:
18
まだ対話が続くよ、
あと3ページほど。
Wednesday, September 11, 13
Sphinx can also add configuration for epub output:
> Do you want to use the epub builder (y/N) [n]:
19
まだ対話が続くよ、あと2ページほど。
オマケでepub出力ができるよ。kindleに入れようぜ。
Wednesday, September 11, 13
Please indicate if you want to use one of the following Sphinx extensions:
> autodoc: automatically insert docstrings from modules (y/N) [n]: y
> doctest: automatically test code snippets in doctest blocks (y/N) [n]:
> intersphinx: link between Sphinx documentation of different projects (y/N) [n]:
> todo: write "todo" entries that can be shown or hidden on build (y/N) [n]:
> coverage: checks for documentation coverage (y/N) [n]:
> pngmath: include math, rendered as PNG images (y/N) [n]:
> mathjax: include math, rendered in the browser by MathJax (y/N) [n]:
> ifconfig: conditional inclusion of content based on config values (y/N) [n]:
> viewcode: include links to the source code of documented Python objects (y/N)
[n]: Y
20
まだ対話が続くよ、あと1ページほど。
いろんなモジュールあるけどスルーでOK、viewcodeはアリかな。
Wednesday, September 11, 13
A Makefile and a Windows command file can be generated for
you so that you
only have to run e.g. `make html' instead of invoking sphinx-build
directly.
> Create Makefile? (Y/n) [y]: y
> Create Windows command file? (Y/n) [y]: n
21
Makefileを作って終わりです
いざSphinx!
Wednesday, September 11, 13
$ tree
├── Makefile # document build tasks
├── build # output directory
└── source # reST files directory
├── _static
├── _templates
├── conf.py # Configration of sphinx for build
└── index.rst # TopPage
22
初期のファイル構成こんな感じです。
すごい、もうビルドできるんだって!
Wednesday, September 11, 13
$ make html
sphinx-build -b html -d build/doctrees source build/html
Making output directory...
Running Sphinx v1.2b1
loading pickled environment... not yet created
building [html]: targets for 1 source files that are out of date
updating environment: 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
writing additional files... genindex search
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded.
23
make html
早速ビルドだ、やったぜ!
Wednesday, September 11, 13
$ tree build/html/
build/html/
├── _sources
│ └── index.txt
├── _static
│ ├── ajax-loader.gif
│ ├── basic.css
│ ├── comment-bright.png
│ ├── comment-close.png
│ ├── comment.png
│ ├── default.css
│ ├── doctools.js
│ ├── down-pressed.png
│ ├── down.png
│ ├── file.png
│ ├── jquery.js
│ ├── minus.png
│ ├── plus.png
│ ├── pygments.css
│ ├── searchtools.js
│ ├── sidebar.js
│ ├── underscore.js
│ ├── up-pressed.png
│ ├── up.png
│ └── websupport.js
├── genindex.html
├── index.html
├── objects.inv
├── search.html
└── searchindex.js
2 directories, 26 files
24
build/htmlの下にファイルが現れた!
よし、開いてみよう
Wednesday, September 11, 13
25
open build/html/index.html
私のドキュメントにようこそ
すでにカッコイイじゃないですかー
Wednesday, September 11, 13
write first page
では書きたいことを
書きたいように書いていこう
Wednesday, September 11, 13
add name to index.rst
Contents:
.. toctree::
:maxdepth: 2
27
Contents:
.. toctree::
:maxdepth: 2
public
APIリソースのpublicについて書いていくよ
準備はindex.rstに一行追加するだけでいいんだ。
Wednesday, September 11, 13
write source/public.rst
28
※ convert from markdown by pandoc
markdown版がもうあるので、pandocで変換してみたのがこちらです
Wednesday, September 11, 13
Rebuild
$ make html
-- snip --
reading sources... [100%] public
-- snip --
writing output... [100%] public
-- snip --
Build finished. The HTML pages are in build/html.
29
さあ、もう一度ビルド!
Wednesday, September 11, 13
open index.html
30
見出しが! 見出しが並んだよ!
ああ、そうだねぼうや。
Wednesday, September 11, 13
mark up
to index
索引があったらいいのに
本みたいに
Wednesday, September 11, 13
add index before content
POST /v1/public/*****************
Resets the hogehoge
32
.. index::
single: public/reset
POST /v1/public/******************
Resets the hogehoge
そんなときは索引から飛びたい見出しの前に
すこしおまじないをかけばうまくいくんだ。
Wednesday, September 11, 13
build and open
genindex.html
33
自動でリンク付きの索引を?
なんて素晴らしいんだ。
Wednesday, September 11, 13
Search!
検索機能もついてくるといっても、
必要な手続きやコツがあるんじゃないのかい?
Wednesday, September 11, 13
Nothing to do
いいえ、みなさんは何もする必要がありません。
Wednesday, September 11, 13
search for all documents
36
ドキュメントはビルドするだけで、searchの対象なんだ。
※日本語対応してるかを見てない
Wednesday, September 11, 13
Show raw reST file
少しの修正を施したいけど、
reSTの書き方をど忘れしたって?
Wednesday, September 11, 13
38
きっとshow source リンクをクリックするんだ。
Wednesday, September 11, 13
View reST on web browser
39
ほら、reSTファイルだ。
※コンフィグで有効/無効
Wednesday, September 11, 13
Document
Versioning
アプリケーションのバージョンごとに
別のドキュメントにする必要が求められることがある。
Wednesday, September 11, 13
sphinx-build
(Modify Makefile)
Makefileで、ちょちょいのちょいなんだけど
Wednesday, September 11, 13
Modify BUILDDIR
BUILDDIR = build
42
BUILDDIR = build/1.0
他に良いやり方知ってる人教えてください
Wednesday, September 11, 13
$ make html
sphinx-build -b html -d build/1.0/doctrees source build/1.0/
html
-- snip --
Build finished. The HTML pages are in build/1.0/html.
43
一応べつのディレクトリとして出力できるんだけど
Wednesday, September 11, 13
upgrade
mejour version
このやり方があんまりスマートにも思えないんだ
Wednesday, September 11, 13
conf.py and Makefile
## conf.py
version = '1.1'
release = '1.1'
## Makefile
BUILDDIR = build/1.1
45
conf.pyはいいとしてもね
Wednesday, September 11, 13
example of version selection!
but modify template manually maybe...
46
Pythonの公式サイトみたいにしたいね
Wednesday, September 11, 13
Appendix.1
Dash.app
知ってるかい Dash.app
Wednesday, September 11, 13
Dash.app
48
ローカル本棚だよ
Wednesday, September 11, 13
import from sphinx
49
doc2dashでググれ
Wednesday, September 11, 13
Appendix.2
Publish to heroku
htmlにしたら何処かでホスト必要がある、
herokuに置いてしまう方法を紹介しよう。
Wednesday, September 11, 13
static html publishing with sinatra
http://qiita.com/sawanoboly@github/items/be1dbc9f19e93e4b62cf
51
今じゃないけど。
Wednesday, September 11, 13
Thanks
ありがとう
Wednesday, September 11, 13

More Related Content

Viewers also liked

Viewers also liked (20)

密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -
密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -
密着! nibohsiデプロイ 13:00-13:05 - railsアプリのデプロイ事例 -
 
Aws OpsWorks [JAWSDAYS 2014 ACEに聞けトラック]
Aws OpsWorks [JAWSDAYS 2014 ACEに聞けトラック]Aws OpsWorks [JAWSDAYS 2014 ACEに聞けトラック]
Aws OpsWorks [JAWSDAYS 2014 ACEに聞けトラック]
 
JAWSUG初心者向けトラック 【Deploy&Ops】
JAWSUG初心者向けトラック 【Deploy&Ops】JAWSUG初心者向けトラック 【Deploy&Ops】
JAWSUG初心者向けトラック 【Deploy&Ops】
 
Chef Casual Talks 出張版京セラドーム公演 (JAWS FESTA Kansai 2013内イベント)
Chef Casual Talks 出張版京セラドーム公演 (JAWS FESTA Kansai 2013内イベント)Chef Casual Talks 出張版京セラドーム公演 (JAWS FESTA Kansai 2013内イベント)
Chef Casual Talks 出張版京セラドーム公演 (JAWS FESTA Kansai 2013内イベント)
 
Chef_Casual_Talks_Kansai_Vol1_Infrastructure_as_Code
Chef_Casual_Talks_Kansai_Vol1_Infrastructure_as_CodeChef_Casual_Talks_Kansai_Vol1_Infrastructure_as_Code
Chef_Casual_Talks_Kansai_Vol1_Infrastructure_as_Code
 
さくらのクラウドフォーメーション with Chef [XEgg session]
さくらのクラウドフォーメーション with Chef [XEgg session]さくらのクラウドフォーメーション with Chef [XEgg session]
さくらのクラウドフォーメーション with Chef [XEgg session]
 
mocloud カスタムDockerイメージ ハンズオン
mocloud カスタムDockerイメージ ハンズオンmocloud カスタムDockerイメージ ハンズオン
mocloud カスタムDockerイメージ ハンズオン
 
aws_opsworks
aws_opsworksaws_opsworks
aws_opsworks
 
コンテナ事例 CircleCI, Cucumber-Chef
コンテナ事例 CircleCI, Cucumber-Chefコンテナ事例 CircleCI, Cucumber-Chef
コンテナ事例 CircleCI, Cucumber-Chef
 
Infrastructure as Codeと 組織のドキュメンテーション + Immutable Infrastructure事例
Infrastructure as Codeと 組織のドキュメンテーション + Immutable Infrastructure事例Infrastructure as Codeと 組織のドキュメンテーション + Immutable Infrastructure事例
Infrastructure as Codeと 組織のドキュメンテーション + Immutable Infrastructure事例
 
MarketPlaceのAMIをPackerで作る時、 Chefは3度配膳する
MarketPlaceのAMIをPackerで作る時、 Chefは3度配膳するMarketPlaceのAMIをPackerで作る時、 Chefは3度配膳する
MarketPlaceのAMIをPackerで作る時、 Chefは3度配膳する
 
Chef meetup vol2_higanwoks
Chef meetup vol2_higanwoksChef meetup vol2_higanwoks
Chef meetup vol2_higanwoks
 
2014年のChefとInfrastructure as code
2014年のChefとInfrastructure as code2014年のChefとInfrastructure as code
2014年のChefとInfrastructure as code
 
さくらのインフラコード
さくらのインフラコードさくらのインフラコード
さくらのインフラコード
 
仮想マシンざっくり解説と実践Vagrant | StaticPress × S3 × Vagrant 勉強会
仮想マシンざっくり解説と実践Vagrant | StaticPress × S3 × Vagrant 勉強会仮想マシンざっくり解説と実践Vagrant | StaticPress × S3 × Vagrant 勉強会
仮想マシンざっくり解説と実践Vagrant | StaticPress × S3 × Vagrant 勉強会
 
はかどるChefの小ネタ集
はかどるChefの小ネタ集はかどるChefの小ネタ集
はかどるChefの小ネタ集
 
[LT] インフラの人がChefやServerspec(ほか)が Rubyだったおかげですこし プログラムをするようになった話
[LT] インフラの人がChefやServerspec(ほか)が Rubyだったおかげですこし プログラムをするようになった話[LT] インフラの人がChefやServerspec(ほか)が Rubyだったおかげですこし プログラムをするようになった話
[LT] インフラの人がChefやServerspec(ほか)が Rubyだったおかげですこし プログラムをするようになった話
 
マニアックツール紹介、マネジメントのKnife-Zero(Chef)とテストスイートInSpec
マニアックツール紹介、マネジメントのKnife-Zero(Chef)とテストスイートInSpecマニアックツール紹介、マネジメントのKnife-Zero(Chef)とテストスイートInSpec
マニアックツール紹介、マネジメントのKnife-Zero(Chef)とテストスイートInSpec
 
DevOpsのアプローチと クラウド/バーチャル環境/構成管理ツール のお話
DevOpsのアプローチと クラウド/バーチャル環境/構成管理ツール のお話DevOpsのアプローチと クラウド/バーチャル環境/構成管理ツール のお話
DevOpsのアプローチと クラウド/バーチャル環境/構成管理ツール のお話
 
Chef(Server)と AWS OpsWorks(tm)の比較
Chef(Server)と AWS OpsWorks(tm)の比較Chef(Server)と AWS OpsWorks(tm)の比較
Chef(Server)と AWS OpsWorks(tm)の比較
 

Similar to Building document with the Sphinx public edtion

Sinatraでwebアプリケーション開発を学ぶ
Sinatraでwebアプリケーション開発を学ぶSinatraでwebアプリケーション開発を学ぶ
Sinatraでwebアプリケーション開発を学ぶ
Hiroshi Oyamada
 
2011年10月21日
2011年10月21日2011年10月21日
2011年10月21日
nukaemon
 
20121115 fukuoka sublime0_kuroneko
20121115 fukuoka sublime0_kuroneko20121115 fukuoka sublime0_kuroneko
20121115 fukuoka sublime0_kuroneko
Kohki Nakashima
 
Sinatraアプリをherokuにアップ
SinatraアプリをherokuにアップSinatraアプリをherokuにアップ
Sinatraアプリをherokuにアップ
Hiroshi Oyamada
 
第1回 Open Build Service 道場
第1回 Open Build Service 道場第1回 Open Build Service 道場
第1回 Open Build Service 道場
Fuminobu Takeyama
 

Similar to Building document with the Sphinx public edtion (20)

Sinatraでwebアプリケーション開発を学ぶ
Sinatraでwebアプリケーション開発を学ぶSinatraでwebアプリケーション開発を学ぶ
Sinatraでwebアプリケーション開発を学ぶ
 
ソフトウェア工学2023 13 ドキュメンテーション
ソフトウェア工学2023 13 ドキュメンテーションソフトウェア工学2023 13 ドキュメンテーション
ソフトウェア工学2023 13 ドキュメンテーション
 
2011年10月21日
2011年10月21日2011年10月21日
2011年10月21日
 
ソフトウェア工学2023 14 ビルド
ソフトウェア工学2023 14 ビルドソフトウェア工学2023 14 ビルド
ソフトウェア工学2023 14 ビルド
 
20230128.pptx
20230128.pptx20230128.pptx
20230128.pptx
 
いまさら聞けないRake入門
いまさら聞けないRake入門いまさら聞けないRake入門
いまさら聞けないRake入門
 
Introduce that Best practices for writing Dockerfiles
Introduce that Best practices for writing DockerfilesIntroduce that Best practices for writing Dockerfiles
Introduce that Best practices for writing Dockerfiles
 
20121115 fukuoka sublime0_kuroneko
20121115 fukuoka sublime0_kuroneko20121115 fukuoka sublime0_kuroneko
20121115 fukuoka sublime0_kuroneko
 
TensorFlow 3分紹介 with 速攻 windows 環境構築
TensorFlow 3分紹介 with 速攻 windows 環境構築TensorFlow 3分紹介 with 速攻 windows 環境構築
TensorFlow 3分紹介 with 速攻 windows 環境構築
 
Sinatraアプリをherokuにアップ
SinatraアプリをherokuにアップSinatraアプリをherokuにアップ
Sinatraアプリをherokuにアップ
 
「AIRネイティブ拡張」を使って、 AndroidでNFCを読み込んでみた
「AIRネイティブ拡張」を使って、 AndroidでNFCを読み込んでみた「AIRネイティブ拡張」を使って、 AndroidでNFCを読み込んでみた
「AIRネイティブ拡張」を使って、 AndroidでNFCを読み込んでみた
 
Sphinxの使い方事例
Sphinxの使い方事例Sphinxの使い方事例
Sphinxの使い方事例
 
Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力
Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力
Ruby向け帳票ソリューション「ThinReports」の開発で知るOSSの威力
 
Railsの開発環境作るぞ
Railsの開発環境作るぞRailsの開発環境作るぞ
Railsの開発環境作るぞ
 
Build 番号の自動更新スクリプトについて #cocoa_kansai
Build 番号の自動更新スクリプトについて #cocoa_kansaiBuild 番号の自動更新スクリプトについて #cocoa_kansai
Build 番号の自動更新スクリプトについて #cocoa_kansai
 
Ansible2.0と実用例
Ansible2.0と実用例Ansible2.0と実用例
Ansible2.0と実用例
 
第1回 Open Build Service 道場
第1回 Open Build Service 道場第1回 Open Build Service 道場
第1回 Open Build Service 道場
 
スマホキャンプサマー2012:ANEとアプリ内課金に挑戦
スマホキャンプサマー2012:ANEとアプリ内課金に挑戦スマホキャンプサマー2012:ANEとアプリ内課金に挑戦
スマホキャンプサマー2012:ANEとアプリ内課金に挑戦
 
Webセミナー「RAD Studio 10.1 Berlin Update 2 Anniversary Edition 新機能ガイド」
Webセミナー「RAD Studio 10.1 Berlin Update 2 Anniversary Edition 新機能ガイド」Webセミナー「RAD Studio 10.1 Berlin Update 2 Anniversary Edition 新機能ガイド」
Webセミナー「RAD Studio 10.1 Berlin Update 2 Anniversary Edition 新機能ガイド」
 
Falconjsの始め方 (share)
Falconjsの始め方 (share)Falconjsの始め方 (share)
Falconjsの始め方 (share)
 

More from Yukihiko SAWANOBORI

Physical to Iaas(Instance), case of VIP.
Physical to Iaas(Instance), case of VIP.Physical to Iaas(Instance), case of VIP.
Physical to Iaas(Instance), case of VIP.
Yukihiko SAWANOBORI
 

More from Yukihiko SAWANOBORI (10)

What is chef
What is chefWhat is chef
What is chef
 
CentOSでつくる神Plesk
CentOSでつくる神PleskCentOSでつくる神Plesk
CentOSでつくる神Plesk
 
Lxc on cloud
Lxc on cloudLxc on cloud
Lxc on cloud
 
The Chef integrations Z Cloud(Joyent)
The Chef integrations Z Cloud(Joyent)The Chef integrations Z Cloud(Joyent)
The Chef integrations Z Cloud(Joyent)
 
Physical to Iaas(Instance), case of VIP.
Physical to Iaas(Instance), case of VIP.Physical to Iaas(Instance), case of VIP.
Physical to Iaas(Instance), case of VIP.
 
Redmine backlogs beginning
Redmine backlogs beginningRedmine backlogs beginning
Redmine backlogs beginning
 
Aws glacier
Aws glacierAws glacier
Aws glacier
 
0808 jawsug-kobe | スポットインスタンスを使った EC2でのスケーラブル負荷検証
0808 jawsug-kobe | スポットインスタンスを使ったEC2でのスケーラブル負荷検証0808 jawsug-kobe | スポットインスタンスを使ったEC2でのスケーラブル負荷検証
0808 jawsug-kobe | スポットインスタンスを使った EC2でのスケーラブル負荷検証
 
Sensu impression
Sensu impressionSensu impression
Sensu impression
 
cURL base_simple_publishing - part of Giraffi
cURL base_simple_publishing - part of GirafficURL base_simple_publishing - part of Giraffi
cURL base_simple_publishing - part of Giraffi
 

Building document with the Sphinx public edtion