帮助手册中的锚不起作用 [英] Anchors in help-book not working

查看:117
本文介绍了帮助手册中的锚不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经仔细检查了所有内容,希望有人能找到我没有看到的愚蠢错误.

我正在尝试为我的应用程序构建一个Apple帮助部分,它可以正确转到登录页面,但是所有锚点均无效.登陆页面称为 index.html ,另一页面称为 test.html ,位于 pgs 目录中.

在index.html中,我有:

 < a href ="help:anchor = support bookID = com.company.app_name.help">链接到另一个页面</a> 

在test.html中,我有:

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

因此,这是我为了现在所处位置所遵循的步骤:

1)我构建了

这也是我 index.html 的代码:

 <!DOCTYPE html PUBLIC-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><; html xmlns ="http://www.w3.org/1999/xhtml">< head>< title> AppName帮助</title>< meta http-equiv ="Content-Type" content ="text/html; charset = utf-8"/><元名称=机器人" content ="noindex"/>< meta name ="AppleTitle" content ="AppName帮助"/>< meta name ="AppleIcon" content ="../shrd/icon.png"/></head><身体>< a href ="help:anchor = support bookID = com.company.app_name.help">链接到另一个页面</a></body> 

这是 test.html的代码.

 <?xml version ="1.0" encoding ="utf-8" standalone ="no"?><!DOCTYPE html PUBLIC-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">< html xmlns ="http://www.w3.org/1999/xhtml">< head>< title>测试链接</title>< meta http-equiv ="Content-Type" content ="text/html; charset = utf-8"/><元名称=机器人" content =锚"/></head><身体>< a name ="support"></a>链接有效吗?< br/></body></html> 

这是我的帮助文件的Info.plist .

 <?xml version ="1.0" encoding ="UTF-8"?><!DOCTYPE plist PUBLIC-//Apple//DTD PLIST 1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd">< plist version ="1.0">< dict>< key> CFBundleDevelopmentRegion</key>< string> en_us</string>< key> CFBundleIdentifier</key>< string> com.company.app_name.help</string>< key> CFBundleInfoDictionaryVersion</key>< string> 6.0</string>< key> CFBundleName</key>< string> AppName</string>< key> CFBundlePackageType</key>< string> BNDL</string>< key> CFBundleShortVersionString</key>< string> 2</string>< key> CFBundleSignature</key>< string> hbwr</string>< key> CFBundleVersion</key>< string> 2</string>< key> CFBundleHelpBookName</key>< string> AppName帮助</string>< key> HPDBookAccessPath</key>< string> index.html</string>< key> HPDBookIconPath</key>< string> shrd/icon.png</string>< key> HPDBookIndexPath</key>< string> search.helpindex</string>< key> HPDBookKBProduct</key>< string> app_name1</string>< key> HPDBookKBURL</key>< string> http://www.company.com</string>< key> HPDBookRemoteURL</key>< string> http://www.company.com</string>< key> HPDBookTitle</key>< string> AppName帮助</string>< key> HPDBookType</key>< string> 3</string></dict></plist> 

我也关注了这篇文章: http://www.cocoabuilder.com/archive/cocoa/312037-updating-an-app-help.html ,除了重新索引目录之外,每次进行更改时都要清除缓存.

谢谢!

解决方案

当然,David,感谢您的提醒.

根据我记得的内容和草率的文档,我运行以下命令来索引帮助文档文件:

  hiutil -vCaf ./search.helpindex English.lproj 

但是我意识到的一件事是,只要使用& nbsp; 字符,索引实用程序就会抱怨.而是用字符&#32;

我认为这就是我的问题.

I've double checked everything and hoping someone can find a stupid mistake that I'm not seeing.

I'm trying to build a Apple Help section for my application and it correctly goes to the landing page however none of the anchors work. The landing page is called index.html and the other page is called test.html which is located in the pgs directory.

In index.html I have:

<a href="help:anchor=support bookID=com.company.app_name.help">Link to another page</a>

In test.html I have:

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

So here's the steps that I followed in order to get to where I am right now:

1) I built the directory as specified by the Apple documentation

AppName.help/
    Contents/
        Info.plist
        Resources/
            shrd/
            English.lproj/
                index.html
                search.helpindex
                pgs/
                    test.html

2) I built the Help Info.plist as specified in the Apple documentation. Included in the Info.plist I set the CFBundleIdentifier to com.company.app_name.help.

3) In my app Info.plist I set the CFBundleHelpBookFolder to AppName.help and set CFBundleHelpBookName to com.company.app_name.help

4) I then copied the directory that I built into Xcode while ensuring that I selected the option Create Folder References for any added folders.

5) Then I used Help Indexer to index the directory AppName.help. Making sure that I select the option to Index anchor information in all files.I then copied the .helpindex file to the English.lproj folder where it's supposed to be.

That's it. There's a couple of things that I noticed about my application if I place the following link in the index.html file it works correctly.

<a href="pgs/test.html">Click this link</a>                 

Also here is my code for the index.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>AppName Help</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="robots" content="noindex" />
    <meta name="AppleTitle" content="AppName Help" />
    <meta name="AppleIcon" content="../shrd/icon.png" />
</head>
<body>
    <a href="help:anchor=support bookID=com.company.app_name.help">Link to another page</a>
</body>

Here is the code for the test.html.

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Testing Links</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="robots" content="anchors" />
    </head>
    <body>
        <a name="support"></a>Does linking work?<br/>

    </body>
</html>

Here is the Info.plist for my Help file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>en_us</string>
    <key>CFBundleIdentifier</key>
    <string>com.company.app_name.help</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>AppName</string>
    <key>CFBundlePackageType</key>
    <string>BNDL</string>
    <key>CFBundleShortVersionString</key>
    <string>2</string>
    <key>CFBundleSignature</key>
    <string>hbwr</string>
    <key>CFBundleVersion</key>
    <string>2</string>
    <key>CFBundleHelpBookName</key>
    <string>AppName Help</string>
    <key>HPDBookAccessPath</key>
    <string>index.html</string>
    <key>HPDBookIconPath</key>
    <string>shrd/icon.png</string>
    <key>HPDBookIndexPath</key>
    <string>search.helpindex</string>
    <key>HPDBookKBProduct</key>
    <string>app_name1</string>
    <key>HPDBookKBURL</key>
    <string>http://www.company.com</string>
    <key>HPDBookRemoteURL</key>
    <string>http://www.company.com</string>
    <key>HPDBookTitle</key>
    <string>AppName Help</string>
    <key>HPDBookType</key>
    <string>3</string>
</dict>
</plist>

Also I followed this post:http://www.cocoabuilder.com/archive/cocoa/312037-updating-an-app-help.html to clear out the cache every time I make a change in addition to re-indexing the directory.

Thanks all!

解决方案

Sure David, Thanks for the reminder.

From what I recall and my sloppy documentation I run the following command to index the help documentation files:

hiutil -vCaf ./search.helpindex English.lproj

However one thing that I realized is the index utility will complain any time the &nbsp; character is used. Instead substitute the character &#32;

I think that was the bug in my case.

这篇关于帮助手册中的锚不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