From patchwork Thu Feb 13 17:27:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ihar Hrachyshka X-Patchwork-Id: 1237631 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=U8vorft3; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48JNkM6cxHz9s3x for ; Fri, 14 Feb 2020 04:27:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4294221552; Thu, 13 Feb 2020 17:27:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o3g+Sg8ADVWG; Thu, 13 Feb 2020 17:27:37 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id F11D6214D2; Thu, 13 Feb 2020 17:27:36 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D6CC1C08A4; Thu, 13 Feb 2020 17:27:36 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id F26A7C0177 for ; Thu, 13 Feb 2020 17:27:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E217787196 for ; Thu, 13 Feb 2020 17:27:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BbXTS6hPwxsW for ; Thu, 13 Feb 2020 17:27:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5798D87117 for ; Thu, 13 Feb 2020 17:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581614853; h=from:from: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; bh=/Gl3TQhfFT1XkGtDgwneV+Pm+mIcjxykrqMOc26yQgY=; b=U8vorft3Rjx19f9sS3WkZZxkbbIgiAzntWJSYsTBpmkyvdLiGOK/kYMlivIzy++v5KI1Qz +QS0wyGDes0UYypSFFIklwxNQfLmHZPVtl6VkhnVDvqAu48Y5yDjPXbPfu/AnnE9bZjPcb 8N34uEQ+XdNwLlfBhLRYPa1fq96ujBo= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-QcIShNjpMTiIxXFIScGt_g-1; Thu, 13 Feb 2020 12:27:30 -0500 Received: by mail-qt1-f197.google.com with SMTP id o18so4111309qtt.19 for ; Thu, 13 Feb 2020 09:27:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=V2XShVNUgLYPSaYXknAOEmp9z8d1wZFwRxrdM6gIP04=; b=t91rvToK8VdqsU+s8JlBQQpkoimNK0lRLV6SOnncRte5x9qoN2c8bnS+5UOMAgKolG YCbFj//xH3pigLLPKvFVHxpCT1lhnl8PL1ZlXJQ/b8TazIVaTQQ0wMwBXBRnbYeUjIbS tI6bjg+3yaR7cs4lnAs5rNP1aY8PeRNVGnh2a5Yk7dWrGrCPk9dvRWrQCdLVCSRaM6b/ 6dJ08YUOurSqFBSm0wC3i82/K+7gYMyAWRhLJ4uLDl++WmhBN3VERgJ79nbzSwsckKtj hBSMg3+wkiTckAb9Y7oJTTj8CNtVIW0ppHwA++yyhQTG408RIMpyNqHKgtPUtXLXwiwC Aemg== X-Gm-Message-State: APjAAAVlGR6+YZsR3DZTC/SdqvyrbBHBWELKfyHAGPxbu+pWG5K6ec8b vG9kQuZ4kLyWNrJeloAx887ZHo3Su2XaYmTw2ICmD0F70KfomlOkSUPWMk6sfht/hoqqMwkeltW uVAFMvx/FwCbh X-Received: by 2002:ac8:1aa6:: with SMTP id x35mr23998253qtj.32.1581614850243; Thu, 13 Feb 2020 09:27:30 -0800 (PST) X-Google-Smtp-Source: APXvYqxYh3Wr6EC2kLzhTMTZ0Dt06ZCtbtkQ1phAJTPpE/j0/dtQCjeJ+tIQFvJxCGn2TF/WwXiU5g== X-Received: by 2002:ac8:1aa6:: with SMTP id x35mr23998235qtj.32.1581614849982; Thu, 13 Feb 2020 09:27:29 -0800 (PST) Received: from localhost.localdomain.com (cpe-172-73-180-250.carolina.res.rr.com. [172.73.180.250]) by smtp.googlemail.com with ESMTPSA id f32sm1867284qtk.89.2020.02.13.09.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 09:27:29 -0800 (PST) From: Ihar Hrachyshka To: dev@openvswitch.org Date: Thu, 13 Feb 2020 12:27:27 -0500 Message-Id: <20200213172727.1360871-1-ihrachys@redhat.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-MC-Unique: QcIShNjpMTiIxXFIScGt_g-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: Ihar Hrachyshka Subject: [ovs-dev] [PATCH] docs: handle multi line headers for nroff X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Before the fix, headers split into multiple lines were producing bogus quote characters in nroff output and failed to indent headers properly. Specifically, it fixes a header and its indentation in ovn-architecture(7). Signed-off-by: Ihar Hrachyshka --- python/build/nroff.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/build/nroff.py b/python/build/nroff.py index a94907757..09795ab52 100644 --- a/python/build/nroff.py +++ b/python/build/nroff.py @@ -290,6 +290,11 @@ fillval = .2 \\}""" +def flatten_header(s): + s = s.strip() + return re.sub(r'\s+', ' ', s) + + def block_xml_to_nroff(nodes, para='.PP'): HEADER_TAGS = ('h1', 'h2', 'h3', 'h4') s = '' @@ -373,7 +378,9 @@ def block_xml_to_nroff(nodes, para='.PP'): to_upper = node.tagName == 'h1' s += ".%s \"" % nroffTag for child_node in node.childNodes: - s += inline_xml_to_nroff(child_node, font, to_upper) + s += flatten_header( + inline_xml_to_nroff(child_node, font, to_upper) + ) s += "\"\n" elif node.tagName == 'pre': fixed = node.getAttribute('fixed')