From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: from mandoc.bsd.lv (bsd.lv [66.111.2.12]) by inbox.vuxu.org (Postfix) with ESMTP id 7AA4D212EE for ; Fri, 3 Jan 2025 17:34:46 +0100 (CET) Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id d0c862b3 for ; Fri, 3 Jan 2025 16:34:45 +0000 (UTC) Received: from localhost (mandoc.bsd.lv [local]) by mandoc.bsd.lv (OpenSMTPD) with ESMTPA id aa061272 for ; Fri, 3 Jan 2025 16:34:45 +0000 (UTC) Date: Fri, 3 Jan 2025 16:34:45 +0000 (UTC) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Rudimentatary implementation of the read-only number register X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: <950099e8dbd20b62@mandoc.bsd.lv> Log Message: ----------- Rudimentatary implementation of the read-only number register \(.l, which is supposed to contain the line length in basic units, by setting it to a constant width of 78 characters, no matter what the output width (-O width) is actually set to. This occurs in man(7) code produced by DocBook XSL, for example in DocBook XSL version 1.79.2, and hence it shows up in real-world manual pages. For example, tb@ reported finding it in git-reset(1) last year. Of course, setting this register to a constant value defeats the very purpose the register is supposed to serve in the first place. However, the most fundamental design principle of mandoc(1) is that the parse tree is independent of the output mode. That's not merely a technical restriction but helps to make sure that the *content* of documentation shown to the user does not depend on the output mode. So allowing this register to depend on the "-O width" argument would result in a layering violation that might, in the worst case, cause a reliability issue. Modified Files: -------------- mandoc: roff.c mandoc/regress/roff/nr: predef.in predef.out_ascii Revision Data ------------- Index: roff.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/roff.c,v diff -Lroff.c -Lroff.c -u -p -r1.400 -r1.401 --- roff.c +++ roff.c @@ -1,6 +1,6 @@ /* $Id$ */ /* - * Copyright (c) 2010-2015, 2017-2023 Ingo Schwarze + * Copyright (c) 2010-2015, 2017-2024 Ingo Schwarze * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any @@ -3062,6 +3062,8 @@ roff_getregro(const struct roff *r, cons return 24; case 'j': /* Always adjust left margin only. */ return 0; + case 'l': /* Fixed line width for DocBook. */ + return 78 * 24; case 'T': /* Some output device is always defined. */ return 1; case 'V': /* Fixed vertical resolution. */ Index: predef.out_ascii =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/roff/nr/predef.out_ascii,v diff -Lregress/roff/nr/predef.out_ascii -Lregress/roff/nr/predef.out_ascii -u -p -r1.4 -r1.5 --- regress/roff/nr/predef.out_ascii +++ regress/roff/nr/predef.out_ascii @@ -4,14 +4,15 @@ NNAAMMEE nr-predef - pre-defined read-only integer number registers DDEESSCCRRIIPPTTIIOONN - ascii mode: 0 - groff mode: 1 - horizontal resolution: 24 - adjustment mode: 0 - output device defined: 1 1 - vertical resolution: 40 + ascii mode: 0 = off + groff mode: 1 = on + horizontal resolution: 24 dots per character + adjustment mode: 0 = flush left + line width: 1872 dots per line + output device defined: 1 1 = yes + vertical resolution: 40 dots per line user defined macro with 0 arguments: user defined macro with 1 arguments: one user defined macro with 2 arguments: one two -OpenBSD August 29, 2015 NR-PREDEF(1) +OpenBSD January 3, 2025 NR-PREDEF(1) Index: predef.in =================================================================== RCS file: /home/cvs/mandoc/mandoc/regress/roff/nr/predef.in,v diff -Lregress/roff/nr/predef.in -Lregress/roff/nr/predef.in -u -p -r1.3 -r1.4 --- regress/roff/nr/predef.in +++ regress/roff/nr/predef.in @@ -1,5 +1,5 @@ .\" $OpenBSD: predef.in,v 1.4 2020/10/24 22:52:34 schwarze Exp $ -.TH NR-PREDEF 1 "August 29, 2015" +.TH NR-PREDEF 1 "January 3, 2025" .SH NAME nr-predef \- pre-defined read-only integer number registers .SH DESCRIPTION @@ -11,15 +11,17 @@ user defined macro with \\n(.$ arguments .nr .g 111 .nr .H 111 .nr .j 111 +.nr .l 111 .nr .T 111 .nr .V 111 .nr .$ 111 -ascii mode: \n(.A -groff mode: \n(.g -horizontal resolution: \n(.H -adjustment mode: \n(.j -output device defined: \n(.T \n[.T] -vertical resolution: \n(.V +ascii mode: \n(.A = off +groff mode: \n(.g = on +horizontal resolution: \n(.H dots per character +adjustment mode: \n(.j = flush left +line width: \n(.l dots per line +output device defined: \n(.T \n[.T] = yes +vertical resolution: \n(.V dots per line .mym .mym one .mym one two -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv