chiark / gitweb /
doxygen: support image links.
authorVladimír Vondruš <mosra@centrum.cz>
Fri, 22 Feb 2019 18:00:44 +0000 (19:00 +0100)
committerVladimír Vondruš <mosra@centrum.cz>
Sat, 23 Feb 2019 00:09:59 +0000 (01:09 +0100)
Yay? Nah. It's still crappy, you still can't have \image inside \ref.

doxygen/dox2html5.py
doxygen/test/contents_image/imagelink.html [new file with mode: 0644]
doxygen/test/contents_image/input.dox
doxygen/test/test_contents.py

index ba43f27ae5556d3452e95abe61b22e1bba7709aa..01b90fb9253e5a623c2adf0d2b8409471d6c306d 100755 (executable)
@@ -1200,7 +1200,7 @@ def parse_desc_internal(state: State, element: ET.Element, immediate_parent: ET.
             out.parsed += '<pre>{}</pre>'.format(html.escape(i.text or ''))
 
         elif i.tag == 'image':
-            assert element.tag in ['para', '{http://mcss.mosra.cz/doxygen/}div']
+            assert element.tag in ['para', '{http://mcss.mosra.cz/doxygen/}div', 'ulink']
             has_block_elements = True
 
             name = i.attrib['name']
diff --git a/doxygen/test/contents_image/imagelink.html b/doxygen/test/contents_image/imagelink.html
new file mode 100644 (file)
index 0000000..d8e5ff2
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+  <meta charset="UTF-8" />
+  <title>Image link | My Project</title>
+  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+  <link rel="stylesheet" href="m-dark+doxygen.compiled.css" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+  <div class="m-container">
+    <div class="m-row">
+      <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+    </div>
+  </div>
+</nav></header>
+<main><article>
+  <div class="m-container m-container-inflatable">
+    <div class="m-row">
+      <div class="m-col-l-10 m-push-l-1">
+        <h1>
+          Image link
+        </h1>
+<p>Broken in 1.8.15 and below.</p><p><a href="https://mcss.mosra.cz"><img class="m-image" src="tiny.png" alt="Image" /></a></p>
+      </div>
+    </div>
+  </div>
+</article></main>
+</body>
+</html>
index 736ce2a8642a561efd482f84405ca89cf756af13..3ab8fd969ac48f59728a202c2e0471f5e8f31f7f 100644 (file)
@@ -25,3 +25,11 @@ Image that doesn't exist:
 @image html nonexistent.png
 
 */
+
+/** @page imagelink Image link
+
+Broken in 1.8.15 and below.
+
+<a href="https://mcss.mosra.cz"><img src="tiny.png" /></a>
+
+*/
index 607818d916d1c0d7654c2cec277d17d5b5c60e08..f3928360f9557f85c4cce79c73a71115f3753ac8 100644 (file)
@@ -117,6 +117,12 @@ class Image(IntegrationTestCase):
         self.run_dox2html5(wildcard='warnings.xml')
         self.assertEqual(*self.actual_expected_contents('warnings.html'))
 
+    @unittest.skipUnless(LooseVersion(doxygen_version()) > LooseVersion("1.8.15"),
+                         "fully fixed after 1:8.15")
+    def test_imagelink(self):
+        self.run_dox2html5(wildcard='imagelink.xml')
+        self.assertEqual(*self.actual_expected_contents('imagelink.html'))
+
 class Math(IntegrationTestCase):
     def __init__(self, *args, **kwargs):
         super().__init__(__file__, 'math', *args, **kwargs)