File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed
roots/test-quotation-marks Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -124,4 +124,5 @@ def get_description(
124
124
125
125
mcv = DescriptionParser (description_length , known_titles , document )
126
126
doctree .walkabout (mcv )
127
- return mcv .description
127
+ # Parse quotation so they won't break html tags if smart quotes are disabled
128
+ return mcv .description .replace ('"' , """ )
Original file line number Diff line number Diff line change
1
+ extensions = ["sphinxext.opengraph" ]
2
+
3
+ master_doc = "index"
4
+ exclude_patterns = ["_build" ]
5
+
6
+ html_theme = "basic"
7
+
8
+ smartquotes = False
9
+
10
+ ogp_site_url = "http://example.org/"
Original file line number Diff line number Diff line change
1
+ "This text should appear in escaped quotation marks" This text should still appear as well "while this is once again in quotations"
Original file line number Diff line number Diff line change @@ -149,6 +149,17 @@ def test_skip_code_block(og_meta_tags):
149
149
)
150
150
151
151
152
+ @pytest .mark .sphinx ("html" , testroot = "quotation-marks" )
153
+ def test_quotation_marks (og_meta_tags ):
154
+ # If smart quotes are disabled and the quotes aren't properly escaped, bs4 will fail to parse the tag and the content will be a empty string
155
+ description = get_tag_content (og_meta_tags , "description" )
156
+
157
+ assert (
158
+ description
159
+ == '"This text should appear in escaped quotation marks" This text should still appear as well "while this is once again in quotations"'
160
+ )
161
+
162
+
152
163
# use same as simple, as configuration is identical to overriden
153
164
@pytest .mark .sphinx ("html" , testroot = "simple" )
154
165
def test_rtd_override (app : Sphinx , monkeypatch ):
You can’t perform that action at this time.
0 commit comments