HTMLに変換してみよう

原稿(reStructuredText形式で書かれたテキストファイル)をHTMLに変換します。

コマンドプロンプト(PowerShellウィンドウ)はまだ開いていますか。 もし閉じてしまっていたら、もう一度開いてください。

コマンドプロンプト(PowerShellウィンドウ)でHTMLを出力するコマンドを実行してみましょう。make htmlです。

C:\Users\作業中\trial> make html

PowerShellウィンドウの場合は、makeというバッチファイルの場所を指定して実行します。

C:\Users\作業中\trial> .\make html

色々なメッセージが表示されます。

C:\Users\作業中\trial> make html

Running Sphinx v1.5.6
making output directory...
loading translations [ja]... done
loading pickled environment... not yet created
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 2 source files that are out of date
updating environment: 2 added, 0 changed, 0 removed
reading sources... [ 50%] doc
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [ 50%] doc
writing output... [100%] index
generating indices... genindex
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in Japanese (code: ja) ... done
dumping object inventory... done
build succeeded.

Build finished. The HTML pages are in _build\html.

何も警告が出ずにBuild finished. The HTML pages are in _build¥html と表示されれば成功です。 HTMLが出力されていれば、フォルダ構成はこのような感じになっているはずです。

C:\Users\作業中\trial
│  conf.py
│  doc.rst
│  index.rst
│  make.bat
│  Makefile

├─_build
│  ├─doctrees
│  │      doc.doctree
│  │      environment.pickle
│  │      index.doctree
│  │
│  └─html
│      │  .buildinfo
│      │  doc.html
│      │  genindex.html
│      │  index.html
│      │  objects.inv
│      │  search.html
│      │  searchindex.js
│      │
│      ├─_sources
│      │      doc.rst.txt
│      │      index.rst.txt
│      │
│      └─_static
│              ajax-loader.gif
│              alabaster.css
│              basic.css
│              comment-bright.png
│              comment-close.png
│              comment.png
│              custom.css
│              doctools.js
│              down-pressed.png
│              down.png
│              file.png
│              jquery-3.1.0.js
│              jquery.js
│              minus.png
│              plus.png
│              pygments.css
│              searchtools.js
│              translations.js
│              underscore-1.3.1.js
│              underscore.js
│              up-pressed.png
│              up.png
│              websupport.js

├─_static
└─_templates

WARNING: undecodable source characters と表示された場合は、doc.rstの文字コードがUTF8ではないと考えられます。ファイルをテキストエディタで開いてみて、UTF8で保存し直してください。

WARNING: toctree contains reference to nonexisting document と表示された場合は、index.rstの中のdoc.rstと書いてある行のインデントが、:captionと書いてある行とズレていると考えられます。index.rstをテキストエディタで開いてみて確認してください。