From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id wF2qN60Kd2e05gAA62LTzQ:P1 (envelope-from ) for ; Thu, 02 Jan 2025 21:52:46 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id wF2qN60Kd2e05gAA62LTzQ (envelope-from ) for ; Thu, 02 Jan 2025 22:52:46 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=disroot.org header.s=mail header.b=YnO9avyM; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=disroot.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1735854765; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=JdDMguOHVltFLCIx0zuP4b3GzstqQeq4qF9ip0Xqkow=; b=jS6/fTKiOzVHsZv6p05TJlJHo7v3X+AtuccnV+40x0dUKuduAR/72GNIgWZRGfVC8/hedX +A5Iiv2gMj/moiRvUNs9RXEwKaisZ4Oqdwmrg6tYLw3tPFcffhjHmGhvCYOdrvxSOjYRQq OULzLh7VL1boVfG39O9lNHR/QbDN2ry+yALd825+fn9EvrQ94gpPElmGYhO/ceLJQS2swn h1UtVTIsN3Xdkl8ljvfgR+BB7gb2zIsWNDYEb/DyO04x0ZMbXPhlVEzJRlpKYVsrHEl1dV GCkc5uhAZp+6WyN2tLTlY3gwiy6SPqRu9n3VGz2F4j6VA3eHdDl2SwMW70W6Pg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=disroot.org header.s=mail header.b=YnO9avyM; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=disroot.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735854765; a=rsa-sha256; cv=none; b=V6ZRtvsx5zNyoPvgNjxf3FAIajhewd9JnkOfpjBXLOBfemWbBlonMbpFwPKfJ6vd/5nkRX oa9J0Cp9M7R9q0LYFiCqvbRnL6eqQUFRTKd2VaO+Yu7kCVHdtkBNR5aLlVYxmLyoNAcJBq 5Ysj+l30zAwstZzfKXFO3pdWSbU0wHs38dV21C0sWV/tf+xhnBNZJKzB+xFTZGGMyCUWuK 3/tcfbVyFFdk8cwb+064b2Kn+Y+d9r7c0oIrJTu31g3EgRH5r1EMBCsOVqIEfMBQq5Jt6t Afm18t5KgsdU/yT49lzgrnFGkT5qfF9m+F/GLtN1R/nYe7r308NrmfxAzWyOBQ== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8D9A875A8 for ; Thu, 02 Jan 2025 22:52:45 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTT6o-0000Yq-Bn; Thu, 02 Jan 2025 16:52:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTT6k-0000UE-68; Thu, 02 Jan 2025 16:51:59 -0500 Received: from layka.disroot.org ([178.21.23.139]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTT6h-0004a2-Ox; Thu, 02 Jan 2025 16:51:57 -0500 Received: from mail01.disroot.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id A1C6925716; Thu, 2 Jan 2025 22:51:52 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 3kAuY4j88I3V; Thu, 2 Jan 2025 22:51:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1735854708; bh=/iZZVlIbKUSyASVt1avk56wSlen8ZMhUCrss6ZvXH6Y=; h=Date:To:Cc:Subject:From:References:In-Reply-To; b=YnO9avyMxLD1PlfcUd4MsS13C4WjnvnxAlPw1vXB2OwDfSETWsrVZ848hSCH6jYfl A6s5gjxcGnnsv94ZEiNx7Mt+geXnTWbVjHkoYRmVKuWYtQKvIWMz99RyW2hV5zmB8Q R3nGG/abyTWVj6PhQ5qqMmpVCb7bQnO4Wx/Cdto6pygbxG0abqr+DRARRx/6Y56wkf ZlllSGD2n5AGTnVJ5E5MlnUxQw/s0MYzBpGanWpbfG7rtxlnCNy51QKNfYP1QmazF0 ciQ+jDggZYxq9ZLlREsgBVZgEUZ4bjMb+c7eGI7ekHU4Lkr2DivUMcyTUb6LaJ7+Yz vmBaqI0pubNGw== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 02 Jan 2025 22:51:47 +0100 Message-Id: To: "Ihor Radchenko" Cc: "G. Branden Robinson" , , , "Ingo Schwarze" Subject: Re: [BUG] ox-man: Nested markup is broken (was: [BUG] "\fC" macro in ox-man.el [9.6.15 (release_9.6.15 @ /usr/share/emacs/29.2/lisp/org/)]) From: "onf" References: <20241218172040.tyytdhbyl7annyli@illithid> <87ttav7mii.fsf@localhost> <20241231170034.nzmponxxjppqrhf5@illithid> <87bjwrhg6a.fsf@localhost> <87o70qg9gi.fsf@localhost> <87seq1qfa1.fsf@localhost> In-Reply-To: <87seq1qfa1.fsf@localhost> Received-SPF: pass client-ip=178.21.23.139; envelope-from=onf@disroot.org; helo=layka.disroot.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -3.99 X-Spam-Score: -3.99 X-Migadu-Queue-Id: 8D9A875A8 X-TUID: h/C/ZQ9Y8Idg On Thu Jan 2, 2025 at 6:47 PM CET, Ihor Radchenko wrote: > "onf" writes: > [...] > > It's important to understand that troff commands don't really use > > nesting or a stack as one might be used to from HTML and similar > > markup languages. That's why it's also not possible to e.g. nest > > bold and italic like this: > > Normal \fBbold \fIbold-italic\fP bold\fP normal > > > > ...which actually gives you: > > Normal bold italic bold italic > > Yikes! > > We currently implicitly rely on the assumption that things are working > differently: > > normal *bold /italic/ bold* normal > > is exported as > > .TH "" "1"=20 > .PP > normal \fBbold \fIitalic\fP bold\fP normal > > and the last "normal" is indeed rendered as italic. > > > One has to do one of these instead: > > Normal \fBbold \f[BI]bold-italic\fP bold\fR normal > > Normal \fBbold \f[BI]bold-italic\fB bold\fR normal > > Normal \fBbold\fP \f[BI]bold-italic\fP \fBbold\fP normal > > I'm afraid that I'll need to rethink that export algo for ox-man to > account for this nuance. > > Probably, the simplest way implementation-wise will be applying faces to > each "plain text" segment individually: > > \fRnormal \fR\fBbold \fR\f[BI]italic\fR\fB bold\fR\fR normal\fR I assume you meant: \fRnormal \fP\fBbold \fP\f[BI]italic\fP\fB bold\fP\fR normal\fP You might find it easier to omit the \fP escapes, since they have little effect here anyway. Situation might be different if you're targetting non-troff man processors too, though; no idea how robust their handling of font changes is. But I agree; I would track each style change (bold -> not bold, italic -> not italic) and emit an appropriate \f sequence that would match the currently active styles after each such change, like so: code & bold & italic \f[CBI] code & bold \fC\f(CB code & italic \fC\f(CI code \fC\f(CR bold & italic \f(BI bold \fB italic \fI none \fR Note that \f[CBI] will break in old troffs due to the "new" \f[] syntax, so a warning should probably be emitted. And I have no idea how good support for {bold,italic} Courier is in older troffs either. (That is assuming Org-mode markup allows code to be styled like that.) Also note that if a change involving italic happens between two non-whitespace characters, like so: groff(/7/) ...an italic correction should be emitted to prevent the two glyphs colliding into each other: groff(\,\fI7\fR\/) where: \, is left italic correction \/ is right italic correction ~ onf