您的位置:首页 > 其它

【转载】devhelp的使用小结 --zealoussnow - chinaUnix

2017-12-14 20:15 309 查看
这篇文章转载于  http://blog.chinaunix.net/uid-28422527-id-4309534.html

作者 zealoussnow 
 zealoussnow的ChinaUnix博客

网上比较少中文的devhelp的信息,所以想转过来。


如有侵权请立即与我们联系,我们将及时处理

devhelp是一个很方便的图形化文档查看器,自从发现了devhelp,感觉查阅帮助文档舒服多了。在linux写程序让我颇感遗憾的是manpage没有c++的,但在devhelp中也没有好一点的c++文档,所以就萌生了将cppreference上的离线文档放到devhelp中的做法。说干就干,尝试以下呗!

    查阅了下devhelp的readme,发现devhelp搜寻文档的目录有:        
        (1). $XDG_DATA_HOME/devhelp/books
        (2). $XDG_DATA_HOME/gtk-doc/html
        (3). $XDG_DATA_DIRS/devhelp/books
        (4). $XDG_DATA_DIRS/gtk-doc/html
    我就直接自己的家目录作为devhelp的文档搜索路径。export XDG_DATA_HOME=$HOME/.local/shar
4000
e,然后新建目录devhelp/books,在books下面就是文档的位置。由于我经常查阅的是c++和c的一些文档,这里我举的例子是cppreference的一个离线文档
    将下载的离线文档解压到$XDG_DATA_HOME/devhelp/books下面,目录名改为cpp-reference。
    首先呢,我们需要一个以.devhelp结尾的文件,这个实际上就是一个xml文件,用于展示文档结构。我呢也不自己写了,以前devhelp里面我个libxml2的文档,就用它啦。在cpp-reference目录下新建一个cpp-reference.devhelp, 观察下cppreference的结构,c部分和c++部分在en目录下面。所以呢,这个devhelp文件可以这么写,我直接就展示修改后的文件了,很容易看懂的。

<?xml version="1.0" encoding="UTF-8"?>

<book xmlns="http://www.devhelp.net/book" title="C++
Reference Manual" link="en/index.html" author="zealoussnow" name="cppreference">

    <chapters>

        <sub name="C" link="en/c.html">

            <sub name="algorithm" link="en/c/algorithm.html"/>

            <sub name="atomic" link="en/c/atomic.html"/>

            <sub name="chrono" link="en/c/chrono.html"/>

            <sub name="error" link="en/c/error.html"/>

            <sub name="header" link="en/c/header.html"/>

            <sub name="keyword" link="en/c/keyword.html"/>

            <sub name="language" link="en/c/language.html"/>

            <sub name="links" link="en/c/links.html"/>

            <sub name="locale" link="en/c/locale.html"/>

            <sub name="memory" link="en/c/memory.html"/>

            <sub name="preprocessor" link="en/c/preprocessor.html"/>

            <sub name="program" link="en/c/program.html"/>

            <sub name="string" link="en/c/string.html"/>

            <sub name="thread" link="en/c/thread.html"/>

            <sub name="types" link="en/c/types.html"/>

        </sub>

        <sub name="C++" link="en/cpp.html">

            <sub name="algorithm" link="en/cpp/algorithm.html"/>

            <sub name="chrono" link="en/cpp/chrono.html"/>

            <sub name="comment" link="en/cpp/comment.html"/>

            <sub name="concept" link="en/cpp/concept.html"/>

            <sub name="containter" link="en/cpp/container.html"/>

            <sub name="error" link="en/cpp/error.html"/>

            <sub name="header" link="en/cpp/header.html"/>

            <sub name="io" link="en/cpp/io.html"/>

            <sub name="iterator" link="en/cpp/iterator.html"/>

            <sub name="keyword" link="en/cpp/keyword.html"/>

            <sub name="language" link="en/cpp/language.html"/>

            <sub name="links" link="en/cpp/links.html"/>

            <sub name="locale" link="en/cpp/locale.html"/>

            <sub name="memory" link="en/cpp/memory.html"/>

            <sub name="numberic" link="en/cpp/numberic.html"/>

            <sub name="preprocessor" link="en/cpp/preprocessor.html"/>

            <sub name="regex" link="en/cpp/regex.html"/>

            <sub name="string" link="en/cpp/string.html"/>

            <sub name="thread" link="en/cpp/thread.html"/>

            <sub name="types" link="en/cpp/types.html"/>

            <sub name="utility" link="en/cpp/utility.html"/>

        </sub>

    </chapters>

    <functions>

        <function name="swap()" link="en/cpp/io/basic_filebuf/swap.html"/>

    </functions>

</book>

    是不是很简单,其实就包含三部分:sub name为C和C++的节点,还有一个functions节点。functions那个swap()我只是为了举个例子,实际上还能加很多的,这是为了在search部分查询方便。
    写完之后再次打开devhelp,新增的文档就出现了,查询起来十分方便,是不是很amazing啊。
    
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: