lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250304121347.19861-2-dirk@gouders.net>
Date: Tue,  4 Mar 2025 13:12:04 +0100
From: Dirk Gouders <dirk@...ders.net>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        "Liang, Kan" <kan.liang@...ux.intel.com>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Dirk Gouders <dirk@...ders.net>
Subject: [PATCH 1/1] perf/Documentation: disable hyphenation for references in manpages

For the generated manual pages, hyphenation is turned off, globally,
but for some unknown reason, that doesn't work for references to other
manual pages e.g. in the SEE ALSO sections.

Fix this by customizing some docbook templates
(citerefentry -> do-citerefentry -> bold) so that hyphenation for the
generated references is explicitely turned off like this:

        \fBperf-stat\fR(1) -> \fB\%perf-stat\fR(1)

Signed-off-by: Dirk Gouders <dirk@...ders.net>
---
 tools/perf/Documentation/manpage-base.xsl | 44 +++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/tools/perf/Documentation/manpage-base.xsl b/tools/perf/Documentation/manpage-base.xsl
index a264fa616093..0b872a593570 100644
--- a/tools/perf/Documentation/manpage-base.xsl
+++ b/tools/perf/Documentation/manpage-base.xsl
@@ -1,12 +1,56 @@
 <!-- manpage-base.xsl:
      special formatting for manpages rendered from asciidoc+docbook -->
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:exsl="http://exslt.org/common"
 		version="1.0">
 
 <!-- these params silence some output from xmlto -->
 <xsl:param name="man.output.quietly" select="1"/>
 <xsl:param name="refentry.meta.get.quietly" select="1"/>
 
+<!-- template used to produce bold text with hyphenation disabled -->
+<xsl:template name="bold-nh">
+  <xsl:param name="node"/>
+  <xsl:param name="context"/>
+  <xsl:choose>
+    <xsl:when test="not($context[ancestor::title])">
+      <xsl:for-each select="$node/node()">
+        <xsl:text>\fB\%</xsl:text>
+        <xsl:apply-templates select="."/>
+        <xsl:text>\fR</xsl:text>
+      </xsl:for-each>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:apply-templates select="$node/node()"/>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<!-- template to produce references with hyphenation disabled -->
+<xsl:template name="do-citerefentry-nh">
+  <xsl:param name="refentrytitle" select="''"/>
+  <xsl:param name="manvolnum" select="''"/>
+  <xsl:variable name="title">
+    <xsl:value-of select="$refentrytitle"/>
+  </xsl:variable>
+  <xsl:call-template name="bold-nh">
+    <xsl:with-param name="node" select="exsl:node-set($title)"/>
+    <xsl:with-param name="context" select="."/>
+  </xsl:call-template>
+  <xsl:text>(</xsl:text>
+  <xsl:value-of select="$manvolnum"/>
+  <xsl:text>)</xsl:text>
+</xsl:template>
+
+<!-- customized citerefentry template to produce references with
+     hyphenation disabled -->
+<xsl:template match="citerefentry">
+  <xsl:call-template name="do-citerefentry-nh">
+    <xsl:with-param name="refentrytitle" select="refentrytitle"/>
+    <xsl:with-param name="manvolnum" select="manvolnum"/>
+  </xsl:call-template>
+</xsl:template>
+
 <!-- convert asciidoc callouts to man page format;
      git.docbook.backslash and git.docbook.dot params
      must be supplied by another XSL file or other means -->
-- 
2.45.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