{"id":37,"date":"2009-06-29T23:07:37","date_gmt":"2009-06-30T04:07:37","guid":{"rendered":"http:\/\/developer.casgrain.com\/?p=37"},"modified":"2009-06-29T23:09:33","modified_gmt":"2009-06-30T04:09:33","slug":"open-any-page-or-location-in-your-help-book","status":"publish","type":"post","link":"http:\/\/developer.casgrain.com\/?p=37","title":{"rendered":"Open any page or location in your Help Book"},"content":{"rendered":"<h3>Anchors<\/h3>\n<p>\nSo you <a href=\"http:\/\/developer.casgrain.com\/?p=16\">wrote your documentation using VoodooPad<\/a> and you want to open a page of your choice, for instance, the &#8220;Quick Start&#8221; page. <br \/>But you don&#8217;t want this page to be the index page.<\/p>\n<p>\nYou know you can open your Help Book with this code:<\/p>\n<pre>\n[[NSApplication sharedApplication] showHelp: nil];\n<\/pre>\n<p>\nWhat you want to use is this:<\/p>\n<pre>\nNSString* bookName = [[NSBundle mainBundle] \n                              objectForInfoDictionaryKey: @\"CFBundleHelpBookName\"];\n[[NSHelpManager sharedHelpManager] openHelpAnchor: @\"__ANCHOR__\" inBook: bookName];\n<\/pre>\n<p>(where <code>__ANCHOR__<\/code> is an actual HTML anchor in your Help Book)<\/p>\n<h3>Creating the anchors<\/h3>\n<p>There are two parts to this. First, create page aliases in VoodooPad and second, update your <code>WebExportPageTemplate<\/code> to output those aliases.<\/p>\n<h4>VoodooPad Page Aliases<\/h4>\n<p>Any page in VoodooPad can have one or more aliases. They can be added by clicking the <strong>Info<\/strong> button on the Toolbar and clicking on the &#8220;+&#8221; button at the bottom of the Info panel. You can add as many as you want.<\/p>\n<p>\n<em>Tip:<\/em> If you have multiple languages for your Help file, make sure that the aliases match the <code>openHelpAnchor:<\/code> above. Since this string is not user-visible, it makes sense that it be the same across all Help files.<\/p>\n<h4>Modifying the page template<\/h4>\n<p>In your VoodooPad document, open the <code>WebExportPageTemplate<\/code> page. <br \/>\nOn that page, insert the following code at a proper location (for instance, just after the <code>&lt;body&gt;<\/code>tag):<\/p>\n<p><pre>\n&lt;a name = \"$alias$\"&gt;&lt;\/a&gt;\n<\/pre>\n<p>\n<code>$alias$<\/code> is a special <a href=\"http:\/\/www.flyingmeat.com\/fs\/flystashweb.cgi\/33e3c704-3124-01da-160e-c0cbe4c4be5d\">VoodooPad variable<\/a> that is replaced by the first alias in the list you defined above. It can also be called <code>$alias[0]$<\/code>.<\/p>\n<p>\nIf you have more than one alias, and you want to have multiple anchors in your page (for instance, a header and a footer), you can use <code>$alias[1]$<\/code>, <code>$alias[2]$<\/code>, etc. But in general, your help pages will be small enough that one anchor\/alias per page should be sufficient to open a given page in your Help book, directly from your application.<\/p>\n<p><h4>Indexing<\/h4>\n<p>Make sure you actually run the Help Indexer application on your HTML Help folder. <\/p>\n<p><pre>\n#!\/bin\/sh\n\"\/Developer\/Applications\/Utilities\/Help Indexer.app\/Contents\/MacOS\/Help Indexer\" \\ \n               \"$VPWebExportOutputDirectory\"\n<\/pre>\n<p>\nThis step is necessary for the Help System to find your anchors by name.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Anchors So you wrote your documentation using VoodooPad and you want to open a page of your choice, for instance, the &#8220;Quick Start&#8221; page. But you don&#8217;t want this page to be the index page. You know you can open your Help Book with this code: [[NSApplication sharedApplication] showHelp: nil]; What you want to use [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,5],"tags":[],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-development","category-macosx"],"_links":{"self":[{"href":"http:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/developer.casgrain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=37"}],"version-history":[{"count":5,"href":"http:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":42,"href":"http:\/\/developer.casgrain.com\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions\/42"}],"wp:attachment":[{"href":"http:\/\/developer.casgrain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/developer.casgrain.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/developer.casgrain.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}