* [PATCH 0/2] Add rules in hyphen2endash.sh
@ 2016-09-18 14:24 Akira Yokosawa
2016-09-18 14:26 ` [PATCH 1/2] hyphen2endash.sh: Add substitution patterns Akira Yokosawa
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Akira Yokosawa @ 2016-09-18 14:24 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
From ec548ecfa8846f40731a0945853d3ac9018b4d71 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sun, 18 Sep 2016 23:09:34 +0900
Subject: [PATCH 0/2] Add rules in hyphen2endash.sh
This is an update of scripts added in commit dd08907f289d
("Trial of replacing hyphens with en-dashes for number ranges").
1st patch adds patterns for the following:
o CPUs~nn--mm
o \co{xxx}--\co{yyy}
It also fixes typo in the authors email address.
2nd patch merges several rules by using "[abc]" regex patterns.
Akira Yokosawa (2):
hyphen2endash.sh: Add substitution patterns
hyphen2endash.sh: Merge subst patterns
utilities/dohyphen2endash.sh | 2 +-
utilities/hyphen2endash.sh | 23 +++++++++++------------
2 files changed, 12 insertions(+), 13 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/2] hyphen2endash.sh: Add substitution patterns
2016-09-18 14:24 [PATCH 0/2] Add rules in hyphen2endash.sh Akira Yokosawa
@ 2016-09-18 14:26 ` Akira Yokosawa
2016-09-18 14:28 ` [PATCH 2/2] hyphen2endash.sh: Merge subst patterns Akira Yokosawa
2016-09-18 17:44 ` [PATCH 0/2] Add rules in hyphen2endash.sh Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Akira Yokosawa @ 2016-09-18 14:26 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
From 37577e84f4215305195e471df9443ac2f242f595 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sun, 4 Sep 2016 00:14:09 +0900
Subject: [PATCH 1/2] hyphen2endash.sh: Add substitution patterns
This commit adds substitution patterns for the following:
o CPUs~nn--mm
o \co{xxx}--\co{yyy}
It also separates the pattern for "and~nn--mm".
This commit also fixes typo in author's email address.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
utilities/dohyphen2endash.sh | 2 +-
utilities/hyphen2endash.sh | 14 +++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/utilities/dohyphen2endash.sh b/utilities/dohyphen2endash.sh
index 2a0fdc7..fabecb5 100644
--- a/utilities/dohyphen2endash.sh
+++ b/utilities/dohyphen2endash.sh
@@ -21,7 +21,7 @@
#
# Copyright (C) Akira Yokosawa, 2016
#
-# Authors: Akira Yokosawa <akiyks@gmain.com>
+# Authors: Akira Yokosawa <akiyks@gmail.com>
# parse option
TEMP=`getopt -o f --long force -- "$@"`
diff --git a/utilities/hyphen2endash.sh b/utilities/hyphen2endash.sh
index 2b37696..b495e33 100644
--- a/utilities/hyphen2endash.sh
+++ b/utilities/hyphen2endash.sh
@@ -11,9 +11,13 @@
# Line nn-mm -> Lines~nn--mm -- includes typo fix
# line~nn-mm -> lines~nn--mm -- includes typo fix
# Line~nn-mm -> Lines~nn--mm -- includes typo fix
-# Lines~nn--mm and oo-pp -> Lines~nn--mm and oo--pp
# Slides nn-mm -> Slides~nn--mm
+# CPUs~nn-mm -> CPUs~nn--mm
+# CPUs nn-mm -> CPUs~nn--mm
+# and nn-mm -> and~nn--mm
+# and~nn-mm -> and~nn--mm
# Figures~\ref{foo}-\ref{bar} -> Figures~\ref{foo}--\ref{bar}
+# \co{xxx}-\{yyy} -> \co{xxx}--\co{yyy}
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,7 +35,7 @@
#
# Copyright (C) Akira Yokosawa, 2016
#
-# Authors: Akira Yokosawa <akiyks@gmain.com>
+# Authors: Akira Yokosawa <akiyks@gmail.com>
cat $1 |
sed -e 's/Lines~\([0-9]\+\)-\([0-9]\+\)/Lines~\1--\2/g' \
@@ -42,9 +46,13 @@ cat $1 |
-e 's/Line \([0-9]\+\)-\([0-9]\+\)/Lines~\1--\2/g' \
-e 's/line~\([0-9]\+\)-\([0-9]\+\)/lines~\1--\2/g' \
-e 's/line \([0-9]\+\)-\([0-9]\+\)/lines~\1--\2/g' \
- -e 's/Lines~\([0-9]\+\)--\([0-9]\+\) and \([0-9]\+\)-\([0-9]\+\)/Lines~\1--\2 and \3--\4/g' \
-e 's/Slides \([0-9]\+\)-\([0-9]\+\)/Slides~\1--\2/g' \
-e 's/Figures~\(\\ref{.*}\)-\(\\ref{.*}\)/Figures~\1--\2/g' \
+ -e 's/CPUs~\([0-9]\+\)-\([0-9]\+\)/CPUs~\1--\2/g' \
+ -e 's/CPUs \([0-9]\+\)-\([0-9]\+\)/CPUs~\1--\2/g' \
+ -e 's/and~\([0-9]\+\)-\([0-9]\+\)/and~\1--\2/g' \
+ -e 's/and \([0-9]\+\)-\([0-9]\+\)/and~\1--\2/g' \
+ -e 's/\(\\co{.*}\)-\(\\co{.*}\)/\1--\2/g' \
-e 's/\/\* Lines~\([0-9]\+\)--\([0-9]\+\) \*\//\/\* Lines \1-\2 \*\//g'
# Last pattern is to preserve "Lines n-m" in comments within code snippet
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] hyphen2endash.sh: Merge subst patterns
2016-09-18 14:24 [PATCH 0/2] Add rules in hyphen2endash.sh Akira Yokosawa
2016-09-18 14:26 ` [PATCH 1/2] hyphen2endash.sh: Add substitution patterns Akira Yokosawa
@ 2016-09-18 14:28 ` Akira Yokosawa
2016-09-18 17:44 ` [PATCH 0/2] Add rules in hyphen2endash.sh Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Akira Yokosawa @ 2016-09-18 14:28 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
From ec548ecfa8846f40731a0945853d3ac9018b4d71 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sun, 4 Sep 2016 08:03:52 +0900
Subject: [PATCH 2/2] hyphen2endash.sh: Merge subst patterns
This commit merges several rules by using "[abc]" patterns,
as long as they are not too cryptic (at least for me).
It also replaces patterns of "{.*}" with those of "{[^}]*}"
for stable matching when there are multiple "{...}"s in a line.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
utilities/hyphen2endash.sh | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/utilities/hyphen2endash.sh b/utilities/hyphen2endash.sh
index b495e33..39005a4 100644
--- a/utilities/hyphen2endash.sh
+++ b/utilities/hyphen2endash.sh
@@ -38,21 +38,12 @@
# Authors: Akira Yokosawa <akiyks@gmail.com>
cat $1 |
- sed -e 's/Lines~\([0-9]\+\)-\([0-9]\+\)/Lines~\1--\2/g' \
- -e 's/Lines \([0-9]\+\)-\([0-9]\+\)/Lines~\1--\2/g' \
- -e 's/lines~\([0-9]\+\)-\([0-9]\+\)/lines~\1--\2/g' \
- -e 's/lines \([0-9]\+\)-\([0-9]\+\)/lines~\1--\2/g' \
- -e 's/Line~\([0-9]\+\)-\([0-9]\+\)/Lines~\1--\2/g' \
- -e 's/Line \([0-9]\+\)-\([0-9]\+\)/Lines~\1--\2/g' \
- -e 's/line~\([0-9]\+\)-\([0-9]\+\)/lines~\1--\2/g' \
- -e 's/line \([0-9]\+\)-\([0-9]\+\)/lines~\1--\2/g' \
+ sed -e 's/\([Ll]ines\?\)[ ~]\([0-9]\+\)-\([0-9]\+\)/\1~\2--\3/g' \
-e 's/Slides \([0-9]\+\)-\([0-9]\+\)/Slides~\1--\2/g' \
- -e 's/Figures~\(\\ref{.*}\)-\(\\ref{.*}\)/Figures~\1--\2/g' \
- -e 's/CPUs~\([0-9]\+\)-\([0-9]\+\)/CPUs~\1--\2/g' \
- -e 's/CPUs \([0-9]\+\)-\([0-9]\+\)/CPUs~\1--\2/g' \
- -e 's/and~\([0-9]\+\)-\([0-9]\+\)/and~\1--\2/g' \
- -e 's/and \([0-9]\+\)-\([0-9]\+\)/and~\1--\2/g' \
- -e 's/\(\\co{.*}\)-\(\\co{.*}\)/\1--\2/g' \
+ -e 's/Figures~\(\\ref{[^}]*}\)-\(\\ref{[^}]*}\)/Figures~\1--\2/g' \
+ -e 's/CPUs[ ~]\([0-9]\+\)-\([0-9]\+\)/CPUs~\1--\2/g' \
+ -e 's/and[ ~]\([0-9]\+\)-\([0-9]\+\)/and~\1--\2/g' \
+ -e 's/\(\\co{[^}]*}\)-\(\\co{[^}]*}\)/\1--\2/g' \
-e 's/\/\* Lines~\([0-9]\+\)--\([0-9]\+\) \*\//\/\* Lines \1-\2 \*\//g'
# Last pattern is to preserve "Lines n-m" in comments within code snippet
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 0/2] Add rules in hyphen2endash.sh
2016-09-18 14:24 [PATCH 0/2] Add rules in hyphen2endash.sh Akira Yokosawa
2016-09-18 14:26 ` [PATCH 1/2] hyphen2endash.sh: Add substitution patterns Akira Yokosawa
2016-09-18 14:28 ` [PATCH 2/2] hyphen2endash.sh: Merge subst patterns Akira Yokosawa
@ 2016-09-18 17:44 ` Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2016-09-18 17:44 UTC (permalink / raw)
To: Akira Yokosawa; +Cc: perfbook
On Sun, Sep 18, 2016 at 11:24:42PM +0900, Akira Yokosawa wrote:
> >From ec548ecfa8846f40731a0945853d3ac9018b4d71 Mon Sep 17 00:00:00 2001
> From: Akira Yokosawa <akiyks@gmail.com>
> Date: Sun, 18 Sep 2016 23:09:34 +0900
> Subject: [PATCH 0/2] Add rules in hyphen2endash.sh
>
> This is an update of scripts added in commit dd08907f289d
> ("Trial of replacing hyphens with en-dashes for number ranges").
>
> 1st patch adds patterns for the following:
> o CPUs~nn--mm
> o \co{xxx}--\co{yyy}
>
> It also fixes typo in the authors email address.
>
> 2nd patch merges several rules by using "[abc]" regex patterns.
Applied and pushed, thank you!
Thanx, Paul
> Akira Yokosawa (2):
> hyphen2endash.sh: Add substitution patterns
> hyphen2endash.sh: Merge subst patterns
>
> utilities/dohyphen2endash.sh | 2 +-
> utilities/hyphen2endash.sh | 23 +++++++++++------------
> 2 files changed, 12 insertions(+), 13 deletions(-)
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-09-18 17:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-18 14:24 [PATCH 0/2] Add rules in hyphen2endash.sh Akira Yokosawa
2016-09-18 14:26 ` [PATCH 1/2] hyphen2endash.sh: Add substitution patterns Akira Yokosawa
2016-09-18 14:28 ` [PATCH 2/2] hyphen2endash.sh: Merge subst patterns Akira Yokosawa
2016-09-18 17:44 ` [PATCH 0/2] Add rules in hyphen2endash.sh Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox