Discussion of the implementations of VIRTIO specification
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: virtio-comment@lists.oasis-open.org, virtio-dev@lists.oasis-open.org
Cc: virtio@lists.oasis-open.org
Subject: [virtio-dev] [PATCH] fixupdiff: escape ^ caret
Date: Tue, 19 Apr 2022 12:30:27 -0400	[thread overview]
Message-ID: <20220419163024.134007-1-mst@redhat.com> (raw)

Since commit:

commit 1e30753d53d222fbe955f0643583d756105d557e
Author: Jan Kiszka <jan.kiszka@siemens.com>
Date:   Fri Oct 11 13:43:41 2019 +0200

    Fix ^= in example code

    Trying to escaping ^ here only leaves the backslash in the output.

    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

we have plain ^ inside listing. Escape it with \ but only
if not already escaped (as output of diff with old source will be).

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 fixupdiff.pl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fixupdiff.pl b/fixupdiff.pl
index f50cf26..e7d3a0f 100644
--- a/fixupdiff.pl
+++ b/fixupdiff.pl
@@ -35,6 +35,10 @@ while (<>) {
 		$line =~ s/%DIFDELCMD\s+< //;
 		if (not $line =~ m/\\(?:begin|end)\{lstlisting\}/) {
 			$line =~ s/([#&{} ])/\\$1/g;
+			#be careful: do not escape \^
+			$line =~ s/([^\\])(\^)/$1\\$2/g;
+			#also at beginning of line
+			$line =~ s/^(\^)/\\$1/g;
 			if ($add) {
 				$line =~ s/(.*)/\$\\DIFdel\{$1\}\$/;
 			} else {
-- 
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


             reply	other threads:[~2022-04-19 16:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 16:30 Michael S. Tsirkin [this message]
2022-04-20 12:57 ` [virtio-comment] Re: [virtio-dev] [PATCH] fixupdiff: escape ^ caret Cornelia Huck
2022-04-20 15:33   ` Michael S. Tsirkin

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=20220419163024.134007-1-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=virtio-comment@lists.oasis-open.org \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtio@lists.oasis-open.org \
    /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