Skip to content

Commit 7623d30

Browse files
authored
Build docs in build/ (#2304)
1 parent de83534 commit 7623d30

File tree

2 files changed

+70
-74
lines changed

2 files changed

+70
-74
lines changed

doc/conf.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
'sphinx.ext.viewcode', # display code with line numbers and line highlighting
5656
'sphinx_copybutton', # Adds a copy button to code blocks
5757
'sphinx_sitemap', # sitemap.xml generation
58+
'doc.extensions.prettyspecialmethods', # Forker plugin for prettifying special methods
5859
]
5960

6061
# Add any paths that contain templates here, relative to this directory.
@@ -264,28 +265,23 @@ def generate_color_table(filename, source):
264265
source[0] += append_text
265266

266267

267-
def source_read_handler(_app, docname, source):
268+
def source_read_handler(_app, doc_name: str, source):
268269
"""
269270
Event handler for source-read event.
270271
Where we can modify the source of a document before it is parsed.
271272
"""
272-
file_path = os.path.dirname(os.path.abspath(__file__))
273-
os.chdir(file_path)
274-
275-
# Transform source for arcade.color and arcade.csscolor
276-
if docname == "api_docs/arcade.color":
277-
generate_color_table("../arcade/color/__init__.py", source)
278-
elif docname == "api_docs/arcade.csscolor":
279-
generate_color_table("../arcade/csscolor/__init__.py", source)
273+
# Inject the color tables into the source
274+
if doc_name == "api_docs/arcade.color":
275+
generate_color_table("arcade/color/__init__.py", source)
276+
elif doc_name == "api_docs/arcade.csscolor":
277+
generate_color_table("arcade/csscolor/__init__.py", source)
280278

281279

282280
def on_autodoc_process_bases(app, name, obj, options, bases):
283281
"""We don't care about the `object` base class, so remove it from the list of bases."""
284282
bases[:] = [base for base in bases if base is not object]
285283

286284

287-
288-
289285
def setup(app):
290286
# Separate stylesheets loosely by category.
291287
app.add_css_file("css/colors.css")

0 commit comments

Comments
 (0)