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

Problem with rendering Sphinx substitutions #3375

Closed
bomb-on opened this issue Jan 31, 2017 · 1 comment
Closed

Problem with rendering Sphinx substitutions #3375

bomb-on opened this issue Jan 31, 2017 · 1 comment

Comments

@bomb-on
Copy link

bomb-on commented Jan 31, 2017

Subject: Problem with rendering Sphinx substitutions

Problem

I am trying to use sphinxcontrib.httpdomain in my project and I defined my 'routing table' like this:

# conf.py
from sphinx.domains.std import StandardDomain

def setup(app):
    StandardDomain.initial_data['labels']['routingtable'] = (
        'http-routingtable',
        '',
        'HTTP Routing Table')
    StandardDomain.initial_data['anonlabels']['routingtable'] = (
        'http-routingtable',
        '')

I also defined few simple substitutions which I use throughout my docs, e.g.:

# conf.py
rst_epilog = """
.. |mongodb_icon| raw:: html

   <span class="icon-dbs-mongodb"></span>
"""

When I put this substitution in the synopsis directive of sphinxcontrib.httpdomain extension, it is rendered out on the 'routing table' page as plain text (e.g. |mongodb_icon| instead of <span class="icon-dbs-mongodb"></span>):

# in some .rst file
.. http:post:: /companies/
   :synopsis: Some text whatever |mongodb_icon|

Is it possible to 'force' this page (routing table) to render out my substitutions properly?

Procedure to reproduce the problem

  • Install the extension
    pip install sphinxcontrib-httpdomain

  • Update config.py

from sphinx.domains.std import StandardDomain

extensions.append('sphinxcontrib.httpdomain')

def setup(app):
    StandardDomain.initial_data['labels']['routingtable'] = (
        'http-routingtable',
        '',
        'HTTP Routing Table')
    StandardDomain.initial_data['anonlabels']['routingtable'] = (
        'http-routingtable',
        '')

rst_epilog = """
.. |test_replacement| raw:: html

   <div>HTML replacement</div>
"""
  • Add to any .rst file
/some_path_here/
----------------

POST
^^^^

.. http:post:: /some_path_here/
   :synopsis: |test_replacement| Just testing a replacement
  • Build docs
    make html

  • Visit http-routingtable.html page in your build.

Expected results

Replace substitution (e.g. |mongodb_icon|) with a proper HTML code (e.g. <span class="icon-dbs-mongodb"></span>).

Environment info

  • OS: AWS Linux and Mac OS X
  • Python version: 3.4
  • Sphinx version: 1.5.2
  • sphinxcontrib.httpdomain version: 1.5.0
@tk0miya
Copy link
Member

tk0miya commented Jan 31, 2017

The options for directive are processed by the directive itself.
Sphinx does not control them.
So please ask that to sphinxcontrib-httpdomain project.

Thanks,

@tk0miya tk0miya closed this as completed Jan 31, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants