From 63c077732ea347d7c3fb01e06c149c9694cf272d Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Wed, 13 Jul 2005 03:57:50 +0000 Subject: [PATCH] Prevent hyphenation of computer inlines, filenames, and URLs. (Closes #1124391; thanks to Ryan Hofschneider for reporting). By default, even when hyphenation is enabled (globally), hyphenation is now suppressed for "computer inlines" (currently, just classname, constant, envar, errorcode, option, replaceable, userinput, type, varname -- but probably need to add more) and for filenames, and for URLs from Ulink. It can be (re)enabled using the man.hyphenate.computer.inlines, man.hyphenate.filenames, and man.hyphenate.urls params. --- xsl/manpages/inline.xsl | 4 -- xsl/manpages/param.ent | 13 +++-- xsl/manpages/param.xweb | 10 +++- xsl/params/man.hyphenate.computer.inlines.xml | 48 +++++++++++++++++++ xsl/params/man.hyphenate.filenames.xml | 42 ++++++++++++++++ xsl/params/man.hyphenate.urls.xml | 41 ++++++++++++++++ xsl/params/man.hyphenate.xml | 20 ++++++-- 7 files changed, 162 insertions(+), 16 deletions(-) create mode 100644 xsl/params/man.hyphenate.computer.inlines.xml create mode 100644 xsl/params/man.hyphenate.filenames.xml create mode 100644 xsl/params/man.hyphenate.urls.xml diff --git a/xsl/manpages/inline.xsl b/xsl/manpages/inline.xsl index 7734e2d49..1cb577fb2 100644 --- a/xsl/manpages/inline.xsl +++ b/xsl/manpages/inline.xsl @@ -13,10 +13,6 @@ ******************************************************************** --> -0 -0 -0 - diff --git a/xsl/manpages/param.ent b/xsl/manpages/param.ent index 10202a659..d201fc225 100644 --- a/xsl/manpages/param.ent +++ b/xsl/manpages/param.ent @@ -1,8 +1,9 @@ - + + + - - + @@ -12,8 +13,6 @@ - - @@ -32,3 +31,7 @@ + + + + diff --git a/xsl/manpages/param.xweb b/xsl/manpages/param.xweb index cd838af1a..bfe83a466 100644 --- a/xsl/manpages/param.xweb +++ b/xsl/manpages/param.xweb @@ -29,10 +29,13 @@ - General formatting -&man.break.after.slash; + Hyphenation, justification, and breaking &man.hyphenate; +&man.hyphenate.urls; +&man.hyphenate.filenames; +&man.hyphenate.computer.inlines; &man.justify; +&man.break.after.slash; Link handling @@ -105,6 +108,9 @@ + + + diff --git a/xsl/params/man.hyphenate.computer.inlines.xml b/xsl/params/man.hyphenate.computer.inlines.xml new file mode 100644 index 000000000..0af99b9b2 --- /dev/null +++ b/xsl/params/man.hyphenate.computer.inlines.xml @@ -0,0 +1,48 @@ + + +man.hyphenate.computer.inlines +boolean + + +man.hyphenate.computer.inlines +Hyphenate computer inlines? + + + + +0 + + +Description + +If zero (the default), hyphenation is suppressed for +computer inlines such as environment variables, +constants, etc. This parameter current affects output of the following +elements: + + + classname + constant + envar + errorcode + option + replaceable + userinput + type + varname + + + + + If hyphenation is already turned off globally (that is, if + man.hyphenate is zero, setting the + man.hyphenate.computer.inlines is not + necessary. + + +If man.hyphenate.computer.inlines is +non-zero, computer inlines will not be treated specially and will be +hyphenated like other words when needed. + + + diff --git a/xsl/params/man.hyphenate.filenames.xml b/xsl/params/man.hyphenate.filenames.xml new file mode 100644 index 000000000..23fa1cd33 --- /dev/null +++ b/xsl/params/man.hyphenate.filenames.xml @@ -0,0 +1,42 @@ + + +man.hyphenate.filenames +boolean + + +man.hyphenate.filenames +Hyphenate filenames? + + + + +0 + + +Description + +If zero (the default), hyphenation is suppressed for +filename output. + + + If hyphenation is already turned off globally (that is, if + man.hyphenate is zero, setting + man.hyphenate.filenames is not + necessary. + + +If man.hyphenate.filenames is non-zero, +filenames will not be treated specially and are subject to hyphenation +just like other words. + + + If you are thinking about setting a non-zero value for + man.hyphenate.filenames in order to make long + filenames/pathnames break across lines, you'd probably be better off + experimenting with setting the + man.break.after.slash parameter first. That + will cause long pathnames to be broken after slashes. + + + + diff --git a/xsl/params/man.hyphenate.urls.xml b/xsl/params/man.hyphenate.urls.xml new file mode 100644 index 000000000..525b9f29a --- /dev/null +++ b/xsl/params/man.hyphenate.urls.xml @@ -0,0 +1,41 @@ + + +man.hyphenate.urls +boolean + + +man.hyphenate.urls +Hyphenate URLs? + + + + +0 + + +Description + +If zero (the default), hyphenation is suppressed for output of +the ulink url attribute. + + + If hyphenation is already turned off globally (that is, if + man.hyphenate is zero, setting + man.hyphenate.urls is not necessary. + + +If man.hyphenate.urls is non-zero, URLs +will not be treated specially and are subject to hyphenation just like +other words. + + + If you are thinking about setting a non-zero value for + man.hyphenate.urls in order to make long + URLs break across lines, you'd probably be better off + experimenting with setting the + man.break.after.slash parameter first. That + will cause long URLs to be broken after slashes. + + + + diff --git a/xsl/params/man.hyphenate.xml b/xsl/params/man.hyphenate.xml index f028911ab..fe04b6bac 100644 --- a/xsl/params/man.hyphenate.xml +++ b/xsl/params/man.hyphenate.xml @@ -20,15 +20,25 @@ The default value for this parameter is zero because groff is not particularly smart about how it does hyphenation; it can end up -hyphenating a lot of things that you don't want hyphenated. - -That said, justified text can look very bad unless you also -hyphenate it; to quote the "Hypenation" node from the groff info page: +hyphenating a lot of things that you don't want hyphenated. To +mitigate that, the default behavior of the stylesheets is to suppress +hyphenation of computer inlines, filenames, and URLs. (You can +override the default behavior by setting non-zero values for the +man.hyphenate.urls, +man.hyphenate.filenames, and +man.hyphenate.computer.inlines parameters.) But +the best way is still to just globally disable hyphenation, as the +stylesheets do by default. + +The only good reason to enabled hyphenation is if you have also +enabled justification (which is disabled by default). The reason is +that justified text can look very bad unless you also hyphenate it; to +quote the Hypenation node from the groff info page:
Since the odds are not great for finding a set of words, for every output line, which fit nicely on a line without - inserting excessive amounts of space between words, `gtroff' + inserting excessive amounts of space between words, 'gtroff' hyphenates words so that it can justify lines without inserting too much space between words.
-- 2.50.1