xcode 如何使用 appledoc 生成类似 Apple 的文档

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9807780/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:44:40  来源:igfitidea点击:

how to use appledoc to generate an Apple-like documentations

xcodeappledoc

提问by tranvutuan

I am reading on the article how to generate an Apple-like HTML documentation at here. My questions are what the command lines are used for. How can we combine command lines and appledoc xcode project to generate a HTML.

我正在阅读如何在此处生成类似 Apple 的 HTML 文档的文章。我的问题是命令行的用途。我们如何结合命令行和 appledoc xcode 项目来生成 HTML。

回答by Tom

I'm the author of appledoc tool. The tool is intended to be used as answered by Caleb above. Recommended installation method is to clone repository from GitHub, open project in Xcode, build and optionally copy binary to your path as suggested above. Additionally, you must also copy template files required for running the tool to one of predefined paths. All the steps required are described in the readme file on appledoc page on GitHub, see Quick Install section.

我是 appledoc 工具的作者。该工具旨在按照上面 Caleb 的回答使用。推荐的安装方法是从 GitHub 克隆存储库,在 Xcode 中打开项目,构建并选择将二进制文件复制到您的路径,如上所示。此外,您还必须将运行该工具所需的模板文件复制到预定义路径之一。所需的所有步骤都在GitHub上 appledoc 页面上的自述文件中进行了描述,请参阅快速安装部分。

There are also other methods for installing - all contribution from users:

还有其他安装方法 - 来自用户的所有贡献:

  • You can use install-appledoc.shscript included in the git repository.
  • There's also homebrewrecipe available, although it doesn't install template files to my understanding (see this link).
  • 您可以使用install-appledoc.shgit 存储库中包含的脚本。
  • 还有可用的自制配方,尽管它没有安装我理解的模板文件(请参阅此链接)。

For any additional questions go to appledoc Google group. I just created it few days ago, so there's no content at the moment of this writing, but feel free to ask questions there.

如有任何其他问题,请访问appledoc Google group。我前几天刚创建的,所以在写这篇文章的时候没有内容,但请随时在那里提问。

回答by Caleb

I haven't used 'appledoc', but from a quick look at the page you linked it appears that it's an open-source command-line utility. So the first step will be to compile the 'appledoc' program itself, and then stick it in a directory that's in your path, such as /usr/local/binor ~/bin/.

我没有使用过“appledoc”,但是从快速查看您链接的页面看来,它是一个开源命令行实用程序。因此,第一步将是编译“appledoc”程序本身,然后将其粘贴到您路径中的目录中,例如/usr/local/binor ~/bin/

The next step is to try to use it to generate some documentation (assuming that you've already created the markdown files that it consumes). Open a terminal window, navigate to the directory where your files are, and then use the command given at the top of the page that you linked:

下一步是尝试使用它来生成一些文档(假设您已经创建了它使用的 Markdown 文件)。打开终端窗口,导航到文件所在的目录,然后使用您链接的页面顶部给出的命令:

appledoc --project-name appledoc --project-company "Gentle Bytes" --company-id com.gentlebytes --output ~/help .

If you want to use 'appledoc' to regenerate your documentation every time you build some project, you can add a "Run Script" build phase to an existing target in your project, or create a new target just for documentation that has nothing but a "Run Script" build phase. Either way, the script in that phase should be shell script containing a command similar to the one above (though you'll probably want to specify the source directory explicitly rather than just using the 'current' directory, i.e. .).

如果您想在每次构建某个项目时使用“appledoc”来重新生成文档,您可以将“运行脚本”构建阶段添加到项目中的现有目标,或者仅为文档创建一个新目标,该目标只有一个“运行脚本”构建阶段。无论哪种方式,该阶段的脚本都应该是包含类似于上述命令的 shell 脚本(尽管您可能希望明确指定源目录而不是仅使用“当前”目录,即.)。

回答by Kevin Delord

As I found on this post, you can generate a complete HTML documentation of your code with this command line:

正如我在这篇文章中发现,您可以使用以下命令行生成代码的完整 HTML 文档:

appledoc --project-name BabelCPP --project-company "My Name" --company-id com.mycompany --no-create-docset --output ./doc/ .

appledoc --project-name BabelCPP --project-company "我的名字" --company-id com.mycompany --no-create-docset --output ./doc/ .

The last "." is the path to your code.

最后 ”。” 是您的代码的路径。