Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contents for manully build documentation(cn version) #9298

Merged
merged 15 commits into from
Apr 11, 2018
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions doc/v2/dev/write_docs_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ PaddlePaddle.org工具可以配合Docker使用,需要在系统里先安装好D

.. 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.

paddlepaddle.org里面的mkdircd需要留下。

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

Choose a reason for hiding this comment

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

这里的mkdircd还没留下。

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


mkdir paddlepaddle # Create paddlepaddle working directory
cd paddlepaddle

# Clone the content repositories
git clone https://github.com/PaddlePaddle/Paddle.git
git clone https://github.com/PaddlePaddle/book.git
Expand All @@ -39,9 +36,6 @@ PaddlePaddle.org工具可以配合Docker使用,需要在系统里先安装好D

.. code-block:: bash

mkdir paddlepaddle # Create paddlepaddle working directory
cd paddlepaddle

# Clone the content repositories and PaddlePaddle.org
git clone https://github.com/PaddlePaddle/Paddle.git
git clone https://github.com/PaddlePaddle/book.git
Expand All @@ -65,17 +59,36 @@ PaddlePaddle.org工具可以配合Docker使用,需要在系统里先安装好D
不使用PaddlePaddle.org工具
--------------------------

使用Docker构建PaddlePaddle的文档,需要在系统里先安装好Docker工具包。Docker安装请参考 `Docker的官网 <https://docs.docker.com/>`_ 。安装好Docker之后可以使用源码目录下的脚本构建文档,即
使用Docker构建PaddlePaddle的文档,需要在系统里先安装好Docker工具包。Docker安装请参考 `Docker的官网 <https://docs.docker.com/>`_ 。该方法与 `从源码编译PaddlePaddle <http://paddlepaddle.org/docs/develop/documentation/zh/build_and_install/build_from_source_cn.html>`_ 相似,通过从源码中构建可用于编译PaddlePaddle文档的Docker镜像并运行,在进入Docker容器后使用源码中的脚本构建PaddlePaddle文档,具体步骤如下:

.. code-block:: bash

git clone https://github.com/PaddlePaddle/Paddle.git
cd Paddle

# 从源码中构建可用于编译PaddlePaddle文档的Docker镜像
docker build -t paddle:dev .
docker run -it -v $PWD:/paddle -e "WITH_GPU=OFF" -e "WITH_TESTING=OFF" -e "WITH_DOC=ON" paddle:dev /bin/bash

# 进入Docker容器后使用build.sh脚本构建PaddlePaddle文档
bash -x /paddle/paddle/scripts/docker/build.sh

注:上述命令把当前目录(源码根目录)映射为 container 里的 :code:`/paddle` 目录。

编译完成后,进入 ``paddle/build/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.

需要加上fluid目录的说明

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

Choose a reason for hiding this comment

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

使用build.sh脚本,现在也可以编译出fluid目录了吧。
84-90行内容,与110-116行内容一样,是否保留一处即可。

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工具
    • 使用Docker工具
    • 使用Django框架
    • 预览效果(等预览工具完成后补上)
  • 使用PaddlePaddle.org工具
    • 使用Docker工具
    • 直接构建
    • 预览效果


.. code-block:: bash

python -m SimpleHTTPServer 8088

[TBD]
在浏览器中输入http://localhost:8088就可以看到编译生成的中/英文的文档页面和英文的API页面。
Copy link
Contributor

Choose a reason for hiding this comment

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

http://localhost:8088 前后可以加空格,变成网址格式。


如果不想使用Docker,也可以使用以下命令直接构建PaddlePaddle文档,即

.. code-block:: bash

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