From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/1] Docparse: Escape | in table content
Date: Wed, 16 Dec 2020 15:32:44 +0100 [thread overview]
Message-ID: <20201216143244.8180-1-pvorel@suse.cz> (raw)
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 <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
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;
--
2.29.2
next reply other threads:[~2020-12-16 14:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-16 14:32 Petr Vorel [this message]
2020-12-16 14:42 ` [LTP] [PATCH 1/1] Docparse: Escape | in table content Cyril Hrubis
2020-12-16 15:10 ` Petr Vorel
2020-12-16 15:30 ` Cyril Hrubis
2020-12-16 16:02 ` Petr Vorel
2020-12-16 19:15 ` Petr Vorel
2020-12-16 21:14 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201216143244.8180-1-pvorel@suse.cz \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox