Skip to content

Conversation

@weixing02
Copy link
Collaborator

resolve #8993

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以先改中文文档,等确定后再改英文文档。

编译完成之后,会在当前目录生成两个子目录\: doc(英文文档目录)和 doc_cn(中文文档目录)。
打开浏览器访问对应目录下的index.html即可访问本地文档。

直接构建
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑下:如何将直接构建和使用Docker构建合并,即整体分为两种:使用paddlepaddle.org工具,不使用paddlepaddle.org工具。每个里面分(使用docker和不使用docker)。
两种各有优点,前者方便预览,后者方便开发者进行调试。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,这样从逻辑上更为合理些,谢谢!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

--------

如果提示正确,可以执行以下命令编译生成文档,即
直接构建可以分为两种方式,分别是构建文档和构建API。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


编译完成之后,会在当前目录生成两个子目录\: doc(英文文档目录)和 doc_cn(中文文档目录)。
打开浏览器访问对应目录下的index.html即可访问本地文档。
.. code-block:: bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git clone https://github.com/PaddlePaddle/Paddle.git
cd TO_YOUR_PADDLE_CLONE_PATH
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_GPU=OFF -DWITH_MKL=OFF -DWITH_DOC=ON

等类似这些命令都要有,对用户来说,需要从第一步开始。
类似paddlepaddle.org工具那样,写出完整的命令。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

make -j $processors copy_paddle_pybind
make -j $processors paddle_api_docs
其中$processors代表启动多少个进程来进行编译,一般取值为1,4或8。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其中$processors代表启动和 CPU 核一样多的进程来并行编译。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_GPU=OFF -DWITH_MKL=OFF -DWITH_DOC=ON
make gen_proto_py
make paddle_docs paddle_docs_cn
如果只需要构建文档,可以执行以下命令编译生成文档,即:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

84-86行,93-95行可以不用写。具体区分在命令中写出来即可。类似http://www.paddlepaddle.org/docs/develop/documentation/zh/build_and_install/build_from_source_cn.html#build-step 在命令中区分了两种方法。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

谢谢!但在命令中使用注释区分会不会不够明显呢

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 因为除了命令稍有不同外,其他的描述都是类似的。
  • 对应到使用paddlepaddle.org工具时,也只是里面选的按钮不同,其他并无区别。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

其中$processors代表启动多少个进程来进行编译,一般取值为1,4或8。

编译完成后,从当前目录进入doc/v2目录,该目录下生成了三个子目录,可以分别进入目录cn/html/、en/html、api/en/html中,执行以下命令,即:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要说明,构建文档会生成cn/htmlen/html目录,构建api会生成api/en/html

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


.. image:: doc_en.png
:align: center
:scale: 60 %
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要放英文页面首页。并说明这是采用sphinx主题生成的,因此和官网的风格不一样,但方便开发者调试。语言请重新组织。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

在浏览器中输入http://localhost:8088就可以看到编译生成的中/英文的文档页面和英文的API页面,下图为生成的英文文档页面示例。

.. image:: doc_en.png
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

图片请新建一个src目录,统一放在src目录下。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


使用PaddlePaddle.org工具
--------------
----------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15行需要超过14行,才不会报warning,下同。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

sh build_docs.sh
编译完成之后,会在当前目录生成两个子目录\: doc(英文文档目录)和 doc_cn(中文文档目录)。
打开浏览器访问对应目录下的index.html即可访问本地文档。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker这段的描述和命令都不对,可以等下一个PR来进行修改。类似docker run -it -p 8000:8000 -v pwd:/var/content paddlepaddle/paddlepaddle.org:latest的命令。这里可以先把这段删了,改成TBD。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

make paddle_docs paddle_docs_cn
# Clone the content repositories
git clone https://github.com/PaddlePaddle/Paddle.git
cd TO_YOUR_PADDLE_CLONE_PATH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

88-93行:

mkdir paddle
cd paddle
git clone https://github.com/PaddlePaddle/Paddle.git
mkdir -p build

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

cd TO_YOUR_PADDLE_CLONE_PATH
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_GPU=OFF -DWITH_MKL=OFF -DWITH_DOC=ON
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug改成Release

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

make -j $processors copy_paddle_pybind
make -j $processors paddle_api_docs
其中$processors代表启动和CPU核一样多的进程来并行编译,一般取值为1,4或8,可以根据本机的CPU核数设置相应的值。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“一般取值为1,4或8”去掉。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

这个是目前推荐的使用方法。除了可以自动编译文档,也可以直接在网页预览文档。

文件工具是使用Docker,需要在系统里先安装好Docker工具包。Docker安装请参考Docker的官网。安装好Docker之后及可用以下命令启动工具
PaddlePaddle.org工具可以配合Docker使用,需要在系统里先安装好Docker工具包。Docker安装请参考Docker的官网。安装好Docker之后即可用以下命令启动工具
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请参考Docker的官网,官网链接可参考68行。

PaddlePaddle的文档包括英文文档 ``doc`` 和中文文档 ``doc_cn`` 两个部分。文档都是通过 `cmake`_ 驱动 `sphinx`_ 编译生成,生成后的文档分别存储在编译目录的 ``doc`` 和 ``doc_cn`` 两个子目录下。
也可以利用PaddlePaddle 工具来编译文档,这个情况下所有的文件会存在整理过的的文件目录 .ppo_workspace/content 下

如何构建文档
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

第5-6行改为:PaddlePaddle的文档包括中英文两个部分。文档都是通过 cmake_ 驱动 sphinx_ 编译生成,也可以利用paddlepaddle.org工具来编译和预览文档。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

============

PaddlePaddle的文档构建有三种方式
PaddlePaddle的文档构建有两种方式
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因为后面两种方式的介绍比较长,因此在11行先对这两种方式说明一下各自的优点。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

使用PaddlePaddle.org工具
--------------
----------------------
这个是目前推荐的使用方法。除了可以自动编译文档,也可以直接在网页预览文档。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接在网页预览文档。(描述不准确,后面那个方式也能预览文档,这儿是预览样式和官网效果一样,语言请重新组织)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

:align: center
:scale: 60 %

如何书写文档
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

129行的提交方式参见 贡献文档 <http://www.paddlepaddle.org/docs/develop/documentation/en/howto/dev/contribute_to_paddle_en.html>_
改成:如何贡献代码,并使用正确链接。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以对应修改英文文档。

============================

更新的文档以PR的形式提交到github中,提交方式参见 `贡献文档 <http://www.paddlepaddle.org/docs/develop/documentation/en/howto/dev/contribute_to_paddle_en.html>`_ 。
更新的文档以PR的形式提交到github中,提交方式参见 `如何贡献文档 <http://www.paddlepaddle.org/docs/develop/documentation/zh/dev/write_docs_cn.html>`_ 。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

提交方式应该是参加如何贡献代码,并对应修改链接。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@luotao1 luotao1 merged commit 7276366 into PaddlePaddle:develop Mar 14, 2018
@weixing02 weixing02 deleted the doc branch March 14, 2018 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix some outdated contents in Contribute Documentation

2 participants