LoginSignup
17
17

More than 5 years have passed since last update.

Sphinx ドキュメントから Electron アプリを作成

Posted at

実用的かどうかはさておき、Sphinx のドキュメントからマルチプラットフォームのアプリ(ドキュメント)を作成できます。

Sphinx の準備

$ pip install sphinx
$ mkdir hello-sphinx-electron
$ cd hello-sphinx-electron

Sphinx quick start.

Separate source and build directories (y/n) [n]: y

上記以外は全てデフォルトで作成。

$ sphinx-quickstart
Welcome to the Sphinx 1.3.3 quickstart utility.
...
Enter the root path for documentation.
> Root path for the documentation [.]: 
...
> Separate source and build directories (y/n) [n]: y
...
> Name prefix for templates and static dir [_]: 
...
> Project name: hello sphinx electron
> Author name(s): Daigo Sakamoto
...
> Project version: 0.1
> Project release [0.1]: 
...
> Project language [en]: 
...
> Source file suffix [.rst]: 
...
> Name of your master document (without suffix) [index]: 
...
> Do you want to use the epub builder (y/n) [n]: 
...
> autodoc: automatically insert docstrings from modules (y/n) [n]: 
> 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]: 
...
> Create Makefile? (y/n) [y]: 
> Create Windows command file? (y/n) [y]: 

Creating file ./source/conf.py.
Creating file ./source/index.rst.
Creating file ./Makefile.
Creating file ./make.bat.

Finished: An initial directory structure has been created.

source ディレクトリの index.rst を編集。

index.rst
Hello sphinx electron
=====================

Hello hello hello

sphinx-electron を設定

sphinx-electron を clone して、electron-packager をインストール。

$ git clone git@bitbucket.org:superdaigo/sphinx-electron.git
$ cd sphinx-electron
$ npm install electron-packager

Makefile に次のコードを追加。(インデントはタブなので注意)

app:
    $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
    rm -rf sphinx-electron/html;cp -r $(BUILDDIR)/html sphinx-electron/html
    cd sphinx-electron; npm run release
    @echo
    @echo "Build finished. The apps are in $(BUILDDIR)/app."

アプリをビルド

Electron アプリの設定はそのままで、Electron アプリをビルド。
OSX で win32 のアプリをビルドするには wine のインストールが必要です。

$ make app

完成。

17
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
17