From 7fdc8358327f1d477a11bba6cc3054008413250a Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Tue, 29 Jan 2019 19:34:16 +0000
Subject: [PATCH] devhelp2man: Add minimal support for older gtk-doc versions

This doesn't screen-scrape out the full description of the function,
but it gets the name of the man page right, which is enough to make
the build not fail.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 doc/devhelp2man.xslt | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/devhelp2man.xslt b/doc/devhelp2man.xslt
index 38079c153..974bf144c 100644
--- a/doc/devhelp2man.xslt
+++ b/doc/devhelp2man.xslt
@@ -85,6 +85,16 @@ License along with libcapsule.  If not, see <http://www.gnu.org/licenses/>.
     </xsl:if>
   </xsl:template>
 
+  <xsl:template match="refsynopsisdiv/synopsis/link" mode="refnamediv">
+    <xsl:param name="matched" select="."/>
+    <xsl:if test="$matched = $target">
+      <xsl:element name="refname">
+        <xsl:value-of select="."/>
+      </xsl:element>
+      <xsl:apply-templates/>
+    </xsl:if>
+  </xsl:template>
+
   <xsl:template name="paramdef" match="parameter" mode="funcsig">
     <xsl:param name="tok"   select="string:tokenize(., ' ')"/>
     <xsl:param name="last"  select="ext:node-set($tok)[last()]"/>
@@ -157,7 +167,14 @@ License along with libcapsule.  If not, see <http://www.gnu.org/licenses/>.
         </xsl:element>
       </xsl:element>
       <xsl:element name="refnamediv">
-        <xsl:apply-templates select="refsect1[@role='functions_proto']"/>
+        <xsl:choose>
+          <xsl:when test="refsect1[@role='functions_proto']">
+            <xsl:apply-templates select="refsect1[@role='functions_proto']"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates select="refsynopsisdiv[@role='synopsis']" mode="refnamediv"/>
+          </xsl:otherwise>
+        </xsl:choose>
       </xsl:element>
       <xsl:element name="refsynopsisdiv">
         <xsl:element name="funcsynopsis">
-- 
GitLab