mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-11-02 20:30:30 -06:00
Merge pull request #7062 from tk0miya/7032_no-scaled_link
Close #7032: html_scaled_image_link is disabled for individual image
This commit is contained in:
7 files changed
+55
-6
No files matched your search
Whitespace-only changes.
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
@@ -0,0 +1,11 @@
|
||||
test-html_scaled_image_link
|
||||
===========================
|
||||
|
||||
.. image:: img.png
|
||||
|
||||
.. image:: img.png
|
||||
:scale: 50%
|
||||
|
||||
.. image:: img.png
|
||||
:scale: 50%
|
||||
:class: no-scaled-link
|
||||
@@ -1542,3 +1542,22 @@ def test_validate_html_static_path(app):
|
||||
]
|
||||
validate_html_static_path(app, app.config)
|
||||
assert app.config.html_static_path == ['_static']
|
||||
|
||||
|
||||
@pytest.mark.sphinx(testroot='html_scaled_image_link')
|
||||
def test_html_scaled_image_link(app):
|
||||
app.build()
|
||||
context = (app.outdir / 'index.html').text()
|
||||
|
||||
# no scaled parameters
|
||||
assert re.search('\n<img alt="_images/img.png" src="_images/img.png" />', context)
|
||||
|
||||
# scaled_image_link
|
||||
assert re.search('\n<a class="reference internal image-reference" href="_images/img.png">'
|
||||
'<img alt="_images/img.png" src="_images/img.png" style="[^"]+" /></a>',
|
||||
context)
|
||||
|
||||
# no-scaled-link class disables the feature
|
||||
assert re.search('\n<img alt="_images/img.png" class="no-scaled-link"'
|
||||
' src="_images/img.png" style="[^"]+" />',
|
||||
context)
|
||||
Reference in new issue
Block a user