diff --git a/docs/source/conf.py b/docs/source/conf.py index 05cc84d..ee638f3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -44,8 +44,6 @@ # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [] -# Generate tags. -enable_meta_description = True # -- Options for HTML output ------------------------------------------------- diff --git a/sphinxext/opengraph/__init__.py b/sphinxext/opengraph/__init__.py index 2832f6a..e955b22 100644 --- a/sphinxext/opengraph/__init__.py +++ b/sphinxext/opengraph/__init__.py @@ -28,10 +28,10 @@ } -def make_tag(property: str, content: str, type_: str = "property") -> str: +def make_tag(property: str, content: str) -> str: # Parse quotation, so they won't break html tags if smart quotes are disabled content = content.replace('"', """) - return f'\n ' + return f'\n ' def get_tags( @@ -104,10 +104,6 @@ def get_tags( # description tag if description: tags["og:description"] = description - if config["enable_meta_description"]: - config["ogp_custom_meta_tags"].append( - make_tag("description", description, "name") - ) # image tag # Get basic values from config @@ -187,7 +183,6 @@ def setup(app: Sphinx) -> Dict[str, Any]: app.add_config_value("ogp_type", "website", "html") app.add_config_value("ogp_site_name", None, "html") app.add_config_value("ogp_custom_meta_tags", [], "html") - app.add_config_value("enable_meta_description", False, "html") app.connect("html-page-context", html_page_context) diff --git a/tests/roots/test-meta-name-description/conf.py b/tests/roots/test-meta-name-description/conf.py deleted file mode 100644 index b31eaac..0000000 --- a/tests/roots/test-meta-name-description/conf.py +++ /dev/null @@ -1,10 +0,0 @@ -extensions = ["sphinxext.opengraph"] - -master_doc = "index" -exclude_patterns = ["_build"] - -html_theme = "basic" - -ogp_site_url = "http://example.org/en/latest/" - -enable_meta_description = True diff --git a/tests/roots/test-meta-name-description/index.rst b/tests/roots/test-meta-name-description/index.rst deleted file mode 100644 index a33871d..0000000 --- a/tests/roots/test-meta-name-description/index.rst +++ /dev/null @@ -1 +0,0 @@ -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/test_options.py b/tests/test_options.py index 9f31ea6..06ad32e 100644 --- a/tests/test_options.py +++ b/tests/test_options.py @@ -1,6 +1,7 @@ import pytest from sphinx.application import Sphinx import conftest +import os def get_tag(tags, tag_type): @@ -25,16 +26,6 @@ def test_simple(og_meta_tags): ) -@pytest.mark.sphinx("html", testroot="meta-name-description") -def test_meta_name_description(meta_tags): - og_description = get_tag_content(meta_tags, "description") - description = [tag for tag in meta_tags if tag.get("name") == "description"][0].get( - "content", "" - ) - - assert og_description == description - - @pytest.mark.sphinx("html", testroot="simple") def test_site_url(og_meta_tags): # Uses the same directory as simple, because it already contains url for a minimal config