summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/match_parens/match_parens25
-rw-r--r--Master/texmf-dist/doc/support/match_parens/README2
-rw-r--r--Master/texmf-dist/doc/support/match_parens/match_parens.pdfbin56974 -> 57068 bytes
-rwxr-xr-xMaster/texmf-dist/scripts/match_parens/match_parens25
4 files changed, 27 insertions, 25 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/match_parens/match_parens b/Build/source/texk/texlive/linked_scripts/match_parens/match_parens
index e6f74663902..5387e908d9d 100755
--- a/Build/source/texk/texlive/linked_scripts/match_parens/match_parens
+++ b/Build/source/texk/texlive/linked_scripts/match_parens/match_parens
@@ -2,7 +2,7 @@
# encoding: utf-8
MYNAME = File.basename($0)
-Version = '1.42'
+Version = '1.43'
<<'DOC'
= match_parens - find mismatches of various brackets and quotes
@@ -115,8 +115,8 @@ DOC
require 'optparse'
-number, input, latex, n, s, html, test, parenstext =
- 10, STDIN, false, 10, '', false, false, %q{{}[]()""“”''‘’}
+number, input, latex, lineno, s, html, test, parenstext =
+ 10, STDIN, false, 0, '', false, false, %q{{}[]()""“”''‘’}
ARGV.options do |opt|
opt.banner = "#{MYNAME} - find mismatches of parentheses, braces, (angle) brackets, in texts\n"
@@ -132,8 +132,7 @@ ARGV.options do |opt|
end
opt.on('-l','--latex',
'convert ``...'' to “...” before testing') do
- puts opt.to_s.sub(/^ *-I\n/,'')
- exit
+ latex=true
end
opt.on('-V','--version',
'print version and exit') do
@@ -164,24 +163,26 @@ unless arg.empty?
end
while x = input.gets()
# convert LaTeX's ``...'' to “...”
- x = x.gsub(/``/,'“').gsub(/''/,'”')
+ if latex
+ x = x.gsub(/``/,'“').gsub(/''/,'”')
+ end
# only inside html text we check <>, too:
if html && (x=~/^([# ]*=end)/ || x=~/<\/html>/i)
- html = false
- parens = parenstext
+ html = false
+ parens = parenstext
elsif x=~/^([# ]*=begin rdoc)/ || x=~/<html>/i
- html = true
- parens = parenshtml
+ html = true
+ parens = parenshtml
end
# match any pair like (), {}, [], “”, <> in parens
re = Regexp.new(parens.scan(/../).join('|').gsub(/[{}()\[\]]/,'\\\\\&'))
- # remove {x} where x in []{}()<>, copy all parens to s
+ # move parens' characters into s
s << x.tr('^'+parens,'')
# remove matches from inside
while s.gsub!(re,'') do end
- puts "%4d | %-*s | %s" % [n+=1,number,s.slice(0..number-1),x]
+ puts "%4d | %-*s | %s" % [lineno+=1,number,s.slice(0..number-1),x]
end
if test
diff --git a/Master/texmf-dist/doc/support/match_parens/README b/Master/texmf-dist/doc/support/match_parens/README
index 0f85ac80296..115d88f9533 100644
--- a/Master/texmf-dist/doc/support/match_parens/README
+++ b/Master/texmf-dist/doc/support/match_parens/README
@@ -4,7 +4,7 @@
type:| ruby
author:| Wybo Dekker
email:| wybo@dekkerdocumenten.nl
-version:| 1.42
+version:| 1.43
license:| Released under the GNU General Public License
Mismatches of parentheses, braces, (angle) brackets, especially in TeX
diff --git a/Master/texmf-dist/doc/support/match_parens/match_parens.pdf b/Master/texmf-dist/doc/support/match_parens/match_parens.pdf
index e137ea6d46b..59f9f99b156 100644
--- a/Master/texmf-dist/doc/support/match_parens/match_parens.pdf
+++ b/Master/texmf-dist/doc/support/match_parens/match_parens.pdf
Binary files differ
diff --git a/Master/texmf-dist/scripts/match_parens/match_parens b/Master/texmf-dist/scripts/match_parens/match_parens
index e6f74663902..5387e908d9d 100755
--- a/Master/texmf-dist/scripts/match_parens/match_parens
+++ b/Master/texmf-dist/scripts/match_parens/match_parens
@@ -2,7 +2,7 @@
# encoding: utf-8
MYNAME = File.basename($0)
-Version = '1.42'
+Version = '1.43'
<<'DOC'
= match_parens - find mismatches of various brackets and quotes
@@ -115,8 +115,8 @@ DOC
require 'optparse'
-number, input, latex, n, s, html, test, parenstext =
- 10, STDIN, false, 10, '', false, false, %q{{}[]()""“”''‘’}
+number, input, latex, lineno, s, html, test, parenstext =
+ 10, STDIN, false, 0, '', false, false, %q{{}[]()""“”''‘’}
ARGV.options do |opt|
opt.banner = "#{MYNAME} - find mismatches of parentheses, braces, (angle) brackets, in texts\n"
@@ -132,8 +132,7 @@ ARGV.options do |opt|
end
opt.on('-l','--latex',
'convert ``...'' to “...” before testing') do
- puts opt.to_s.sub(/^ *-I\n/,'')
- exit
+ latex=true
end
opt.on('-V','--version',
'print version and exit') do
@@ -164,24 +163,26 @@ unless arg.empty?
end
while x = input.gets()
# convert LaTeX's ``...'' to “...”
- x = x.gsub(/``/,'“').gsub(/''/,'”')
+ if latex
+ x = x.gsub(/``/,'“').gsub(/''/,'”')
+ end
# only inside html text we check <>, too:
if html && (x=~/^([# ]*=end)/ || x=~/<\/html>/i)
- html = false
- parens = parenstext
+ html = false
+ parens = parenstext
elsif x=~/^([# ]*=begin rdoc)/ || x=~/<html>/i
- html = true
- parens = parenshtml
+ html = true
+ parens = parenshtml
end
# match any pair like (), {}, [], “”, <> in parens
re = Regexp.new(parens.scan(/../).join('|').gsub(/[{}()\[\]]/,'\\\\\&'))
- # remove {x} where x in []{}()<>, copy all parens to s
+ # move parens' characters into s
s << x.tr('^'+parens,'')
# remove matches from inside
while s.gsub!(re,'') do end
- puts "%4d | %-*s | %s" % [n+=1,number,s.slice(0..number-1),x]
+ puts "%4d | %-*s | %s" % [lineno+=1,number,s.slice(0..number-1),x]
end
if test