diff options
-rw-r--r-- | Makefile | 10 | ||||
-rwxr-xr-x | src/index.rb | 9 |
2 files changed, 11 insertions, 8 deletions
@@ -23,7 +23,7 @@ clean: rm -rf $(DOCSET_DIR) $(ARCHIVE_FILE) tmp: - mkdir $@ + mkdir -p $@ $(ARCHIVE_FILE): $(DOCSET) tar --exclude='.DS_Store' -czf $@ $(DOCSET_DIR) @@ -32,16 +32,16 @@ $(MANUAL_FILE): tmp curl -o $@ $(MANUAL_URL) $(DOCSET_DIR): - mkdir $@ + mkdir -p $@ $(CONTENTS_DIR): $(DOCSET_DIR) - mkdir $@ + mkdir -p $@ $(RESOURCES_DIR): $(CONTENTS_DIR) - mkdir $@ + mkdir -p $@ $(DOCUMENTS_DIR): $(RESOURCES_DIR) $(MANUAL_FILE) - mkdir $@ + mkdir -p $@ tar -x -z -f $(MANUAL_FILE) -C $@ $(INFO_PLIST_FILE): src/Info.plist $(CONTENTS_DIR) diff --git a/src/index.rb b/src/index.rb index c719fcc..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,9 +19,12 @@ 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.basename}: no title found" + $stderr.puts "#{path}: no title found" end end end |