[Dynamic Language]Sphinxで自動的にpythonコード注釈ドキュメントを生成します。
4735 ワード
原文のリンク:http://www.cnblogs.com/abeen/p/5654347.html
Sphinxを使って自動的にpythonコードの注釈ドキュメントを生成します。
pip install-U sphinx
インストールが完了したら、Pythonコードのドキュメントは、一般的にsphinx-appidocを使って自動的に生成されます。ヘルプmac-abeenを確認してください。doc_logic aben$sphinx-appidoc--helpUsage:sphinx-appidoc[options]-o[excludte]-o
Look recursively in for Python modules and package and createone rest file with atootmodule directives per package in the.
The s can be files and/or directores that will be excludefrom generation.
ノート:By default this script will not overwrite already created files.
Options:-h,--help showthishelp message and exit-o DESTDIR,--outpt-dir=DESTDIR Directory to place all outputput-d MAMADEPTH,--maxdepth=MAMAMADEPTH Maximdepth o f submodules depth of susubmodules to fidededededededededededededeststststststststtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtreefififidededededededededededededededededeful when cobined with collective.recipe.omelette.-n,「dry-run Run the script without creating files-e、--separate Putdocumenation for each module on on on on on page-P,--prvate Include"modules-T,--no- toc Don'create aaaaaaaaaaaablblbleeeconconcondedededededededededededededededededepapage-page-page-page-page-P,page-P,Inpage-P,Inpage-P,--pragagagagagagagage-P,Inpage-P,--preeeeeeeeeeeeepage-P,--prdocstrigs already contain them)-M,module-first Put module documentation before submodule documentation-s SUFFIX、--suffix=SUFFIX file suffix(default:rst)-F,--full Generat a full project with sphinx-quickstart-HEproproproproprojectH,dededededededededededededededededededededededededededededededededededededededededededededetttttttaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttProject author(s)、used when--full is given-V VVERION、--doc-version=VERION Project version、used when--full is given-R RELEASE、--doc-release=RELEASE Project release、used when--full is given、defaults to--doc-version--version
作成コマンドsphinx-appidoc[options]-o outputdir packagedir[pathnames]をoutputdirディレクトリmakeに入力してください。build\htmlフォルダで作成したドキュメントを見ました。検索機能もサポートします。
注意conf.pyを修正してプロジェクトディレクトリを追加します。そうしないと、モジュールが見つからないので、sys.path.appedを導入できません。
例:
1:Srcディレクトリの上位ディレクトリで実行します。
sphinx-appidoc-F-o./appidoc./src
現在のディレクトリの下にapproディレクトリを新規作成し、apiドキュメントを作成するフォルダはこのディレクトリの下にあります。
2:appidocディレクトリに入ってconf.pyファイルの設定コードのパスを修正します。sys.path.insert(0,os.path.abspath('./src')3:appsディレクトリの下でmakeを実行します。
Sphinxマーキング文法例行のコード用` シンプルコードブロックは、コードブロックの前の段落の後に2つのコロンを追加し、1つの行が空いたらコードブロックを開始します。コードブロックはインデントされます。 複合コードブロックはcode-blockガイド文を使用して、行番号とハイライト行などを選択することもできます。
転載先:https://www.cnblogs.com/abeen/p/5654347.html
Sphinxを使って自動的にpythonコードの注釈ドキュメントを生成します。
pip install-U sphinx
インストールが完了したら、Pythonコードのドキュメントは、一般的にsphinx-appidocを使って自動的に生成されます。ヘルプmac-abeenを確認してください。doc_logic aben$sphinx-appidoc--helpUsage:sphinx-appidoc[options]-o[excludte]-o
Look recursively in for Python modules and package and createone rest file with atootmodule directives per package in the.
The s can be files and/or directores that will be excludefrom generation.
ノート:By default this script will not overwrite already created files.
Options:-h,--help showthishelp message and exit-o DESTDIR,--outpt-dir=DESTDIR Directory to place all outputput-d MAMADEPTH,--maxdepth=MAMAMADEPTH Maximdepth o f submodules depth of susubmodules to fidededededededededededededeststststststststtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtrtreefififidededededededededededededededededeful when cobined with collective.recipe.omelette.-n,「dry-run Run the script without creating files-e、--separate Putdocumenation for each module on on on on on page-P,--prvate Include"modules-T,--no- toc Don'create aaaaaaaaaaaablblbleeeconconcondedededededededededededededededededepapage-page-page-page-page-P,page-P,Inpage-P,Inpage-P,--pragagagagagagagage-P,Inpage-P,--preeeeeeeeeeeeepage-P,--prdocstrigs already contain them)-M,module-first Put module documentation before submodule documentation-s SUFFIX、--suffix=SUFFIX file suffix(default:rst)-F,--full Generat a full project with sphinx-quickstart-HEproproproproprojectH,dededededededededededededededededededededededededededededededededededededededededededededetttttttaaaaaaaaaaaaaaaaaaaaaaaattttttttttttttttttProject author(s)、used when--full is given-V VVERION、--doc-version=VERION Project version、used when--full is given-R RELEASE、--doc-release=RELEASE Project release、used when--full is given、defaults to--doc-version--version
作成コマンドsphinx-appidoc[options]-o outputdir packagedir[pathnames]をoutputdirディレクトリmakeに入力してください。build\htmlフォルダで作成したドキュメントを見ました。検索機能もサポートします。
注意conf.pyを修正してプロジェクトディレクトリを追加します。そうしないと、モジュールが見つからないので、sys.path.appedを導入できません。
例:
1:Srcディレクトリの上位ディレクトリで実行します。
sphinx-appidoc-F-o./appidoc./src
現在のディレクトリの下にapproディレクトリを新規作成し、apiドキュメントを作成するフォルダはこのディレクトリの下にあります。
2:appidocディレクトリに入ってconf.pyファイルの設定コードのパスを修正します。sys.path.insert(0,os.path.abspath('./src')3:appsディレクトリの下でmakeを実行します。
Sphinxマーキング文法例
This is a Title
===============
That has a paragraph about a main subject and is set when the '='
is at least the same length of the title itself.
Subject Subtitle
----------------
Subtitles are set with '-' and are required to have the same length
of the subtitle itself, just like titles.
Lists can be unnumbered like:
* Item Foo
* Item Bar
Or automatically numbered:
#. Item 1
#. Item 2
Inline Markup
-------------
Words can have *emphasis in italics* or be **bold** and you can define
code samples with back quotes, like when you talk about a command: ``sudo``
gives you super user powers!
:
source code below ::
void foo()
{
}
source code again
.. code-block:: c
:linenos:
:emphasize-lines: 3,6
void foo()
{
}
転載先:https://www.cnblogs.com/abeen/p/5654347.html