File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -2093,3 +2093,40 @@ def test_local_pdf_file(
20932093 tmp_path = tmp_path ,
20942094 extensions = ("sphinx_notion" ,),
20952095 )
2096+
2097+
2098+ def test_pdf_with_html (
2099+ * ,
2100+ make_app : Callable [..., SphinxTestApp ],
2101+ tmp_path : Path ,
2102+ ) -> None :
2103+ """
2104+ PDF directives with HTML output are processed correctly.
2105+ """
2106+ rst_content = """
2107+ .. pdf-include:: https://www.example.com/path/to/document.pdf
2108+ """
2109+ srcdir = tmp_path / "src"
2110+ srcdir .mkdir ()
2111+ (srcdir / "conf.py" ).touch ()
2112+ test_pdf_path = srcdir / "test_document.pdf"
2113+ # Create a minimal PDF file (just some dummy data)
2114+ test_pdf_path .write_bytes (data = b"fake pdf content" )
2115+ (srcdir / "index.rst" ).write_text (data = rst_content )
2116+ extensions = ("sphinx_notion" , "sphinx_simplepdf" )
2117+ app = make_app (
2118+ srcdir = srcdir ,
2119+ builddir = tmp_path / "build" ,
2120+ buildername = "html" ,
2121+ confoverrides = {"extensions" : list (extensions )},
2122+ )
2123+ app .build ()
2124+ assert app .statuscode == 0
2125+ index_html = (tmp_path / "build" / "html" / "index.html" ).read_text ()
2126+ expected_iframe = (
2127+ "<iframe "
2128+ 'src="https://www.example.com/path/to/document.pdf" '
2129+ 'style="height: 400px; width: 100%">'
2130+ "</iframe>"
2131+ )
2132+ assert expected_iframe in index_html
You can’t perform that action at this time.
0 commit comments