From a94d3467074cc207a24cc72a6fe864dc000b1005 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Thu, 18 Jan 2007 15:44:19 +0000 Subject: [PATCH] Adjusted manpages stylesheet to use U+2593 as the internal representation for the backslash character within the stylesheet. This prevents backslashes in source content from getting eaten. Closes #1609425. Thanks to Paul DuBois for reporting the bug. --- xsl/manpages/info.xsl | 6 +- xsl/manpages/links.xsl | 6 +- xsl/manpages/lists.xsl | 18 ++--- xsl/manpages/other.xsl | 30 +++---- xsl/manpages/refentry.xsl | 6 +- xsl/manpages/table.xsl | 2 +- xsl/manpages/utility.xsl | 12 +-- xsl/params/man.string.subst.map.xml | 121 +++++++++++++++++----------- 8 files changed, 113 insertions(+), 88 deletions(-) diff --git a/xsl/manpages/info.xsl b/xsl/manpages/info.xsl index a6e784014..66cd06cdd 100644 --- a/xsl/manpages/info.xsl +++ b/xsl/manpages/info.xsl @@ -25,7 +25,7 @@ - \n(zqu + ▓n(zqu @@ -339,7 +339,7 @@ - <\& + <▓& @@ -354,7 +354,7 @@ - \&> + ▓&> - \% + ▓% @@ -220,7 +220,7 @@ - \&[ + ▓&[ ] @@ -369,7 +369,7 @@ - \% + ▓% diff --git a/xsl/manpages/lists.xsl b/xsl/manpages/lists.xsl index dbdb3beea..8f5094c6b 100644 --- a/xsl/manpages/lists.xsl +++ b/xsl/manpages/lists.xsl @@ -22,7 +22,7 @@ - \n(zqu + ▓n(zqu @@ -135,14 +135,14 @@ - \h'░ + ▓h'░ 0 ' - \h'+ + ▓h'+ 0 @@ -160,7 +160,7 @@ - \h'░ + ▓h'░ 0 @@ -170,7 +170,7 @@ - \h'+ + ▓h'+ 0 @@ -286,8 +286,8 @@ - ⌂\" line length increase to cope w/ tbl weirdness - ⌂ll +(\n(LLu * 62u / 100u) + ⌂▓" line length increase to cope w/ tbl weirdness + ⌂ll +(▓n(LLu * 62u / 100u) ⌂TS @@ -313,8 +313,8 @@ ⌂TE - ⌂\" line length decrease back to previous value - ⌂ll ░(\n(LLu * 62u / 100u) + ⌂▓" line length decrease back to previous value + ⌂ll ░(▓n(LLu * 62u / 100u) ⌂sp diff --git a/xsl/manpages/other.xsl b/xsl/manpages/other.xsl index 532758b39..27434ba7f 100644 --- a/xsl/manpages/other.xsl +++ b/xsl/manpages/other.xsl @@ -169,12 +169,12 @@ db:manvolnum - ⌂\" Title: + ⌂▓" Title: - ⌂\" Author: + ⌂▓" Author: @@ -183,28 +183,28 @@ db:manvolnum - ⌂\" Generator: DocBook XSL Stylesheets v + ⌂▓" Generator: DocBook XSL Stylesheets v <http://docbook⌂sf⌂net/> - ⌂\" Date: + ⌂▓" Date: - ⌂\" Manual: + ⌂▓" Manual: - ⌂\" Source: + ⌂▓" Source: - ⌂\" + ⌂▓" @@ -315,31 +315,31 @@ db:manvolnum - ⌂\" disable hyphenation + ⌂▓" disable hyphenation ⌂nh - ⌂\" disable justification + ⌂▓" disable justification (adjust text to left margin only) ⌂ad l - ⌂\" store initial "default indentation value" - ⌂nr zq \n(IN - ⌂\" adjust default indentation + ⌂▓" store initial "default indentation value" + ⌂nr zq ▓n(IN + ⌂▓" adjust default indentation ⌂nr IN - ⌂\" adjust indentation of SS headings - ⌂nr SN \n(IN + ⌂▓" adjust indentation of SS headings + ⌂nr SN ▓n(IN - ⌂\" enable line breaks after slashes + ⌂▓" enable line breaks after slashes ⌂cflags 4 / diff --git a/xsl/manpages/refentry.xsl b/xsl/manpages/refentry.xsl index a1a25373a..b5463684d 100644 --- a/xsl/manpages/refentry.xsl +++ b/xsl/manpages/refentry.xsl @@ -143,7 +143,7 @@ - ⌂ti (\n(SNu * 5u / 3u) + ⌂ti (▓n(SNu * 5u / 3u) @@ -165,11 +165,11 @@ - (\n(SNu) + (▓n(SNu) - ⌂RS (\n(SNu) + ⌂RS (▓n(SNu) ⌂RE diff --git a/xsl/manpages/table.xsl b/xsl/manpages/table.xsl index 24873d76f..a49fda147 100644 --- a/xsl/manpages/table.xsl +++ b/xsl/manpages/table.xsl @@ -380,7 +380,7 @@ >tbl convert : Extracted a nested table - [\fInested table\fR]* + [▓fInested table▓fR]* diff --git a/xsl/manpages/utility.xsl b/xsl/manpages/utility.xsl index ba953e0ae..8c83baaae 100644 --- a/xsl/manpages/utility.xsl +++ b/xsl/manpages/utility.xsl @@ -37,17 +37,17 @@ - \fB + ▓fB - \fR + ▓fR - \fI + ▓fI - \fR + ▓fR @@ -95,7 +95,7 @@ - \% + ▓% @@ -392,7 +392,7 @@ - ⌂\" + ⌂▓" diff --git a/xsl/params/man.string.subst.map.xml b/xsl/params/man.string.subst.map.xml index 13cfcbf3a..e133ba1ce 100644 --- a/xsl/params/man.string.subst.map.xml +++ b/xsl/params/man.string.subst.map.xml @@ -13,39 +13,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - + + + @@ -147,10 +152,6 @@ particular customization of the DocBook XSL stylesheets. causes target strings to be replaced in roff requests and escapes, not just in the visible contents. - In particular, do not attempt to add a mapping for the - dot/period character. Doing so will break your output. For an - explanation, see . - @@ -178,20 +179,44 @@ particular customization of the DocBook XSL stylesheets. - - About adding backslashes before dots - The stylesheets do not add backslashes before - periods/dots. One reason is that, because string substitution is - performed over the entire roff source of each man page, it would be - complicated to replace dots in visible contents without also causing - them to be replaced in roff requests and escapes; for example, - without causing, say, the .TH roff macro to be - replaced with \.TH. Additionally, backslashes in - front of periods/dots are needed only in the very rare case where a - period is the very first character in a line, without any space in - front of it. A better way to deal with that rare case is to add a - zero-width space in front of the offending dot(s) in your - source. + + About escaping and replacing backslash, dot, and dash + The backslash and dot (\, .) characters have special meaning + for roff, so we: + + + + escape backslashes and dots where they appear in the + source content + + + use certain (arbitrarily selected) Unicode characters as + “markers” – internal representations within the stylesheet – for + backslashes and dots + + + replace the Unicode characters with real backslashes and + dotes before output gets serialized + + + + In addition, for certain reasons, we do the same thing for + dashes. + + The mappings of dash, backslash, and dot to the Unicode + characters we use to represent them is hard-coded in the stylesheet: + + + U+2591 = dash + U+2593 = backslash + U+2302 = dot + + + Those Unicode characters were chosen on the assumption that they are + never used in content intended for output to man pages. It would be + possible to provide a way for configuring the mappings (using XSLT + parameters), but doing so would make the stylesheet code much more + verbose and harder to read. -- 2.40.0