forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pages.py
43 lines (33 loc) · 1.25 KB
/
pages.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""Command-line tool to generate the Drake website contents, without the extra
reference material (C++ API, Python API, Style Guide).
For instructions, see https://drake.mit.edu/documentation_instructions.html.
"""
import os
import tempfile
from doc.defs import (
check_call,
main,
perl_cleanup_html_output,
symlink_input,
)
def _build(*, out_dir, temp_dir):
"""Callback function that implements the bulk of main().
Generates into out_dir; writes scratch files into temp_dir.
As a precondition, both directories must already exist and be empty.
"""
# Create a hermetic copy of our input. This helps ensure that only files
# listed in BUILD.bazel will render onto the website.
symlink_input("drake/doc/pages_input.txt", temp_dir, copy=True)
# Run the documentation generator.
check_call([
"jekyll", "build",
"--source", os.path.join(temp_dir, "drake/doc"),
"--destination", out_dir,
])
# Tidy up.
perl_cleanup_html_output(out_dir=out_dir)
# The filename to suggest as the starting point for preview; in this case,
# it's an empty filename (i.e., the index page).
return [""]
if __name__ == '__main__':
main(build=_build, subdir="", description=__doc__.strip())