OpenCASCADE Documentation System
eryar@163.com
Abstract. Doxygen is the de facto standard tool for generating documentation from annotated C++ sources, but it also supports other popular programming languages. You can also use doxygen for creating normal documentation, as OpenCASCADE did for its references and user’s guide documents.
Key Words. OpenCASCADE, Doxygen, Documentation System
1. Introduction
Doxygen基本上已經成了從C++代碼生成文檔的一個標準工具。OpenCASCADE就利用Doxygen來根據源代碼生成References文檔,還利用其生成HTML和PDF格式的User Guide文檔。使用Doxygen來生成文檔,只需要按照一定的格式,就可以自動生成看上去比較專業的文檔。
本文主要對Doxygen用來生成User Guide的方法做一定的介紹。根據代碼生成References文檔的方法請參考Doxygen的文檔說明。
Figure 1.1 Doxygen GUI
2. Prerequisites
為了自動生成PDF格式的文檔,還需要準備全如下工具:
v Doxygen 1.8.4版本及以上;
v Graphviz的Dot,用來生成文檔中的類圖;
v MikTeX:用來生成PDF格式的文檔;
v Inkscape:只有當要生成PDF格式中帶有SVG格式的圖片時需要;
v MathJax:當生成的HTML或CHM中有數學公式時需要;
這些工具都可以從網上下載得到。
3. Markdown Support of Doxygen
Markdown支持是從Doxygen1.8.0開始的,Markdown就是還格式語法的普通文本,由John Gruber編寫,其目的是:
The design goal for Markdown’s formatting syntax is to make it as readable as possible. The idea is that a Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. While Markdown’s syntax has been influenced by several existing text-to-HTML filters, the single biggest source of inspiration for Markdown’s syntax is the format of plain text email.
當你按照Markdown格式來寫文檔時,只需要將*.md文件放到文檔文件夾中,Doxygen會自動搜索并生成相對應的文檔。這里列舉幾個Markdown的例子。
3.1 Tables表格
生成表格可以用如下的文本來表示:
生成的表格樣式如下圖所示:
Figure 3.1 Tables in Markdown
3.2 Code Blocks代碼片段
使用~~來隔離代碼,若在其帶上后綴名,還將根據后綴名來給代碼高亮。如下所示為給C++代碼著色:
Figure 3.2 Code blocks in Markdown
小段代碼著色也可用標記@code和@endcode來標記。
3.3 Images插入圖片
插入圖片使用如下標記:
Figure 3.3 OCC logo
4. Conclusion
使用OCC這種方式來生成文檔,感覺還是很不錯的。我就使用這種方式生成了程序IsoAlgo的文檔,看上比較專業,如下圖所示:
Figure 4.1 IsoAlgo User Guide