File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,3 +33,6 @@ matrix:
3333 - open : ' {%'
3434 content : ' [\d\D]*'
3535 close : ' %}'
36+ - open : ' :::'
37+ content : ' [\d\D]*'
38+ close : ' \n'
Original file line number Diff line number Diff line change @@ -76,3 +76,8 @@ plugins:
7676 literate-nav :
7777 nav_file : SUMMARY.md
7878 macros : {}
79+ mkdocstrings :
80+ default_handler : python
81+ handlers :
82+ python :
83+ paths : [src]
Original file line number Diff line number Diff line change @@ -6,3 +6,12 @@ Navigation should render at the bottom of the page; "BeeWare Docs Tools Demo
66Section One" should be on the left, "Section Two" should be on the right.
77The footer should be below the navigation links. This confirms the theme
88configuration has been applied.
9+
10+ ### Class reference documentation
11+
12+ The following should show the reference documentation for the ` DocsTest `
13+ class, located in ` docs_test.py ` , in the ` src/beeware_docs_tools `
14+ directory. This verifies that the source code directory symlinking is
15+ working properly.
16+
17+ ::: beeware_docs_tools.docs_test.DocsTest
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ reStructuredText
1212subdirectories
1313subdirectory
1414symlinked
15+ symlinking
1516Titlebar
1617titlebar
1718Weblate
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ dependencies = [
3030 " mkdocs-macros-plugin==1.3.9" ,
3131 " mkdocs-material==9.6.17" ,
3232 " mkdocs==1.6.1" ,
33+ " mkdocstrings-python==1.16.12" ,
3334 " pymdown-extensions==10.16.1" ,
3435 " pyspelling==2.10" ,
3536 " python-Levenshtein==0.27.1" ,
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ def parse_args() -> Namespace:
1616 parser .add_argument ("language_code" , nargs = "*" )
1717 parser .add_argument ("--output" , default = SOURCE_DIR / "_build" / "html" )
1818 parser .add_argument ("--build-with-errors" , action = "store_true" )
19+ parser .add_argument ("--source-code" , action = "append" )
1920 args = parser .parse_args ()
2021 for language_code in args .language_code :
2122 if not (
@@ -87,6 +88,17 @@ def main():
8788 ) as config_temp :
8889 yaml .dump (config_file , config_temp )
8990
91+ # If source code directory or directories provided, symlink.
92+ if args .source_code :
93+ for directory in args .source_code :
94+ if "/" in directory :
95+ Path (temp_md_directory / directory ).parent .mkdir (
96+ parents = True , exist_ok = True
97+ )
98+ (temp_md_directory / directory ).symlink_to (
99+ SOURCE_DIR / directory , target_is_directory = True
100+ )
101+
90102 # Symlink overrides directory to the temp directory, so it is
91103 # available relative to the build.
92104 (temp_md_directory / "overrides" ).symlink_to (
Original file line number Diff line number Diff line change 1+ class DocsTest :
2+ def __init__ (self ):
3+ """This is the test class."""
4+ pass
5+
6+ def attribute (self ):
7+ """This is a test attribute."""
8+ pass
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ def parse_args() -> Namespace:
1919 parser = ArgumentParser ()
2020 parser .add_argument ("watch_directory" , nargs = "*" )
2121 parser .add_argument ("--build-with-errors" , action = "store_true" )
22+ parser .add_argument ("--source-code" , action = "append" )
2223 args = parser .parse_args ()
2324
2425 return args
@@ -53,9 +54,21 @@ def serve_docs(config_location) -> None:
5354
5455
5556def main ():
57+ args = parse_args ()
58+
5659 with TemporaryDirectory () as temp_md_directory :
5760 temp_md_directory = Path (temp_md_directory )
5861
62+ if args .source_code :
63+ for directory in args .source_code :
64+ if "/" in directory :
65+ Path (temp_md_directory / directory ).parent .mkdir (
66+ parents = True , exist_ok = True
67+ )
68+ (temp_md_directory / directory ).symlink_to (
69+ SOURCE_DIR / directory , target_is_directory = True
70+ )
71+
5972 config_file = yaml .load (
6073 open (SOURCE_DIR / "docs" / "config.yml" ), Loader = yaml .SafeLoader
6174 )
Original file line number Diff line number Diff line change @@ -14,13 +14,13 @@ skip_install = true
1414deps =
1515 -r {tox_root}/requirements.docs.txt
1616commands:
17- !lint-!all-!translate-!live-!en-!fr-!de : build_md_translations {posargs} en
17+ !lint-!all-!translate-!live-!en-!fr-!de : build_md_translations {posargs} -- source-code =src en
1818 translate : md2po --input docs{/}en --output {[docs]templates_dir} --pot --duplicates =merge
1919 translate : build_po_translations fr de
2020 lint : markdown-checker --dir {[docs]docs_dir} --func check_broken_urls
2121 lint : pyspelling
22- live : live_serve_en {posargs} src
23- all : build_md_translations {posargs} en fr de
24- en : build_md_translations {posargs} en
25- fr : build_md_translations {posargs} fr
26- de : build_md_translations {posargs} de
22+ live : live_serve_en {posargs} src -- source-code =src
23+ all : build_md_translations {posargs} -- source-code =src en fr de
24+ en : build_md_translations {posargs} -- source-code =src en
25+ fr : build_md_translations {posargs} -- source-code =src fr
26+ de : build_md_translations {posargs} -- source-code =src de
You can’t perform that action at this time.
0 commit comments