diff options
author | Karl Berry <karl@freefriends.org> | 2011-08-11 18:03:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-08-11 18:03:01 +0000 |
commit | af36b8b8cf0b062904823fbaa99efa81f1a04ab8 (patch) | |
tree | ac1e3abf81c59149e2e0a8cc5198413dae7e9611 /Build/source/texk | |
parent | 76ef14b63cb828fe036a1a070fb7913567fa9fa8 (diff) |
match_parens ruby script (30jul11)
git-svn-id: svn://tug.org/texlive/trunk@23500 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
3 files changed, 63 insertions, 0 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am index 09a659e373e..0891b7cd457 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.am +++ b/Build/source/texk/texlive/linked_scripts/Makefile.am @@ -95,6 +95,7 @@ texmf_dist_other_scripts = \ latexdiff/latexrevise.pl \ latexmk/latexmk.pl \ luaotfload/mkluatexfontdb.lua \ + match_parens/match_parens \ mathspic/mathspic.pl \ mf2pt1/mf2pt1.pl \ mkjobtexmf/mkjobtexmf.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in index cea9cc9300a..7e8fb94fc84 100644 --- a/Build/source/texk/texlive/linked_scripts/Makefile.in +++ b/Build/source/texk/texlive/linked_scripts/Makefile.in @@ -233,6 +233,7 @@ texmf_dist_other_scripts = \ latexdiff/latexrevise.pl \ latexmk/latexmk.pl \ luaotfload/mkluatexfontdb.lua \ + match_parens/match_parens \ mathspic/mathspic.pl \ mf2pt1/mf2pt1.pl \ mkjobtexmf/mkjobtexmf.pl \ diff --git a/Build/source/texk/texlive/linked_scripts/match_parens/match_parens b/Build/source/texk/texlive/linked_scripts/match_parens/match_parens new file mode 100755 index 00000000000..b5c0fa18da1 --- /dev/null +++ b/Build/source/texk/texlive/linked_scripts/match_parens/match_parens @@ -0,0 +1,61 @@ +#!/usr/bin/env ruby + +=begin rdoc + +== match_parens - find mismatches of parentheses, braces, (angle) brackets, in texts + +== Synopsis + + match_parens [_filename_] + +== Description + +Mismatches of parentheses, braces, (angle) brackets, especially in TeX +sources which may be rich in those, may be difficult to trace. This +little script helps you by writing your text to standard output, after +adding a left margin to your text, which will normally be almost empty, +but will clearly show any mismatches. (Just try me on myself to see that +the parenthesis starting this sentence will not appear to be matched at +the end of the file. If you look at me in the vim editor, try the command +:%!% + +=== Copyright + +Copyright (C) 2009 Wybo Dekker (<tt>wybo@dekkerdocumenten.nl</tt>) + +This program is free software: you can redistribute it and/or modify it +under the terms of the {GNU General Public License}[http://www.gnu.org/licenses/] +as published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but without any warranty; without even the implied warranty of +merchantability or fitness for a particular purpose. See the {GNU +General Public License}[http://www.gnu.org/licenses/] for more details. + +$Id: match_parens,v 1.7 2011-07-30 09:31:24 wybo Exp $ +=end + +private + s, n, html, parens = +'', '0', false, '^{}[]()' + +RELEASE = 1.3 + +while gets() + if html + if ~/^=end/ || ~/<\/html>/i + html = false + parens = '^{}[]()' + end + else + if ~/^=begin rdoc/ || ~/\<html\>/i + html = true + parens = '^{}[]()<>' + end + end + # look for <> in html or rdoc: + s << $_.tr(parens,'') + while s.gsub!(/\{\}|\(\)|\[\]|<>/,'') do end + puts [n.next!,s,$_].join("\t") +end |