On Mar 01, 2022 at 18:27, Brar Piening wrote:
On Feb 28, 2022 at 21:06, Chapman Flack wrote:
I think that in other recent examples I've seen, there might be
(something like a) consensus forming around the Unicode LINK SYMBOL
🔗 rather than # as the symbol for such things.

I intentionally opted for an ASCII character as that definitely won't
cause any display/font/portability issues but changing that is no
problem.

TBH I don't like the visual representation of the unicode link symbol
(U+1F517) in my browser. It's a bold black fat thing that doesn't
inherit colors. I've tried to soften it by decreasing the size but that
doesn't really solve it for me. Font support also doesn't seem
overwhelming. Anyway, I've changed my patch to use it so that you can
judge it yourself.

... and now that the concept is proven, how hard would it be to broaden
that template's pattern to apply to all the other DocBook constructs
(such as section headings) that emit anchors?

As long as we stick to manually assigned ids in the same way my patch
does it, it shouldn't be too hard.

Patch is attached. I don't think it should get applied this way, though.
The fact that you only get links for section headers that have manually
assigned ids would be pretty surprising for users of the docs and in
some files (e.g. protocol-flow.html) only every other section has a
manually assigned id. It would be easy to emit a message (or even fail)
whenever the template fails to find an id and then manually assign ids
until they are everywhere (currently that means all varlistentries and
sections) but that would a) be quite some work and b) make the patch
quite heavy, so I wouldn't even start this before there is really
consensus that this is the right direction.
diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml
index 1c5ab00879..cb138b53ad 100644
--- a/doc/src/sgml/protocol.sgml
+++ b/doc/src/sgml/protocol.sgml
@@ -1810,7 +1810,7 @@ Replication commands are logged in the server log when
 <para>
 The commands accepted in replication mode are:
 <variablelist>
-  <varlistentry>
+  <varlistentry id="protocol-replication-identify-system">
     <term><literal>IDENTIFY_SYSTEM</literal>
      <indexterm><primary>IDENTIFY_SYSTEM</primary></indexterm>
     </term>
@@ -1875,7 +1875,7 @@ The commands accepted in replication mode are:
     </listitem>
   </varlistentry>
 
-  <varlistentry>
+  <varlistentry id="protocol-replication-show">
     <term><literal>SHOW</literal> <replaceable 
class="parameter">name</replaceable>
      <indexterm><primary>SHOW</primary></indexterm>
     </term>
@@ -1899,7 +1899,7 @@ The commands accepted in replication mode are:
     </listitem>
   </varlistentry>
 
-  <varlistentry>
+  <varlistentry id="protocol-replication-timeline-history">
     <term><literal>TIMELINE_HISTORY</literal> <replaceable 
class="parameter">tli</replaceable>
      <indexterm><primary>TIMELINE_HISTORY</primary></indexterm>
     </term>
@@ -2084,7 +2084,7 @@ The commands accepted in replication mode are:
     </listitem>
   </varlistentry>
 
-  <varlistentry>
+  <varlistentry id="protocol-replication-create-slot-legacy">
     <term><literal>CREATE_REPLICATION_SLOT</literal> <replaceable 
class="parameter">slot_name</replaceable> [ <literal>TEMPORARY</literal> ] { 
<literal>PHYSICAL</literal> [ <literal>RESERVE_WAL</literal> ] | 
<literal>LOGICAL</literal> <replaceable 
class="parameter">output_plugin</replaceable> [ 
<literal>EXPORT_SNAPSHOT</literal> | <literal>NOEXPORT_SNAPSHOT</literal> | 
<literal>USE_SNAPSHOT</literal> | <literal>TWO_PHASE</literal> ] }
     </term>
     <listitem>
@@ -2095,7 +2095,7 @@ The commands accepted in replication mode are:
     </listitem>
   </varlistentry>
 
-  <varlistentry>
+  <varlistentry id="protocol-replication-read-replication-slot">
     <term><literal>READ_REPLICATION_SLOT</literal> <replaceable 
class="parameter">slot_name</replaceable>
       <indexterm><primary>READ_REPLICATION_SLOT</primary></indexterm>
     </term>
@@ -2143,7 +2143,7 @@ The commands accepted in replication mode are:
     </listitem>
   </varlistentry>
 
