diff options
Diffstat (limited to 'src/index.rb')
-rwxr-xr-x | src/index.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/index.rb b/src/index.rb index ec861a5..da58535 100755 --- a/src/index.rb +++ b/src/index.rb @@ -9,7 +9,7 @@ INSERT_SQL = %Q[ INSERT INTO searchIndex(name, type, path) VALUES ('%s','%s','%s'); ] -PATTERN = %r[<title>GNU make: (.+)</title>] +PATTERN = %r[<title>(.+)</title>] def quote(s) s.gsub(/&/, '&').gsub(/'/, "\\'") @@ -19,7 +19,10 @@ ARGV.each do |arg| Pathname.glob(arg) do |path| match = path.each_line.lazy.map { |line| PATTERN.match(line) }.find { |m| m } if match - printf INSERT_SQL, quote(match[1]), 'Guide', path.basename + title = match[1] + title.delete_prefix!('GNU make: ') # older docs + title.delete_suffix!(' (GNU make)') # newer docs + printf INSERT_SQL, quote(title), 'Guide', path.basename else $stderr.puts "#{path}: no title found" end |