From patchwork Wed Dec 16 14:32:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 1417202 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=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CwyK93Tthz9sSf for ; Thu, 17 Dec 2020 01:32:58 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0BB213C580B for ; Wed, 16 Dec 2020 15:32:56 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [217.194.8.7]) by picard.linux.it (Postfix) with ESMTP id DB8D73C57F4 for ; Wed, 16 Dec 2020 15:32:54 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-7.smtp.seeweb.it (Postfix) with ESMTPS id 67B7E200C76 for ; Wed, 16 Dec 2020 15:32:54 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CAAC0AD35 for ; Wed, 16 Dec 2020 14:32:53 +0000 (UTC) From: Petr Vorel To: ltp@lists.linux.it Date: Wed, 16 Dec 2020 15:32:44 +0100 Message-Id: <20201216143244.8180-1-pvorel@suse.cz> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.102.4 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH 1/1] Docparse: Escape | in table content X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" 31708e815 added | in values displayed in table, which unescaped breaks table formatting. NOTE: Due asciidoc{,tor} markup design it's difficult to easily escape markup handling only this particular case. https://github.com/asciidoctor/asciidoctor/issues/901 https://discuss.asciidoctor.org/Difficulty-in-consistently-escaping-markup-td5318.html Fixes: #754 Reported-by: Cyril Hrubis Signed-off-by: Petr Vorel --- docparse/testinfo.pl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/docparse/testinfo.pl b/docparse/testinfo.pl index d8d9ea663..5aa7315e4 100755 --- a/docparse/testinfo.pl +++ b/docparse/testinfo.pl @@ -119,6 +119,14 @@ sub table return "|===\n"; } +sub table_escape +{ + my $out = $_[0]; + + $out =~ s/\|/\\|/g; + return $out; +} + sub print_defined { my ($key, $val, $val2) = @_; @@ -329,10 +337,11 @@ sub content_all_tests $content .= "|" . tag2title($k) . "\n|"; if (ref($v) eq 'ARRAY') { - $content .= join(', ', @$v), + $content .= table_escape(join(', ', @$v)); } else { - $content .= $v; + $content .= table_escape($v); } + $content .= "\n"; $tmp2 = 1;