-  <varlistentry>
+  <varlistentry id="protocol-replication-start-replication">
     <term><literal>START_REPLICATION</literal> [ <literal>SLOT</literal> 
<replaceable class="parameter">slot_name</replaceable> ] [ 
<literal>PHYSICAL</literal> ] <replaceable 
class="parameter">XXX/XXX</replaceable> [ <literal>TIMELINE</literal> 
<replaceable class="parameter">tli</replaceable> ]
      <indexterm><primary>START_REPLICATION</primary></indexterm>
     </term>
@@ -2201,7 +2201,7 @@ The commands accepted in replication mode are:
 
      <para>
       <variablelist>
-      <varlistentry>
+      <varlistentry id="protocol-replication-xlogdata">
       <term>
           XLogData (B)
       </term>
@@ -2270,7 +2270,7 @@ The commands accepted in replication mode are:
       </para>
       </listitem>
       </varlistentry>
-      <varlistentry>
+      <varlistentry id="protocol-replication-primary-keepalive-message">
       <term>
           Primary keepalive message (B)
       </term>
@@ -2334,7 +2334,7 @@ The commands accepted in replication mode are:
 
      <para>
       <variablelist>
-      <varlistentry>
+      <varlistentry id="protocol-replication-standby-status-update">
       <term>
           Standby status update (F)
       </term>
@@ -2415,7 +2415,7 @@ The commands accepted in replication mode are:
 
      <para>
       <variablelist>
-      <varlistentry>
+      <varlistentry id="protocol-replication-hot-standby-feedback-message">
       <term>
           Hot Standby feedback message (F)
       </term>
@@ -2497,7 +2497,7 @@ The commands accepted in replication mode are:
      </para>
     </listitem>
   </varlistentry>
-  <varlistentry>
+  <varlistentry id="protocol-replication-start-replication-slot-logical">
     <term><literal>START_REPLICATION</literal> <literal>SLOT</literal> 
<replaceable class="parameter">slot_name</replaceable> 
<literal>LOGICAL</literal> <replaceable class="parameter">XXX/XXX</replaceable> 
[ ( <replaceable>option_name</replaceable> [ 
<replaceable>option_value</replaceable> ] [, ...] ) ]</term>
     <listitem>
      <para>
@@ -2572,7 +2572,7 @@ The commands accepted in replication mode are:
     </listitem>
   </varlistentry>
 
-  <varlistentry>
+  <varlistentry id="protocol-replication-drop-replication-slot">
     <term>
      <literal>DROP_REPLICATION_SLOT</literal> <replaceable 
class="parameter">slot_name</replaceable> <optional> <literal>WAIT</literal> 
</optional>
      <indexterm><primary>DROP_REPLICATION_SLOT</primary></indexterm>
@@ -3266,7 +3266,7 @@ of any individual CopyData message cannot be 
interpretable on their own.)
 <variablelist>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-authenticationok">
 <term>
 AuthenticationOk (B)
 </term>
