2017-10-11 9 views
0

ひよこsphinxと付き合っています。私のディレクトリツリーは次のようになります。サブディレクトリにあるときにipynbファイルをsphinx index.rstに入れる

| - project_root 
| | - importable_project 
| | | - importable_module.py 
| | | - another_importable_module.py 
| | | - Tutorials 
| | | | - tutorial1.ipynb 
| | - docs 
| | | - build 
| | | | - sphinx_build_files_and_folders 
| | | - source 
| | | | - _static 
| | | | - _templates 
| | | | - conf.py 
| | | | - index.rst 
| | | | - modules.rst 

私は指示に従ってnbsphinx extentionを有効にしていると私は、ソースフォルダ内index.rstファイルを変更しています。

.. Pycotools documentation master file, created by 
    sphinx-quickstart on Wed Oct 11 11:46:06 2017. 
    You can adapt this file completely to your liking, but it should at least 
    contain the root `toctree` directive. 

Welcome to Pycotools's documentation! 
===================================== 

.. toctree:: 
    :maxdepth: 2 
    :caption: Contents: 

    /modules 
    ../../importable_project/Tutorials/tutorial1 


Indices and tables 
================== 

* :ref:`genindex` 
* :ref:`modindex` 
* :ref:`search` 

これのほとんどは自動的にsphinx-quickstartによって生成された:ここでは

index.rstファイルが現在のように見えるものです。ここで指定されたファイルパスは、index.rstファイルの相対パスであることを理解しています。この場合、project_root/docs/sourceとなり、sphinxは上記index.rstファイルを持つmoudles.rstのhtmlを生成することができます。

問題はドキュメントにチュートリアルを含めることですが、../../importable_project/Tutorials/tutorial1という行はtutorial1.ipynbを見つけることができません。

誰かが私が間違っていることを示唆できますか?

+1

チュートリアルはドキュメントであり、 'docs/source'ディレクトリに移動する必要があります。 autodocによるパッケージを除き、Sphinxはソースディレクトリの外にあるファイルを見つけることができません。 '.ipynb'ファイルを動かした後にパスを調整する必要があります。 –

+0

ありがとうございます。これはうまくいった。回答を投稿すると私は受け入れます。 – CiaranWelsh

答えて

2

チュートリアルはドキュメントであり、docs/sourceディレクトリに移動する必要があります。 autodocによるパッケージを除き、Sphinxはソースディレクトリの外にあるファイルを見つけることができません。 .ipynbファイルを移動した後にパスを調整する必要があります。

関連する問題