Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sphinxext command by allowing whitespace in argument #1644

Merged
merged 1 commit into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*\,cover
coverage/
.cache
.pytest_cache
.coverage

# Files created by RPN tests
Expand Down
4 changes: 2 additions & 2 deletions aiida/sphinxext/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) $(SOURCEDIR)
all: html

clean:
rm -r $(BUILDDIR)
rm -r $(HTMLBUILDDIR)
@rm -r $(BUILDDIR) || true
@rm -r $(HTMLBUILDDIR) || true

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(HTMLBUILDDIR)
Expand Down
14 changes: 12 additions & 2 deletions aiida/sphinxext/tests/reference_results/workchain.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/docs/ref/docutils.dtd">
<!-- Generated by Docutils 0.13.1 -->
<document source="/home/martin/src/aiida_core/aiida/sphinxext/tests/workchain_source/index.rst">
<!-- Generated by Docutils 0.14 -->
<document source="/home/greschd/programming/aiida/aiida_core/aiida/sphinxext/tests/workchain_source/index.rst">
<section ids="sphinx-aiida-demo" names="sphinx-aiida\ demo">
<title>sphinx-aiida demo</title>
<paragraph>This is a demo documentation to show off the features of the <literal>sphinx-aiida</literal> extension.</paragraph>
Expand Down Expand Up @@ -32,6 +32,16 @@
<target ids="module-demo_workchain" ismod="True"></target>
<index entries="['single',\ u'demo_workchain\ (module)',\ u'module-demo_workchain',\ '',\ None]"></index>
<paragraph>This module defines an example workchain for the aiida-workchain documentation directive.</paragraph>
<desc desctype="class" domain="py" noindex="False" objtype="class">
<desc_signature first="False" fullname="Workchain"><desc_annotation xml:space="preserve">workchain</desc_annotation><desc_addname xml:space="preserve">demo_workchain.</desc_addname><desc_name xml:space="preserve">DemoWorkChain</desc_name></desc_signature>
<desc_content>
<paragraph>
A demo workchain to show how the workchain auto-documentation works.
</paragraph>
<paragraph><strong>Inputs:</strong><bullet_list bullet="*"><list_item><paragraph><literal_strong>description</literal_strong>, <emphasis>basestring</emphasis>, optional, <emphasis>non_db</emphasis></paragraph></list_item><list_item><paragraph><literal_strong>label</literal_strong>, <emphasis>basestring</emphasis>, optional, <emphasis>non_db</emphasis></paragraph></list_item><list_item><literal_strong>nsp</literal_strong>, <emphasis>Namespace</emphasis> – A separate namespace, <literal>nsp</literal>.<bullet_list bullet="*"></bullet_list></list_item><list_item><literal_strong>nsp2</literal_strong>, <emphasis>Namespace</emphasis><bullet_list bullet="*"></bullet_list></list_item><list_item><paragraph><literal_strong>store_provenance</literal_strong>, <emphasis>bool</emphasis>, optional, <emphasis>non_db</emphasis></paragraph></list_item><list_item><paragraph><literal_strong>x</literal_strong>, <emphasis>Float</emphasis>, required – First input argument.</paragraph></list_item><list_item><literal_strong>y</literal_strong>, <emphasis>Namespace</emphasis><bullet_list bullet="*"><list_item><paragraph><literal_strong>z</literal_strong>, <emphasis>Int</emphasis>, required – Input in a separate namespace.</paragraph></list_item></bullet_list></list_item></bullet_list></paragraph>
<paragraph><strong>Outputs:</strong><bullet_list bullet="*"><list_item><paragraph><literal_strong>z</literal_strong>, <emphasis>Bool</emphasis>, required – Output of the demoworkchain.</paragraph></list_item></bullet_list></paragraph>
</desc_content>
</desc>
<index entries="['single',\ u'NormalClass\ (class\ in\ demo_workchain)',\ u'demo_workchain.NormalClass',\ '',\ None]"></index>
<desc desctype="class" domain="py" noindex="False" objtype="class">
<desc_signature class="" first="False" fullname="NormalClass" ids="demo_workchain.NormalClass" module="demo_workchain" names="demo_workchain.NormalClass"><desc_annotation xml:space="preserve">class </desc_annotation><desc_addname xml:space="preserve">demo_workchain.</desc_addname><desc_name xml:space="preserve">NormalClass</desc_name></desc_signature>
Expand Down
5 changes: 4 additions & 1 deletion aiida/sphinxext/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ class AiidaWorkchainDirective(Directive):
Directive to auto-document AiiDA workchains.
"""
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True

HIDE_UNSTORED_INPUTS_FLAG = 'hide-nondb-inputs'
optional_arguments = 2
option_spec = {'module': directives.unchanged, HIDE_UNSTORED_INPUTS_FLAG: directives.flag}

has_content = True

def run(self):
Expand Down