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

Cylc Config Metadata Directive #81

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
74 changes: 63 additions & 11 deletions cylc/sphinx_ext/cylc_lang/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,23 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
'''An extension providing pygments lexers for the Cylc flow.cylc language.
from pathlib import Path
from cylc.sphinx_ext.cylc_lang.autodocumenters import (
CylcAutoDirective,
CylcAutoTypeDirective,
CylcWorkflowDirective,
CylcGlobalDirective,
)
from cylc.sphinx_ext.cylc_lang.domains import (
ParsecDomain,
CylcDomain,
CylcScopeDirective
)
from cylc.sphinx_ext.cylc_lang.lexers import CylcLexer, CylcGraphLexer


rawdoc1 = '''An extension providing pygments lexers for the Cylc flow.cylc
language.


Pygments Lexers
Expand Down Expand Up @@ -157,7 +173,9 @@
cylc.flow.parsec.validate.ParsecValidator.V_TYPE_HELP
cylc.flow.parsec.validate.CylcConfigValidator.V_TYPE_HELP

'''

rawdoc3 = '''
Directives
----------

Expand All @@ -181,19 +199,51 @@

This resets it to the hardcoded default which is ``flow.cylc``.



'''

from cylc.sphinx_ext.cylc_lang.autodocumenters import (
CylcAutoDirective,
CylcAutoTypeDirective
)
from cylc.sphinx_ext.cylc_lang.domains import (
ParsecDomain,
CylcDomain,
CylcScopeDirective
)
from cylc.sphinx_ext.cylc_lang.lexers import CylcLexer, CylcGraphLexer
rawdoc2 = """
.. rst:directive:: .. auto-global-cylc:: source

Get a Cylc Global Configuration and render metadata fields.

If the optional source argument is give,
set ``CYLC_SITE_CONF_PATH`` to this value.

.. note::

If you have a user config this will still override the site
config!

.. rst-example::

.. auto-cylc-global:: {workflow_path}
:show:
wxtim marked this conversation as resolved.
Show resolved Hide resolved
foo,
install target,
bar,
qax

.. rst:directive:: .. auto-cylc-workflow:: source

Get a Cylc Workflow Configuration from source and document the settings.

.. rst-example::

.. auto-cylc-workflow:: {workflow_path}/workflow
:show:
foo,
platform
"""


workflow_path = Path(__file__).parent.parent.parent.parent / 'etc'
__doc__ = (
rawdoc1
+ rawdoc2.format(workflow_path=workflow_path)
+ rawdoc3
)

__all__ = [
'CylcAutoDirective',
Expand All @@ -214,5 +264,7 @@ def setup(app):
app.add_domain(ParsecDomain)
app.add_directive('auto-cylc-conf', CylcAutoDirective)
app.add_directive('auto-cylc-type', CylcAutoTypeDirective)
app.add_directive('auto-cylc-workflow', CylcWorkflowDirective)
app.add_directive('auto-cylc-global', CylcGlobalDirective)
app.add_directive('cylc-scope', CylcScopeDirective)
return {'version': __version__, 'parallel_read_safe': True}
Loading
Loading