Permalink
Browse files

Working

  • Loading branch information...
1 parent 9db933d commit ffc6b6f22ee1b466d6fab9f23f149b288046230d @nickg committed Jun 18, 2008
Showing with 17 additions and 0 deletions.
  1. +2 −0 bibtex/lexer.rb
  2. +1 −0 bibtex/parser.rb
  3. +14 −0 tara_no_url.rb
View
@@ -115,6 +115,8 @@ def skip_whitespace
@scanner.skip /\s+/
elsif @ignore_whitespace then
@scanner.skip /[ \t\r]+/
+ elsif @ignore_newlines then
+ @scanner.skip /[\r\n]+/
end
end
end
View
@@ -53,6 +53,7 @@ def self.parse_value
brace_count = 1
str = ''
@lexer.ignore_whitespace = false
+ @lexer.ignore_newlines = true
loop do
unless @lexer.more_tokens?
raise 'Unexpected end of input'
View
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+
+#
+# Strip URL fields from each BibTeX file on the command line.
+# Write the output to filename.stripped.bib
+#
+
+require 'bibtex/parser'
+
+ARGV.each do |file|
+ BibTeX::Parser.parse(file).map do |entry|
+ entry.reject_fields [:url]
+ end.save(file.sub(/\.bib$/, 'stripped.bib'))
+end

0 comments on commit ffc6b6f

Please sign in to comment.