Skip to content

Commit e578af4

Browse files
committed
[docs] add galleries
1 parent d8bb232 commit e578af4

File tree

4 files changed

+43
-7
lines changed

4 files changed

+43
-7
lines changed

docs/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
sphinx
22
sphinx_rtd_theme
3-
sphinx_toggleprompt
3+
sphinx_toggleprompt
4+
sphinx-gallery>=0.6

docs/source/conf.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,20 @@
1010
# add these directories to sys.path here. If the directory is relative to the
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212
#
13-
import os
13+
import os, shutil
1414
import sys
1515
sys.path.insert(0, os.path.abspath('../'))
1616

17+
18+
def copy_tree(src, tar):
19+
if os.path.exists(tar):
20+
shutil.rmtree(tar)
21+
shutil.copytree(src, tar)
22+
23+
24+
copy_tree("../../examples", "build/blitz")
25+
copy_tree("../../asset", "build/asset")
26+
1727
import sphinx_rtd_theme
1828

1929
# -- Project information -----------------------------------------------------
@@ -22,7 +32,6 @@
2232
copyright = '2021, bigdata-ustc'
2333
author = 'bigdata-ustc'
2434

25-
2635
# -- General configuration ---------------------------------------------------
2736

2837
# Add any Sphinx extension module names here, as strings. They can be
@@ -36,11 +45,26 @@
3645
'sphinx.ext.napoleon',
3746
'sphinx.ext.mathjax',
3847
'sphinx_toggleprompt',
48+
'nbsphinx',
49+
'sphinx_gallery.load_style'
3950
]
4051

52+
# extension variables setting
53+
# npsphinx
54+
55+
nbsphinx_thumbnails = {
56+
'build/blitz/sif/sif': '_static/EduNLP.png',
57+
}
58+
4159
# Add any paths that contain templates here, relative to this directory.
4260
templates_path = ['_templates']
4361

62+
# The suffix(es) of source filenames.
63+
# You can specify multiple suffix as a list of string:
64+
#
65+
source_suffix = ['.rst', '.md', '.ipynb']
66+
# source_suffix = '.rst'
67+
4468
# The language for content autogenerated by Sphinx. Refer to documentation
4569
# for a list of supported languages.
4670
#
@@ -51,8 +75,7 @@
5175
# List of patterns, relative to source directory, that match files and
5276
# directories to ignore when looking for source files.
5377
# This pattern also affects html_static_path and html_extra_path.
54-
exclude_patterns = []
55-
78+
exclude_patterns = ['_build']
5679

5780
# -- Options for HTML output -------------------------------------------------
5881

@@ -65,4 +88,4 @@
6588
# Add any paths that contain custom static files (such as style sheets) here,
6689
# relative to this directory. They are copied after the builtin static files,
6790
# so a file named "default.css" will overwrite the builtin "default.css".
68-
html_static_path = ['_static']
91+
html_static_path = ['_static']

docs/source/tutorial/zh/index.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,14 @@
1010
parse
1111
tokenize
1212
vectorization
13+
14+
15+
示例
16+
--------
17+
.. nbgallery::
18+
:caption: This is a thumbnail gallery:
19+
:name: gallery
20+
:glob:
21+
:reversed:
22+
23+
../../build/blitz/sif/sif

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
docs_deps = [
1414
'sphinx',
1515
'sphinx_rtd_theme',
16-
'sphinx_toggleprompt'
16+
'sphinx_toggleprompt',
17+
'sphinx-gallery>=0.6'
1718
]
1819

1920
dev_deps = ["requests"] + docs_deps + test_deps

0 commit comments

Comments
 (0)