From 80279c485eb240971b07e8952e2ec015fc88dcdb Mon Sep 17 00:00:00 2001 From: Itay Ziv Date: Fri, 25 Feb 2022 18:15:33 +0200 Subject: [PATCH 1/6] Change to always use canonical URL when ogp_site_url is unconfigured --- sphinxext/opengraph/__init__.py | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/sphinxext/opengraph/__init__.py b/sphinxext/opengraph/__init__.py index 542d954..97a866c 100644 --- a/sphinxext/opengraph/__init__.py +++ b/sphinxext/opengraph/__init__.py @@ -4,6 +4,7 @@ import docutils.nodes as nodes from sphinx.application import Sphinx +from sphinx.errors import ConfigError from .descriptionparser import get_description from .titleparser import get_title @@ -67,26 +68,15 @@ def get_tags( # type tag tags["og:type"] = config["ogp_type"] - if os.getenv("READTHEDOCS") and config["ogp_site_url"] is None: - # readthedocs uses html_baseurl for sphinx > 1.8 - parse_result = urlparse(config["html_baseurl"]) - + # url tag + # Get the canonical URL if ogp_site_url is not configured + if config["ogp_site_url"] is None: + # we require that either ogp_site_url or html_baseurl be configured if config["html_baseurl"] is None: - raise EnvironmentError("ReadTheDocs did not provide a valid canonical URL!") - - # Grab root url from canonical url - config["ogp_site_url"] = urlunparse( - ( - parse_result.scheme, - parse_result.netloc, - parse_result.path, - "", - "", - "", - ) - ) + raise ConfigError("A URL has not been configured and is required as per the OpenGraph Specification!") + + config["ogp_site_url"] = config["html_baseurl"] - # url tag # Get the URL of the specific page if context["builder"] == "dirhtml": page_url = urljoin(config["ogp_site_url"], context["pagename"] + "/") From b3fa1fb900398939301179f628c2bfbac737b6dd Mon Sep 17 00:00:00 2001 From: Itay Ziv Date: Fri, 25 Feb 2022 18:16:29 +0200 Subject: [PATCH 2/6] Run Black --- sphinxext/opengraph/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sphinxext/opengraph/__init__.py b/sphinxext/opengraph/__init__.py index 97a866c..c33654d 100644 --- a/sphinxext/opengraph/__init__.py +++ b/sphinxext/opengraph/__init__.py @@ -73,7 +73,9 @@ def get_tags( if config["ogp_site_url"] is None: # we require that either ogp_site_url or html_baseurl be configured if config["html_baseurl"] is None: - raise ConfigError("A URL has not been configured and is required as per the OpenGraph Specification!") + raise ConfigError( + "A URL has not been configured and is required as per the OpenGraph Specification!" + ) config["ogp_site_url"] = config["html_baseurl"] From a08f97a61841eebc3f5422db816581ebe949b5d2 Mon Sep 17 00:00:00 2001 From: Itay Ziv Date: Sun, 13 Mar 2022 20:38:43 +0200 Subject: [PATCH 3/6] Change error to info and update readme --- README.md | 26 +++++++++++++++----------- sphinxext/opengraph/__init__.py | 9 ++++++--- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 6adbc34..6c2f124 100644 --- a/README.md +++ b/README.md @@ -13,18 +13,22 @@ Just add `sphinxext.opengraph` to your extensions list in your `conf.py` ```python extensions = [ - "sphinxext.opengraph", + "sphinxext.opengraph", ] ``` ## Options These values are placed in the conf.py of your sphinx project. -Users hosting documentation on Read The Docs *do not* need to set any of the following unless custom configuration is wanted. The extension will automatically retrieve your site url. +Users hosting documentation on Read The Docs *do not* need to set any of the following unless custom configuration is wanted. RTD will automatically set`html_baseurl`. + +* `html_baseurl` + * Configure the canonical url in Sphinx, this is required unless `ogp_site_url` is provided. It should be set to the canonical URL the site is being hosted on. + * `ogp_site_url` - * This config option is very important, set it to the URL the site is being hosted on. + * Overrides `html_baseurl` for this extension, not required. If set should be the canonical URL the site is being hosted on. * `ogp_description_length` - * Configure the amount of characters taken from a page. The default of 200 is probably good for most people. If something other than a number is used, it defaults back to 200. + * Configure the amount of characters taken from a page. The default of 200 is probably good for most people. If something other than a number is used, it defaults back to 200. * `ogp_site_name` * This is not required. Name of the site. This is displayed above the title. * `ogp_image` @@ -37,7 +41,7 @@ Users hosting documentation on Read The Docs *do not* need to set any of the fol * This sets the ogp type attribute, for more information on the types available please take a look at https://ogp.me/#types. By default it is set to `website`, which should be fine for most use cases. * `ogp_custom_meta_tags` * This is not required. List of custom html snippets to insert. - + ## Example Config ### Simple Config @@ -70,17 +74,17 @@ Make sure you place the fields at the very start of the document such that Sphin These are some overrides that can be used, you can actually override any tag and field lists will always take priority. * `:og_description_length:` - * Configure the amount of characters to grab for the description of the page. If the value isn't a number it will fall back to `ogp_description_length`. Note the slightly different syntax because this isn't directly an OpenGraph tag. + * Configure the amount of characters to grab for the description of the page. If the value isn't a number it will fall back to `ogp_description_length`. Note the slightly different syntax because this isn't directly an OpenGraph tag. * `:og:description:` - * Lets you override the description of the page. + * Lets you override the description of the page. * `:og:title:` - * Lets you override the title of the page. + * Lets you override the title of the page. * `:og:type:` - * Override the type of the page, for the list of available types take a look at https://ogp.me/#types. + * Override the type of the page, for the list of available types take a look at https://ogp.me/#types. * `:ogp:image:` - * Set the image for the page.[^1] + * Set the image for the page.[^1] * `:ogp:image:alt:` - * Sets the alt text. Will be ignored if there is no image set. + * Sets the alt text. Will be ignored if there is no image set. ### Example Remember that the fields **must** be placed at the very start of the file. You can verify Sphinx has picked up the fields if they aren't shown in the final html file. diff --git a/sphinxext/opengraph/__init__.py b/sphinxext/opengraph/__init__.py index c33654d..47df9ad 100644 --- a/sphinxext/opengraph/__init__.py +++ b/sphinxext/opengraph/__init__.py @@ -5,12 +5,15 @@ import docutils.nodes as nodes from sphinx.application import Sphinx from sphinx.errors import ConfigError +from sphinx.util import logging from .descriptionparser import get_description from .titleparser import get_title import os +logger = logging.getLogger(__name__) + DEFAULT_DESCRIPTION_LENGTH = 200 @@ -71,10 +74,10 @@ def get_tags( # url tag # Get the canonical URL if ogp_site_url is not configured if config["ogp_site_url"] is None: - # we require that either ogp_site_url or html_baseurl be configured + # either ogp_site_url or html_baseurl should be configured if config["html_baseurl"] is None: - raise ConfigError( - "A URL has not been configured and is required as per the OpenGraph Specification!" + logger.info( + "A URL has not been configured and is required as per the OpenGraph Specification. Can be ignored if deploying in RTD environments." ) config["ogp_site_url"] = config["html_baseurl"] From a2b908fffb05ecda2640a04f1ed58cb8e753e9eb Mon Sep 17 00:00:00 2001 From: Itay Ziv Date: Sat, 19 Mar 2022 15:07:29 +0200 Subject: [PATCH 4/6] Update tests to use --- tests/roots/test-arbitrary-tags/conf.py | 2 +- tests/roots/test-custom-tags/conf.py | 2 +- tests/roots/test-description-length/conf.py | 2 +- tests/roots/test-double-spacing/conf.py | 2 +- tests/roots/test-first-image-no-image/conf.py | 2 +- tests/roots/test-first-image/conf.py | 2 +- tests/roots/test-image-rel-paths/conf.py | 2 +- tests/roots/test-image/conf.py | 2 +- tests/roots/test-list/conf.py | 2 +- tests/roots/test-local-image/conf.py | 2 +- tests/roots/test-nested-lists/conf.py | 2 +- .../conf.py | 3 ++ tests/roots/test-override-url/index.rst | 1 + tests/roots/test-overrides-complex/conf.py | 2 +- tests/roots/test-overrides-simple/conf.py | 2 +- tests/roots/test-quotation-marks/conf.py | 2 +- tests/roots/test-rtd-default/index.rst | 8 ---- tests/roots/test-rtd-invalid/conf.py | 6 --- tests/roots/test-rtd-invalid/index.rst | 8 ---- tests/roots/test-simple/conf.py | 2 +- tests/roots/test-sitename/conf.py | 2 +- tests/roots/test-skip-admonitions/conf.py | 2 +- tests/roots/test-skip-code-block/conf.py | 2 +- tests/roots/test-skip-comments/conf.py | 2 +- tests/roots/test-skip-raw/conf.py | 2 +- tests/roots/test-skip-title/conf.py | 2 +- tests/roots/test-type/conf.py | 2 +- tests/test_options.py | 38 +++---------------- 28 files changed, 31 insertions(+), 77 deletions(-) rename tests/roots/{test-rtd-default => test-override-url}/conf.py (53%) create mode 100644 tests/roots/test-override-url/index.rst delete mode 100644 tests/roots/test-rtd-default/index.rst delete mode 100644 tests/roots/test-rtd-invalid/conf.py delete mode 100644 tests/roots/test-rtd-invalid/index.rst diff --git a/tests/roots/test-arbitrary-tags/conf.py b/tests/roots/test-arbitrary-tags/conf.py index f7f742a..863b319 100644 --- a/tests/roots/test-arbitrary-tags/conf.py +++ b/tests/roots/test-arbitrary-tags/conf.py @@ -5,4 +5,4 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" diff --git a/tests/roots/test-custom-tags/conf.py b/tests/roots/test-custom-tags/conf.py index 1deded7..5980c62 100644 --- a/tests/roots/test-custom-tags/conf.py +++ b/tests/roots/test-custom-tags/conf.py @@ -5,7 +5,7 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_custom_meta_tags = [ '', diff --git a/tests/roots/test-description-length/conf.py b/tests/roots/test-description-length/conf.py index fabe335..40ef496 100644 --- a/tests/roots/test-description-length/conf.py +++ b/tests/roots/test-description-length/conf.py @@ -5,5 +5,5 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_description_length = 50 diff --git a/tests/roots/test-double-spacing/conf.py b/tests/roots/test-double-spacing/conf.py index f7f742a..863b319 100644 --- a/tests/roots/test-double-spacing/conf.py +++ b/tests/roots/test-double-spacing/conf.py @@ -5,4 +5,4 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" diff --git a/tests/roots/test-first-image-no-image/conf.py b/tests/roots/test-first-image-no-image/conf.py index a492090..6b5851e 100644 --- a/tests/roots/test-first-image-no-image/conf.py +++ b/tests/roots/test-first-image-no-image/conf.py @@ -6,7 +6,7 @@ html_theme = "basic" ogp_site_name = "Example's Docs!" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_image = "http://example.org/en/latest/image33.png" ogp_image_alt = "TEST" ogp_use_first_image = True diff --git a/tests/roots/test-first-image/conf.py b/tests/roots/test-first-image/conf.py index a492090..6b5851e 100644 --- a/tests/roots/test-first-image/conf.py +++ b/tests/roots/test-first-image/conf.py @@ -6,7 +6,7 @@ html_theme = "basic" ogp_site_name = "Example's Docs!" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_image = "http://example.org/en/latest/image33.png" ogp_image_alt = "TEST" ogp_use_first_image = True diff --git a/tests/roots/test-image-rel-paths/conf.py b/tests/roots/test-image-rel-paths/conf.py index a6759bd..e9d12b2 100644 --- a/tests/roots/test-image-rel-paths/conf.py +++ b/tests/roots/test-image-rel-paths/conf.py @@ -6,5 +6,5 @@ html_theme = "basic" ogp_site_name = "Example's Docs!" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_use_first_image = True diff --git a/tests/roots/test-image/conf.py b/tests/roots/test-image/conf.py index 8731182..ffe4244 100644 --- a/tests/roots/test-image/conf.py +++ b/tests/roots/test-image/conf.py @@ -6,5 +6,5 @@ html_theme = "basic" ogp_site_name = "Example's Docs!" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_image = "http://example.org/en/latest/image.png" diff --git a/tests/roots/test-list/conf.py b/tests/roots/test-list/conf.py index f7f742a..863b319 100644 --- a/tests/roots/test-list/conf.py +++ b/tests/roots/test-list/conf.py @@ -5,4 +5,4 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" diff --git a/tests/roots/test-local-image/conf.py b/tests/roots/test-local-image/conf.py index c18a8d1..c387a87 100644 --- a/tests/roots/test-local-image/conf.py +++ b/tests/roots/test-local-image/conf.py @@ -6,5 +6,5 @@ html_theme = "basic" ogp_site_name = "Example's Docs!" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_image = "_static/sample.jpg" diff --git a/tests/roots/test-nested-lists/conf.py b/tests/roots/test-nested-lists/conf.py index f7f742a..863b319 100644 --- a/tests/roots/test-nested-lists/conf.py +++ b/tests/roots/test-nested-lists/conf.py @@ -5,4 +5,4 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" diff --git a/tests/roots/test-rtd-default/conf.py b/tests/roots/test-override-url/conf.py similarity index 53% rename from tests/roots/test-rtd-default/conf.py rename to tests/roots/test-override-url/conf.py index 7f99bb3..038e348 100644 --- a/tests/roots/test-rtd-default/conf.py +++ b/tests/roots/test-override-url/conf.py @@ -4,3 +4,6 @@ exclude_patterns = ["_build"] html_theme = "basic" + +html_baseurl = "http://example.org/en/latest/" +ogp_site_url = "https://example.com/en/stable/" diff --git a/tests/roots/test-override-url/index.rst b/tests/roots/test-override-url/index.rst new file mode 100644 index 0000000..a33871d --- /dev/null +++ b/tests/roots/test-override-url/index.rst @@ -0,0 +1 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at lorem ornare, fringilla massa nec, venenatis mi. Donec erat sapien, tincidunt nec rhoncus nec, scelerisque id diam. Orci varius natoque penatibus et magnis dis parturient mauris. \ No newline at end of file diff --git a/tests/roots/test-overrides-complex/conf.py b/tests/roots/test-overrides-complex/conf.py index e924f97..5a2b254 100644 --- a/tests/roots/test-overrides-complex/conf.py +++ b/tests/roots/test-overrides-complex/conf.py @@ -6,5 +6,5 @@ html_theme = "basic" ogp_site_name = "Example's Docs!" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_image_alt = "Example Alt Text" diff --git a/tests/roots/test-overrides-simple/conf.py b/tests/roots/test-overrides-simple/conf.py index 04b6d13..a67bdc2 100644 --- a/tests/roots/test-overrides-simple/conf.py +++ b/tests/roots/test-overrides-simple/conf.py @@ -6,6 +6,6 @@ html_theme = "basic" ogp_site_name = "Example's Docs!" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_image = "http://example.org/en/latest/image.png" ogp_type = "book" diff --git a/tests/roots/test-quotation-marks/conf.py b/tests/roots/test-quotation-marks/conf.py index 0087204..84309b0 100644 --- a/tests/roots/test-quotation-marks/conf.py +++ b/tests/roots/test-quotation-marks/conf.py @@ -7,4 +7,4 @@ smartquotes = False -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" diff --git a/tests/roots/test-rtd-default/index.rst b/tests/roots/test-rtd-default/index.rst deleted file mode 100644 index 634fe79..0000000 --- a/tests/roots/test-rtd-default/index.rst +++ /dev/null @@ -1,8 +0,0 @@ -* Item 1 -* Item 2 - - * Nested Item 1 - * Nested Item 2 - -* Item 3 -* Item 4 \ No newline at end of file diff --git a/tests/roots/test-rtd-invalid/conf.py b/tests/roots/test-rtd-invalid/conf.py deleted file mode 100644 index 7f99bb3..0000000 --- a/tests/roots/test-rtd-invalid/conf.py +++ /dev/null @@ -1,6 +0,0 @@ -extensions = ["sphinxext.opengraph"] - -master_doc = "index" -exclude_patterns = ["_build"] - -html_theme = "basic" diff --git a/tests/roots/test-rtd-invalid/index.rst b/tests/roots/test-rtd-invalid/index.rst deleted file mode 100644 index 634fe79..0000000 --- a/tests/roots/test-rtd-invalid/index.rst +++ /dev/null @@ -1,8 +0,0 @@ -* Item 1 -* Item 2 - - * Nested Item 1 - * Nested Item 2 - -* Item 3 -* Item 4 \ No newline at end of file diff --git a/tests/roots/test-simple/conf.py b/tests/roots/test-simple/conf.py index f7f742a..863b319 100644 --- a/tests/roots/test-simple/conf.py +++ b/tests/roots/test-simple/conf.py @@ -5,4 +5,4 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" diff --git a/tests/roots/test-sitename/conf.py b/tests/roots/test-sitename/conf.py index e3009f7..d620262 100644 --- a/tests/roots/test-sitename/conf.py +++ b/tests/roots/test-sitename/conf.py @@ -5,5 +5,5 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_site_name = "Example's Docs!" diff --git a/tests/roots/test-skip-admonitions/conf.py b/tests/roots/test-skip-admonitions/conf.py index f7f742a..863b319 100644 --- a/tests/roots/test-skip-admonitions/conf.py +++ b/tests/roots/test-skip-admonitions/conf.py @@ -5,4 +5,4 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" diff --git a/tests/roots/test-skip-code-block/conf.py b/tests/roots/test-skip-code-block/conf.py index 79ec2e8..dae103f 100644 --- a/tests/roots/test-skip-code-block/conf.py +++ b/tests/roots/test-skip-code-block/conf.py @@ -5,5 +5,5 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_description_length = 100 diff --git a/tests/roots/test-skip-comments/conf.py b/tests/roots/test-skip-comments/conf.py index f7f742a..863b319 100644 --- a/tests/roots/test-skip-comments/conf.py +++ b/tests/roots/test-skip-comments/conf.py @@ -5,4 +5,4 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" diff --git a/tests/roots/test-skip-raw/conf.py b/tests/roots/test-skip-raw/conf.py index 79ec2e8..dae103f 100644 --- a/tests/roots/test-skip-raw/conf.py +++ b/tests/roots/test-skip-raw/conf.py @@ -5,5 +5,5 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_description_length = 100 diff --git a/tests/roots/test-skip-title/conf.py b/tests/roots/test-skip-title/conf.py index f7f742a..863b319 100644 --- a/tests/roots/test-skip-title/conf.py +++ b/tests/roots/test-skip-title/conf.py @@ -5,4 +5,4 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" diff --git a/tests/roots/test-type/conf.py b/tests/roots/test-type/conf.py index ecb20bd..77fd2ce 100644 --- a/tests/roots/test-type/conf.py +++ b/tests/roots/test-type/conf.py @@ -5,5 +5,5 @@ html_theme = "basic" -ogp_site_url = "http://example.org/en/latest/" +html_baseurl = "http://example.org/en/latest/" ogp_type = "article" diff --git a/tests/test_options.py b/tests/test_options.py index 06ad32e..d89233f 100644 --- a/tests/test_options.py +++ b/tests/test_options.py @@ -40,6 +40,11 @@ def test_dirhtml_url(og_meta_tags): assert get_tag_content(og_meta_tags, "url") == "http://example.org/en/latest/index/" +@pytest.mark.sphinx("html", testroot="override-url") +def test_override_url(og_meta_tags): + assert get_tag_content(og_meta_tags, "url") == "https://example.com/en/stable/index.html" + + @pytest.mark.sphinx("html", testroot="image") def test_image(og_meta_tags): assert ( @@ -215,36 +220,3 @@ def test_arbitrary_tags(og_meta_tags): == "http://example.org/en/latest/video.mp4" ) assert get_tag_content(og_meta_tags, "video:type") == "video/mp4" - - -# use same as simple, as configuration is identical to overriden -@pytest.mark.sphinx("html", testroot="simple") -def test_rtd_override(app: Sphinx, monkeypatch): - monkeypatch.setenv("READTHEDOCS", "True") - app.config.html_baseurl = "https://failure.com/en/latest/" - - app.build() - tags = conftest._og_meta_tags(app) - - assert get_tag_content(tags, "url") == "http://example.org/en/latest/index.html" - - -@pytest.mark.sphinx("html", testroot="rtd-default") -def test_rtd_valid(app: Sphinx, monkeypatch): - monkeypatch.setenv("READTHEDOCS", "True") - app.config.html_baseurl = "https://failure.com/en/latest/" - - app.build() - tags = conftest._og_meta_tags(app) - - assert get_tag_content(tags, "url") == "https://failure.com/en/latest/index.html" - - -# use rtd-default, as we are not changing configuration, but RTD variables -@pytest.mark.sphinx("html", testroot="rtd-invalid") -def test_rtd_invalid(app: Sphinx, monkeypatch): - monkeypatch.setenv("READTHEDOCS", "True") - app.config.html_baseurl = None - - with pytest.raises(Exception): - app.build() From 8ab96b7e6e9a3278f1ff67b7d790572f1f09331a Mon Sep 17 00:00:00 2001 From: Itay Ziv Date: Sat, 19 Mar 2022 15:09:10 +0200 Subject: [PATCH 5/6] Update logger message to include extension name --- sphinxext/opengraph/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinxext/opengraph/__init__.py b/sphinxext/opengraph/__init__.py index a238052..6d2e28f 100644 --- a/sphinxext/opengraph/__init__.py +++ b/sphinxext/opengraph/__init__.py @@ -77,7 +77,7 @@ def get_tags( # either ogp_site_url or html_baseurl should be configured if config["html_baseurl"] is None: logger.info( - "A URL has not been configured and is required as per the OpenGraph Specification. Can be ignored if deploying in RTD environments." + "sphinxext-opengrpah: A URL has not been configured and is required as per the OpenGraph Specification. Can be ignored if deploying in RTD environments." ) config["ogp_site_url"] = config["html_baseurl"] From 3d436363bf8927fe3885d991ad2d2067cc7f3891 Mon Sep 17 00:00:00 2001 From: Itay Ziv Date: Sat, 19 Mar 2022 15:10:25 +0200 Subject: [PATCH 6/6] Run black --- tests/test_options.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_options.py b/tests/test_options.py index d89233f..2a2dc8b 100644 --- a/tests/test_options.py +++ b/tests/test_options.py @@ -42,7 +42,10 @@ def test_dirhtml_url(og_meta_tags): @pytest.mark.sphinx("html", testroot="override-url") def test_override_url(og_meta_tags): - assert get_tag_content(og_meta_tags, "url") == "https://example.com/en/stable/index.html" + assert ( + get_tag_content(og_meta_tags, "url") + == "https://example.com/en/stable/index.html" + ) @pytest.mark.sphinx("html", testroot="image")