我应该如何使用 Snow Leopard .help 包中的 help: URL?

发布于 2024-08-25 08:12:13 字数 3267 浏览 3 评论 0原文

我正在为我的应用程序编写帮助书。根据需要,我的应用程序的 info.plist 中有 CFBundleHelpBookName 和 CFBundleHelpBookFolder 键,并且我正在使用新的 Snow Leopard .help 捆绑包格式作为帮助手册。 Rehearsals.help/Contents/Info.plist 中的各个键均按照 Apple 帮助编程指南。正如预期的那样,当用户从“帮助”菜单中选择“排练帮助”时,我的帮助书的索引页(在适当的本地化版本中,目前只有英语)将在帮助查看器中打开。

然而,实际上(当前)捆绑包中有两个 HTML 文件:index.html 和 support.html。据我了解,如果我将命名锚点放在一个文件中,如下所示:

<a name="support"></a>

然后我可以从另一个文件链接到它,如下所示:

<a href="help:anchor=support bookID=info.thaesofereode.Rehearsals.help">Support</a>

但是,这不起作用。 帮助查看器也不会

<a href="help:anchor=support">Support</a>

显示“帮助查看器无法打开此内容”的工作表,并且如果我在帮助查看器和 helpd 中打开调试日志记录,我会看到以下内容:

10/03/2010 15:46:02 HelpViewer[2049]    decidePolicyForNavigationAction: help:anchor=support%20bookID=info.thaesofereode.Rehearsals.help
10/03/2010 15:46:02 HelpViewer[2049]    decidePolicyForNavigationAction: apple-help-content:help:anchor=support%2520bookID=info.thaesofereode.Rehearsals.help
10/03/2010 15:46:02 HelpViewer[2049]    willSendRequest: <NSMutableURLRequest apple-help-content:help:anchor=support%2520bookID=info.thaesofereode.Rehearsals.help>
10/03/2010 15:46:02 HelpViewer[2049]    Start loading apple-help-content:help:anchor=support%2520bookID=info.thaesofereode.Rehearsals.help
10/03/2010 15:46:02 HelpViewer[2049]    Starting search for query "support" with return port com.apple.helpd-26755
10/03/2010 15:46:02 helpd[2050] PID #2050 - received message #0: HPDStartMessageID
10/03/2010 15:46:02 helpd[2050] Process 2049 requested callback at com.apple.helpd-26755 and sent query: HPDQuery 289928762.026442: "support" in ("info.thaesofereode.Rehearsals.help") of types ("com.apple.HelpArticleResult") with limit 0
10/03/2010 15:46:02 helpd[2050] Run loops which have yet to start: (
    "com.apple.kbPlugin",
    "com.apple.helpbookPlugin"
)
10/03/2010 15:46:02 helpd[2050] Search for this query has been delayed 1 time: support
10/03/2010 15:46:02 helpd[2050] Delayed search for query: "support"
10/03/2010 15:46:02 helpd[2050] Starting help articles search for query: "support"
10/03/2010 15:46:02 helpd[2050] Query 289928762.026442 returned results: (
)
10/03/2010 15:46:02 helpd[2050] Response sent to port: com.apple.helpd-26755
10/03/2010 15:46:02 helpd[2050] Query finished: HPDQuery 289928762.026442: "support" in ("info.thaesofereode.Rehearsals.help") of types ("com.apple.HelpArticleResult") with limit 0
10/03/2010 15:46:02 helpd[2050] Response sent to port: com.apple.helpd-26755
10/03/2010 15:46:02 HelpViewer[2049]    <HVAnchorURLHandler: 0x1002bde50> finished query: HPDQuery 289928762.026442: "support" in ("info.thaesofereode.Rehearsals.help") of types ("com.apple.HelpArticleResult") with limit 0
10/03/2010 15:46:02 HelpViewer[2049]    <HVAnchorURLHandler: 0x1002bde50> has results: {
}
10/03/2010 15:46:02 HelpViewer[2049]    Found no results for support

如何在 Snow Leopard 帮助包中正确使用帮助:URL? (不用说,我知道使用相对文件 URL 的解决方法,并且这是有效的,但我希望获得帮助锚点来提供上下文帮助和应用程序内的链接。)

I'm writing the help book for my application. As required, I have the CFBundleHelpBookName and CFBundleHelpBookFolder keys in my app's info.plist, and I'm using the new Snow Leopard .help bundle format for the help book. The various keys in Rehearsals.help/Contents/Info.plist are all populated as per the Apple Help Programming Guide. As expected, when a user chooses "Rehearsals Help" from the Help menu, the index page of my help book (in the appropriate localisation, currently only English) is opened in Help Viewer.