@@ -3311,7 +3311,7 @@ AuthenticationOk (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-authenticationkerberosv5">
 <term>
 AuthenticationKerberosV5 (B)
 </term>
@@ -3355,7 +3355,7 @@ AuthenticationKerberosV5 (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-authenticationcleartextpassword">
 <term>
 AuthenticationCleartextPassword (B)
 </term>
@@ -3399,7 +3399,7 @@ AuthenticationCleartextPassword (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-authenticationmd5password">
 <term>
 AuthenticationMD5Password (B)
 </term>
@@ -3454,7 +3454,7 @@ AuthenticationMD5Password (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-authenticationscmcredential">
 <term>
 AuthenticationSCMCredential (B)
 </term>
@@ -3499,7 +3499,7 @@ AuthenticationSCMCredential (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-authenticationgss">
 <term>
 AuthenticationGSS (B)
 </term>
@@ -3544,7 +3544,7 @@ AuthenticationGSS (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-authenticationgsscontinue">
 <term>
 AuthenticationGSSContinue (B)
 </term>
@@ -3599,7 +3599,7 @@ AuthenticationGSSContinue (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-authenticationsspi">
 <term>
 AuthenticationSSPI (B)
 </term>
@@ -3644,7 +3644,7 @@ AuthenticationSSPI (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-authenticationsasl">
 <term>
 AuthenticationSASL (B)
 </term>
@@ -3705,7 +3705,7 @@ following:
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-authenticationsaslcontinue">
 <term>
 AuthenticationSASLContinue (B)
 </term>
@@ -3760,7 +3760,7 @@ AuthenticationSASLContinue (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-authenticationsaslfinal">
 <term>
 AuthenticationSASLFinal (B)
 </term>
@@ -3816,7 +3816,7 @@ AuthenticationSASLFinal (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-backendkeydata">
 <term>
 BackendKeyData (B)
 </term>
@@ -3873,7 +3873,7 @@ BackendKeyData (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-bind">
 <term>
 Bind (F)
 </term>
@@ -4026,7 +4026,7 @@ Bind (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-bindcomplete">
 <term>
 BindComplete (B)
 </term>
@@ -4061,7 +4061,7 @@ BindComplete (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-cancelrequest">
 <term>
 CancelRequest (F)
 </term>
@@ -4119,7 +4119,7 @@ CancelRequest (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-close">
 <term>
 Close (F)
 </term>
@@ -4176,7 +4176,7 @@ Close (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-closecomplete">
 <term>
 CloseComplete (B)
 </term>
@@ -4211,7 +4211,7 @@ CloseComplete (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-commandcomplete">
 <term>
 CommandComplete (B)
 </term>
@@ -4310,7 +4310,7 @@ CommandComplete (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-copydata">
 <term>
 CopyData (F &amp; B)
 </term>
@@ -4356,7 +4356,7 @@ CopyData (F &amp; B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-copydone">
 <term>
 CopyDone (F &amp; B)
 </term>
@@ -4391,7 +4391,7 @@ CopyDone (F &amp; B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-copyfail">
 <term>
 CopyFail (F)
 </term>
@@ -4436,7 +4436,7 @@ CopyFail (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-copyinresponse">
 <term>
 CopyInResponse (B)
 </term>
@@ -4512,7 +4512,7 @@ CopyInResponse (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-copyoutresponse">
 <term>
 CopyOutResponse (B)
 </term>
@@ -4585,7 +4585,7 @@ CopyOutResponse (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-copybothresponse">
 <term>
 CopyBothResponse (B)
 </term>
@@ -4658,7 +4658,7 @@ CopyBothResponse (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-datarow">
 <term>
 DataRow (B)
 </term>
@@ -4730,7 +4730,7 @@ DataRow (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-describe">
 <term>
 Describe (F)
 </term>
@@ -4787,7 +4787,7 @@ Describe (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-emptyqueryresponse">
 <term>
 EmptyQueryResponse (B)
 </term>
@@ -4823,7 +4823,7 @@ EmptyQueryResponse (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-errorresponse">
 <term>
 ErrorResponse (B)
 </term>
@@ -4889,7 +4889,7 @@ ErrorResponse (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-execute">
 <term>
 Execute (F)
 </term>
@@ -4946,7 +4946,7 @@ Execute (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-flush">
 <term>
 Flush (F)
 </term>
@@ -4981,7 +4981,7 @@ Flush (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-functioncall">
 <term>
 FunctionCall (F)
 </term>
@@ -5106,7 +5106,7 @@ FunctionCall (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-functioncallresponse">
 <term>
 FunctionCallResponse (B)
 </term>
@@ -5166,7 +5166,7 @@ FunctionCallResponse (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-gssencrequest">
 <term>
 GSSENCRequest (F)
 </term>
@@ -5204,7 +5204,7 @@ GSSENCRequest (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-gssresponse">
 <term>
 GSSResponse (F)
 </term>
@@ -5249,7 +5249,7 @@ GSSResponse (F)
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-negotiateprotocolversion">
 <term>
 NegotiateProtocolVersion (B)
 </term>
@@ -5318,7 +5318,7 @@ NegotiateProtocolVersion (B)
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-nodata">
 <term>
 NoData (B)
 </term>
@@ -5353,7 +5353,7 @@ NoData (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-noticeresponse">
 <term>
 NoticeResponse (B)
 </term>
@@ -5419,7 +5419,7 @@ NoticeResponse (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-notificationresponse">
 <term>
 NotificationResponse (B)
 </term>
@@ -5484,7 +5484,7 @@ NotificationResponse (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-parameterdescription">
 <term>
 ParameterDescription (B)
 </term>
@@ -5542,7 +5542,7 @@ ParameterDescription (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-parameterstatus">
 <term>
 ParameterStatus (B)
 </term>
@@ -5596,7 +5596,7 @@ ParameterStatus (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-parse">
 <term>
 Parse (F)
 </term>
@@ -5680,7 +5680,7 @@ Parse (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-parsecomplete">
 <term>
 ParseComplete (B)
 </term>
@@ -5715,7 +5715,7 @@ ParseComplete (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-passwordmessage">
 <term>
 PasswordMessage (F)
 </term>
@@ -5761,7 +5761,7 @@ PasswordMessage (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-portalsuspended">
 <term>
 PortalSuspended (B)
 </term>
@@ -5798,7 +5798,7 @@ PortalSuspended (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-query">
 <term>
 Query (F)
 </term>
@@ -5843,7 +5843,7 @@ Query (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-readyforquery">
 <term>
 ReadyForQuery (B)
 </term>
@@ -5893,7 +5893,7 @@ ReadyForQuery (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-rowdescription">
 <term>
 RowDescription (B)
 </term>
@@ -6018,7 +6018,7 @@ RowDescription (B)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-saslinitialresponse">
 <term>
 SASLInitialResponse (F)
 </term>
@@ -6086,7 +6086,7 @@ SASLInitialResponse (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-saslresponse">
 <term>
 SASLResponse (F)
 </term>
@@ -6132,7 +6132,7 @@ SASLResponse (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-sslrequest">
 <term>
 SSLRequest (F)
 </term>
@@ -6170,7 +6170,7 @@ SSLRequest (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-startupmessage">
 <term>
 StartupMessage (F)
 </term>
@@ -6299,7 +6299,7 @@ StartupMessage (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-sync">
 <term>
 Sync (F)
 </term>
@@ -6334,7 +6334,7 @@ Sync (F)
 </varlistentry>
 
 
-<varlistentry>
+<varlistentry id="protocol-message-formats-terminate">
 <term>
 Terminate (F)
 </term>
@@ -6665,7 +6665,7 @@ flow as physical replication.
 
 <variablelist>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-begin">
 <term>
 Begin
 </term>
@@ -6720,7 +6720,7 @@ Begin
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-message">
 <term>
 Message
 </term>
@@ -6808,7 +6808,7 @@ Message
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-commit">
 <term>
 Commit
 </term>
@@ -6873,7 +6873,7 @@ Commit
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-origin">
 <term>
 Origin
 </term>
@@ -6922,7 +6922,7 @@ Origin
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-relation">
 <term>
 Relation
 </term>
@@ -7054,7 +7054,7 @@ Relation
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-type">
 <term>
 Type
 </term>
@@ -7119,7 +7119,7 @@ Type
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-insert">
 <term>
 Insert
 </term>
@@ -7186,7 +7186,7 @@ Insert
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-update">
 <term>
 Update
 </term>
@@ -7300,7 +7300,7 @@ Update
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-delete">
 <term>
 Delete
 </term>
@@ -7389,7 +7389,7 @@ Delete
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-truncate">
 <term>
 Truncate
 </term>
@@ -7467,7 +7467,7 @@ Stream Abort) are available since protocol version 2.
 
 <variablelist>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-stream-start">
 <term>
 Stream Start
 </term>
@@ -7512,7 +7512,7 @@ Stream Start
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-stream-stop">
 <term>
 Stream Stop
 </term>
@@ -7536,7 +7536,7 @@ Stream Stop
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-stream-commit">
 <term>
 Stream Commit
 </term>
@@ -7611,7 +7611,7 @@ Stream Commit
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-stream-abort">
 <term>
 Stream Abort
 </term>
@@ -7665,7 +7665,7 @@ are available since protocol version 3.
 
 <variablelist>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-begin-prepare">
 
 <term>Begin Prepare</term>
 <listitem>
@@ -7730,7 +7730,7 @@ are available since protocol version 3.
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-prepare">
 
 <term>Prepare</term>
 <listitem>
@@ -7804,7 +7804,7 @@ are available since protocol version 3.
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-commit-prepared">
 
 <term>Commit Prepared</term>
 <listitem>
@@ -7878,7 +7878,7 @@ are available since protocol version 3.
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-rollback-prepared">
 
 <term>Rollback Prepared</term>
 <listitem>
@@ -7962,7 +7962,7 @@ are available since protocol version 3.
 </listitem>
 </varlistentry>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-stream-prepare">
 
 <term>Stream Prepare</term>
 <listitem>
@@ -8046,7 +8046,7 @@ The following message parts are shared by the above 
messages.
 
 <variablelist>
 
-<varlistentry>
+<varlistentry id="protocol-logicalrep-message-formats-tupledata">
 <term>
 TupleData
 </term>
diff --git a/doc/src/sgml/stylesheet-html-common.xsl 
b/doc/src/sgml/stylesheet-html-common.xsl
index 9df2782ce4..a277978402 100644
--- a/doc/src/sgml/stylesheet-html-common.xsl
+++ b/doc/src/sgml/stylesheet-html-common.xsl
@@ -301,4 +301,98 @@ set       toc,title
   </xsl:choose>
 </xsl:template>
 
+
+<!-- Add links to ids in varlists to make them easier to use -->
+<xsl:template match="varlistentry">
+  <dt>
+    <xsl:call-template name="id.attribute"/>
+    <xsl:call-template name="anchor"/>
+    <xsl:apply-templates select="term"/>
+    <xsl:call-template name="pg.id.link"/>
+  </dt>
+  <dd>
+    <xsl:apply-templates select="listitem"/>
+  </dd>
+</xsl:template>
+
+<xsl:template name="section.heading">
+  <xsl:param name="section" select="."/>
+  <xsl:param name="level" select="1"/>
+  <xsl:param name="allow-anchors" select="1"/>
+  <xsl:param name="title"/>
+  <xsl:param name="class" select="'title'"/>
+
+  <xsl:variable name="id">
+    <xsl:choose>
+      <!-- Make sure the subtitle doesn't get the same id as the title -->
+      <xsl:when test="self::subtitle">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="."/>
+        </xsl:call-template>
+      </xsl:when>
+      <!-- if title is in an *info wrapper, get the grandparent -->
+      <xsl:when test="contains(local-name(..), 'info')">
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select="../.."/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="object.id">
+          <xsl:with-param name="object" select=".."/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <!-- HTML H level is one higher than section level -->
+  <xsl:variable name="hlevel">
+    <xsl:choose>
+      <!-- highest valid HTML H level is H6; so anything nested deeper
+           than 5 levels down just becomes H6 -->
+      <xsl:when test="$level &gt; 5">6</xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$level + 1"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+  <xsl:element name="h{$hlevel}" namespace="http://www.w3.org/1999/xhtml";>
+    <xsl:attribute name="class"><xsl:value-of select="$class"/></xsl:attribute>
+    <xsl:if test="$css.decoration != '0'">
+      <xsl:if test="$hlevel&lt;3">
+        <xsl:attribute name="style">clear: both</xsl:attribute>
+      </xsl:if>
+    </xsl:if>
+    <xsl:if test="$allow-anchors != 0">
+      <xsl:call-template name="anchor">
+        <xsl:with-param name="node" select="$section"/>
+        <xsl:with-param name="conditional" select="0"/>
+      </xsl:call-template>
+    </xsl:if>
+    <xsl:copy-of select="$title"/>
+    <xsl:call-template name="pg.id.link">
+      <xsl:with-param name="object" select="$section"/>
+    </xsl:call-template>
+  </xsl:element>
+</xsl:template>
+
+<xsl:template name="pg.id.link">
+  <xsl:param name="object" select="."/>
+  <xsl:choose>
+    <xsl:when test="$object/@id or $object/@xml:id">
+      <a>
+        <xsl:attribute name="href">
+          <xsl:text>#</xsl:text>
+          <xsl:call-template name="object.id">
+            <xsl:with-param name="object" select="$object"/>
+          </xsl:call-template>
+        </xsl:attribute>
+        <xsl:attribute name="class">
+          <xsl:text>id_link</xsl:text>
+        </xsl:attribute>
+        <xsl:text> &#x1f517;</xsl:text>
+      </a>
+    </xsl:when>
+  </xsl:choose>
+</xsl:template>
+
 </xsl:stylesheet>
diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css
index 6410a47958..6f9f24c38f 100644
--- a/doc/src/sgml/stylesheet.css
+++ b/doc/src/sgml/stylesheet.css
@@ -163,3 +163,14 @@ acronym            { font-style: inherit; }
     width: 75%;
   }
 }
+
+/* Links to ids in long lists */
+.title a.id_link,
+.variablelist a.id_link {
+       font-size: 60%;
+       visibility: hidden;
+}
+.title:hover > a.id_link,
+.variablelist *:hover > a.id_link {
+       visibility: visible;
+}

Reply via email to