Skip to content

Commit

Permalink
DOC: Put example notebooks in reference folder
Browse files Browse the repository at this point in the history
  • Loading branch information
has2k1 committed Feb 15, 2024
1 parent 94206ad commit 9d6fb15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 4 additions & 2 deletions doc/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from pathlib import Path

DOC_DIR = Path(__file__).parent
EXAMPLES_DIR = DOC_DIR / "reference" / "examples"
TUTORIALS_DIR = DOC_DIR / "tutorials"

# The varibables file holds the version
variables_filepath = DOC_DIR / "_variables.yml"
Expand Down Expand Up @@ -66,8 +68,8 @@ def copy(src_dir, dest_dir):
for dest in set(cur_dest_files).difference(new_dest_files):
dest.unlink()

copy(_files("plotnine_examples.examples"), DOC_DIR / "examples")
copy(_files("plotnine_examples.tutorials"), DOC_DIR / "tutorials")
copy(_files("plotnine_examples.examples"), EXAMPLES_DIR)
copy(_files("plotnine_examples.tutorials"), TUTORIALS_DIR)


if __name__ == "__main__":
Expand Down
7 changes: 3 additions & 4 deletions doc/_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from quartodoc.pandoc.components import Attr

DOC_DIR = Path(__file__).parent
EXAMPLES_DIR = DOC_DIR / "examples"
REFERENCE_DIR = DOC_DIR / "reference"
EXAMPLES_DIR = REFERENCE_DIR / "examples"

usage_pattern = re.compile(
r"\n\n?\*\*Usage\*\*"
Expand Down Expand Up @@ -40,9 +41,7 @@ def render_body(self):
if not notebook.exists():
return body

# path from the references directory where the qmd files
# are placed
relpath = Path("..") / notebook.relative_to(DOC_DIR)
relpath = notebook.relative_to(REFERENCE_DIR)
embed_notebook = shortcode("embed", f"{relpath}", echo="true")
header = Header(self.level + 1, "Examples")
return Blocks([body, header, embed_notebook])
Expand Down

0 comments on commit 9d6fb15

Please sign in to comment.