However there are actually (currently) two HTML files in the bundle, index.html and support.html. It's my understanding that if I place a named anchor in one file, like this:

<a name="support"></a>

Then I can link to it from the other file, like this:

<a href="help:anchor=support bookID=info.thaesofereode.Rehearsals.help">Support</a>

However that doesn't work. Neither does:

<a href="help:anchor=support">Support</a>

Help viewer displays a sheet saying "Help Viewer cannot open this content.", and if I turn on debug logging in Help Viewer and helpd, I see this:

10/03/2010 15:46:02 HelpViewer[2049]    decidePolicyForNavigationAction: help:anchor=support%20bookID=info.thaesofereode.Rehearsals.help
10/03/2010 15:46:02 HelpViewer[2049]    decidePolicyForNavigationAction: apple-help-content:help:anchor=support%2520bookID=info.thaesofereode.Rehearsals.help
10/03/2010 15:46:02 HelpViewer[2049]    willSendRequest: <NSMutableURLRequest apple-help-content:help:anchor=support%2520bookID=info.thaesofereode.Rehearsals.help>
10/03/2010 15:46:02 HelpViewer[2049]    Start loading apple-help-content:help:anchor=support%2520bookID=info.thaesofereode.Rehearsals.help
10/03/2010 15:46:02 HelpViewer[2049]    Starting search for query "support" with return port com.apple.helpd-26755
10/03/2010 15:46:02 helpd[2050] PID #2050 - received message #0: HPDStartMessageID
10/03/2010 15:46:02 helpd[2050] Process 2049 requested callback at com.apple.helpd-26755 and sent query: HPDQuery 289928762.026442: "support" in ("info.thaesofereode.Rehearsals.help") of types ("com.apple.HelpArticleResult") with limit 0
10/03/2010 15:46:02 helpd[2050] Run loops which have yet to start: (
    "com.apple.kbPlugin",
    "com.apple.helpbookPlugin"
)
10/03/2010 15:46:02 helpd[2050] Search for this query has been delayed 1 time: support
10/03/2010 15:46:02 helpd[2050] Delayed search for query: "support"
10/03/2010 15:46:02 helpd[2050] Starting help articles search for query: "support"
10/03/2010 15:46:02 helpd[2050] Query 289928762.026442 returned results: (
)
10/03/2010 15:46:02 helpd[2050] Response sent to port: com.apple.helpd-26755
10/03/2010 15:46:02 helpd[2050] Query finished: HPDQuery 289928762.026442: "support" in ("info.thaesofereode.Rehearsals.help") of types ("com.apple.HelpArticleResult") with limit 0
10/03/2010 15:46:02 helpd[2050] Response sent to port: com.apple.helpd-26755
10/03/2010 15:46:02 HelpViewer[2049]    <HVAnchorURLHandler: 0x1002bde50> finished query: HPDQuery 289928762.026442: "support" in ("info.thaesofereode.Rehearsals.help") of types ("com.apple.HelpArticleResult") with limit 0
10/03/2010 15:46:02 HelpViewer[2049]    <HVAnchorURLHandler: 0x1002bde50> has results: {
}
10/03/2010 15:46:02 HelpViewer[2049]    Found no results for support

How do I use help: URLs correctly in Snow Leopard help bundles? (Needless to say I know the workaround to use relative file URLs, and that works, but I want to get help anchors working for context help and linking within the app.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

请帮我爱他 2024-09-01 08:12:13

事实证明,这些锚点和 URL 是正确的,并且有助于自动索引内容,但它会维护积极的缓存。如果更新帮助手册时没有更改版本号,则它不会扫描新的锚点。

rm -rf ~/Library/Caches/com.apple.help*
killall helpd

It turns out those anchors and URLs are correct, and helpd does index content automatically, but it maintains an aggressive cache. If the help book is updated without bumping the version number, it doesn't scan for new anchors.

rm -rf ~/Library/Caches/com.apple.help*
killall helpd
红ご颜醉 2024-09-01 08:12:13

您是否使用“帮助索引器”实用程序首选项中选择的锚索引对帮助手册进行索引?
看起来像是锚点而不是索引...

当然我也会检查我的锚点名称,但我在做或说完之后 10 分钟就忘记了...

Did you index your help book with anchor indexing selected in the Help Indexer utility’s preferences?
Seems like anchor not index...

Of course I also would check my anchors names since, but I forget things 10 minutes after doing or saying them...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文