Okay, I have got Apple Help working for my application (the first time I have written a help book), and I wanted to encapsulate some of what I have learned in a message, in case others might benefit. The docs about how to set up help are good, but still (for me) left some questions unanswered. I used Affrus help (you can download the program and inspect it; the help was written by Matt Neuburg) as a model and used VoodooPad's HTML exporting capabilities in order to create a help system with many crosslinks. VoodooPad has been working really well for me in this capacity, but I needed to make a few changes to the resulting HTML:

1. Add the Apple meta tags to index.html
2. Add <title>Title Here</title>  to each page.

You need (1) to get everything to work. You need (2) to make help searchable from the "Ask a question" field in the help app. This poses a problem, because each time I export the help pages from VoodooPad, these tags are missing. So, I set up a Ruby script to do so automatically. I don't know much Ruby, but I was able to piece together the following:

!/usr/bin/ruby

# Change method
def Change(file, regex_to_find, text_to_put_in_place)
  text= File.read file
File.open(file, 'w+'){|f| f << text.gsub(regex_to_find, text_to_put_in_place)}
end

# Add the apple-specific meta tags to index.html
Change('index.html',
/6\">
<style type="text\/css">/,
"6\">
<meta name=\"AppleTitle\" content=\"My Help\">
<meta name=\"AppleIcon\" content=\"AppName%20Help/images/icon-name.png \">
<style type=\"text/css\">")

# index.html: Add title - have one of these for each .html file
Change('index.html',
/<title></,
"<title>Index of topics<")

There is probably a way to automate this further, but at least it means I don't have to edit the exported HTML by hand each time.

Finally, I would end up having my cocoa app still display the old help when I wiped out the old help files and replaced them with new ones. In order to get the new help book recognised, I (1) delete ~/Library/ caches/com.apple.helpui; and (2) delete references and re-reference the help files in Xcode.

Thanks to all those who helped with with various pieces of this solution.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to