Skip to content
Snippets Groups Projects
Commit d4f37c19 authored by Karim Ahmed's avatar Karim Ahmed
Browse files

improve code reference

parent a486b971
No related branches found
No related tags found
1 merge request!820[Documentation] Introduce mkdocs and add new documentation pages
# Calibration tools
::: cal_tools.gotthard2.gotthard2lib
::: cal_tools.epix100.epix100lib
::: cal_tools.tools
\ No newline at end of file
# CalCAT Interface
??? Note "This module help in skipping calibrationDBRemote"
![Calibration DB Remote avoided](static/../../static/xfel_calibrate_diagrams/xfel-calibrate_cli_process_no_caldbremote.png)
::: cal_tools.calcat_interface
\ No newline at end of file
...@@ -7,7 +7,8 @@ import mkdocs_gen_files ...@@ -7,7 +7,8 @@ import mkdocs_gen_files
nav = mkdocs_gen_files.Nav() nav = mkdocs_gen_files.Nav()
for path in sorted(Path("src").rglob("*.py")): for path in sorted(Path("src").rglob("*.py")):
module_path = path.relative_to("src").with_suffix("") module_path = path.relative_to("src").with_suffix("")
doc_path = path.relative_to("src").with_suffix(".md") doc_path = path.relative_to("src").with_suffix(".md")
...@@ -19,7 +20,7 @@ for path in sorted(Path("src").rglob("*.py")): ...@@ -19,7 +20,7 @@ for path in sorted(Path("src").rglob("*.py")):
if parts[-1] == "__init__": if parts[-1] == "__init__":
parts = parts[:-1] parts = parts[:-1]
print("init parts:", parts) print("init parts:", parts)
if parts[-1] in ["notebooks", "settings", "calcat_interface", "restful_config", "__main__"]: if parts[-1] in ["notebooks", "settings", "restful_config", "__main__"]:
continue continue
nav[parts] = doc_path.as_posix() nav[parts] = doc_path.as_posix()
...@@ -27,9 +28,16 @@ for path in sorted(Path("src").rglob("*.py")): ...@@ -27,9 +28,16 @@ for path in sorted(Path("src").rglob("*.py")):
with mkdocs_gen_files.open(full_doc_path, "w") as fd: with mkdocs_gen_files.open(full_doc_path, "w") as fd:
identifier = ".".join(parts) identifier = ".".join(parts)
print("::: " + identifier, file=fd) if "calcat_interface" == full_doc_path.stem:
print(
"""
??? Note "This module help in skipping calibrationDBRemote"
![Calibration DB Remote avoided](../xfel-calibrate_cli_process_no_caldbremote.png)
""",
file=fd)
print("::: " + "src." + identifier, file=fd)
mkdocs_gen_files.set_edit_path(full_doc_path, path) mkdocs_gen_files.set_edit_path(full_doc_path, path)
with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file: with mkdocs_gen_files.open(f"reference/summary.md", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav()) nav_file.writelines(nav.build_literate_nav())
mkdocs>=1.4.0 mkdocs==1.4.2
mkdocs-material~=9.0.0 mkdocs-material==9.0.15
mkdocstrings[python]>=0.18 mkdocstrings[python]==0.19
mkdocs-glightbox mkdocs-glightbox
mkdocs-section-index~=0.3.4 mkdocs-section-index==0.3.5
mkdocs-literate-nav~=0.5.0 mkdocs-literate-nav==0.5.0
mkdocs-redirects~=1.2.0 mkdocs-redirects==1.2.0
mkdocs-jupyter~=0.24.0 mkdocs-jupyter==0.24.0
mkdocs-gen-files~=0.4.0 mkdocs-gen-files==0.4.0
\ No newline at end of file \ No newline at end of file
...@@ -46,13 +46,6 @@ markdown_extensions: ...@@ -46,13 +46,6 @@ markdown_extensions:
- tables - tables
- codehilite - codehilite
mkdocstrings.extension:
default_handler: python
handlers:
python:
selector: "python"
syntax: sphinx
extra_css: extra_css:
- css/custom.css - css/custom.css
...@@ -61,20 +54,14 @@ plugins: ...@@ -61,20 +54,14 @@ plugins:
- literate-nav: - literate-nav:
nav_file: SUMMARY.md nav_file: SUMMARY.md
- mkdocstrings: - mkdocstrings:
default_handler: python
handlers: handlers:
python: python:
selector: "python" import:
syntax: sphinx - https://docs.python-requests.org/en/master/objects.inv
# default_handler: python paths: [../src]
# handlers: synatx: sphinx
# python: docstring_section_style: list
# selection: docstring_style: sphinx
# docstring_style: sphinx
# line_length: 81
# merge_init_into_class: true
# show_if_no_docstring: true
# docstring_section_style: list
- search - search
- autorefs - autorefs
- mkdocs-jupyter: - mkdocs-jupyter:
...@@ -102,9 +89,7 @@ nav: ...@@ -102,9 +89,7 @@ nav:
- How to write a notebook: development/how_to_write_xfel_calibrate_notebook_NBC.ipynb - How to write a notebook: development/how_to_write_xfel_calibrate_notebook_NBC.ipynb
- Configuration: development/configuration.md - Configuration: development/configuration.md
- Advanced topics: development/advanced.md - Advanced topics: development/advanced.md
- Code Reference: - Code Reference: reference/
- CALCAT Interface: code_reference/calcat_interface.md
- Code Reference: reference/
- Reference: - Reference:
- FAQ: references/faq.md - FAQ: references/faq.md
- Changelog: references/changelog.md - Changelog: references/changelog.md
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment