From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1255131-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 10EB113835A
	for <garchives@archives.gentoo.org>; Thu, 25 Feb 2021 19:30:16 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 4157FE09C6;
	Thu, 25 Feb 2021 19:30:15 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 2B0CEE09C6
	for <gentoo-commits@lists.gentoo.org>; Thu, 25 Feb 2021 19:30:15 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 40646340E11
	for <gentoo-commits@lists.gentoo.org>; Thu, 25 Feb 2021 19:30:11 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 98B6B4DB
	for <gentoo-commits@lists.gentoo.org>; Thu, 25 Feb 2021 19:30:09 +0000 (UTC)
From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" <ulm@gentoo.org>
Message-ID: <1614279973.ca88a7b371840409a3f3788da5365d968a55118e.ulm@gentoo>
Subject: [gentoo-commits] proj/devmanual:master commit in: /
X-VCS-Repository: proj/devmanual
X-VCS-Files: devbook.xsl devmanual.css
X-VCS-Directories: /
X-VCS-Committer: ulm
X-VCS-Committer-Name: Ulrich Müller
X-VCS-Revision: ca88a7b371840409a3f3788da5365d968a55118e
X-VCS-Branch: master
Date: Thu, 25 Feb 2021 19:30:09 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 22948bea-d7c1-4e19-af90-199ea5d8de6b
X-Archives-Hash: 56b74ea62fda0cd190ec44d4bf69b352

commit:     ca88a7b371840409a3f3788da5365d968a55118e
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 22 22:02:43 2021 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Thu Feb 25 19:06:13 2021 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=ca88a7b3

devbook.xsl, devmanual.css: Add permalinks to section headers

While we use empty fragments ("#") elsewhere for navigation within the
document (because they don't cause reloading of the page), we use an
empty href ("") for the chapter because it is meant to be copied as an
external link.

Closes: https://bugs.gentoo.org/772005
Suggested-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 devbook.xsl   |  6 +++++-
 devmanual.css | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/devbook.xsl b/devbook.xsl
index ec02aa4..49dc0c3 100644
--- a/devbook.xsl
+++ b/devbook.xsl
@@ -24,7 +24,10 @@
 </xsl:variable>
 
   <xsl:template match="chapter">
-    <h1 class="first-header"><xsl:apply-templates select="title"/></h1>
+    <h1 class="first-header">
+      <xsl:apply-templates select="title"/>
+      <a class="permalink" href=""><span class="fa fa-link"/></a>
+    </h1>
     <xsl:apply-templates select="*[not(self::title)]"/>
   </xsl:template>
 
@@ -42,6 +45,7 @@
       <xsl:element name="h{$level}">
         <xsl:attribute name="id"><xsl:value-of select="$anchor"/></xsl:attribute>
         <xsl:apply-templates select="title"/>
+        <a class="permalink" href="#{$anchor}"><span class="fa fa-link"/></a>
       </xsl:element>
       <xsl:apply-templates select="*[not(self::title)]"/>
     </div>

diff --git a/devmanual.css b/devmanual.css
index 288f81d..bba2a31 100644
--- a/devmanual.css
+++ b/devmanual.css
@@ -33,6 +33,20 @@ pre span.Constant { color: black; }
 pre span.Comment { color: red; }
 pre span.Statement { color: darkred; }
 
+a.permalink {
+    padding: 0 0.3em;
+    font-size: 90%;
+    text-decoration: none;
+    visibility: hidden;
+}
+
+h1:hover > a.permalink,
+h2:hover > a.permalink,
+h3:hover > a.permalink,
+h4:hover > a.permalink {
+    visibility: visible;
+}
+
 .truncated-text {
     white-space: nowrap;
     overflow: hidden;