-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from sphinx-contrib/domain
Wrap directives in minimal domain
- Loading branch information
Showing
10 changed files
with
64 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
================ | ||
Legacy Samples | ||
================ | ||
|
||
The ``datatemplate`` directive is should no longer be used. It is | ||
deprecated, and will be removed in the next release. | ||
|
||
Data File | ||
========= | ||
|
||
.. include:: sample.yaml | ||
:literal: | ||
|
||
Template File | ||
============= | ||
|
||
.. include:: _templates/sample.tmpl | ||
:literal: | ||
|
||
Rendered Output | ||
=============== | ||
|
||
.. datatemplate:: | ||
:source: sample.yaml | ||
:template: sample.tmpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
from sphinx.util import logging | ||
|
||
from sphinxcontrib.datatemplates import directive | ||
from . import directive, domain | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
|
||
def setup(app): | ||
LOG.info('initializing sphinxcontrib.datatemplates') | ||
app.add_directive('datatemplate-json', directive.DataTemplateJSON) | ||
app.add_directive('datatemplate-yaml', directive.DataTemplateYAML) | ||
app.add_directive('datatemplate-csv', directive.DataTemplateCSV) | ||
app.add_directive('datatemplate-xml', directive.DataTemplateXML) | ||
app.add_directive('datatemplate', directive.DataTemplateLegacy) | ||
app.add_domain(domain.DataTemplateDomain) | ||
|
||
return { | ||
'parallel_read_safe': True, | ||
'parallel_write_safe': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from sphinx.domains import Domain | ||
from . import directive | ||
|
||
|
||
class DataTemplateDomain(Domain): | ||
|
||
name = 'datatemplate' | ||
label = 'DataTemplate Replacement' | ||
directives = { | ||
'json': directive.DataTemplateJSON, | ||
'yaml': directive.DataTemplateYAML, | ||
'csv': directive.DataTemplateCSV, | ||
'xml': directive.DataTemplateXML, | ||
} | ||
|
||
def get_objects(self): | ||
return [] | ||
|
||
def resolve_xref(self, env, fromdocname, builder, typ, target, node, | ||
contnode): | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters