OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: [PATCH] fixupdiff: escape ^ caret


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



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]