Skip to content

Commit

Permalink
Sphinx Me Up
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Jan 14, 2025
1 parent 52f44ab commit cf03c81
Show file tree
Hide file tree
Showing 15 changed files with 157 additions and 50 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Sphinx outputs
build

# MyST build outputs
_build
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build:
python: "mambaforge-latest"

sphinx:
configuration: conf.py
configuration: source/conf.py

conda:
environment: conda.yml
Expand Down
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2 changes: 2 additions & 0 deletions conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ dependencies:
- pygments
- recommonmark
- sphinx
- sphinx-autobuild
- sphinx-book-theme
- sphinx-copybutton
- sphinx-design
- sphinxcontrib-bibtex
Expand Down
42 changes: 0 additions & 42 deletions front_matter/how_to_write_docs.md

This file was deleted.

35 changes: 35 additions & 0 deletions make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
12 changes: 6 additions & 6 deletions myst.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ project:
# authors: []
github: https://github.com/campa-consortium/lattice-standard
toc:
- file: 'front_matter/introduction.md'
- file: 'source/front_matter/introduction.md'
- title: 'Front Matter'
children:
- file: 'front_matter/governance.md'
- file: 'front_matter/contributing.md'
- file: 'front_matter/how_to_write_docs.md'
- file: 'source/front_matter/governance.md'
- file: 'source/front_matter/contributing.md'
- file: 'source/front_matter/how_to_write_docs.md'
- title: 'Lattice Standard'
children:
- file: 'standard/introduction.md'
- file: 'standard/element_parameter.md'
- file: 'source/standard/introduction.md'
- file: 'source/standard/element_parameter.md'
site:
template: book-theme
#domains:
Expand Down
28 changes: 28 additions & 0 deletions source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'Accelerator Lattice Standard'
copyright = '2025, under CC-BY 4.0 License'
author = 'Jean-Luc Vay, David Sagan, Chad Mitchell, Axel Huebl, David Bruhwihler, Christopher Mayes, Eric Stern, Daniel Winklehner, Michael Ehrlichman, Martin Berz, Giovanni Iadarola, Ji Qiang, Edoardo Zoni, Laurent Deniau, et al.'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ['myst_parser', 'sphinx_design']
myst_enable_extensions = ["colon_fence"]

templates_path = ['_templates']
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_book_theme'
html_static_path = ['_static']
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ git commit -m "Add element template."
git push -u username add_template
```

8. Follow the link that is generated to open a new pull request on GitHub that includes these changes, e.g., go to https://github.com/cemitch99/lattice-standard/pull/new/add_template.
8. Follow the link that is generated to open a new pull request on GitHub that includes these changes, e.g., go to [https://github.com/cemitch99/lattice-standard/pull/new/add_template](https://github.com/cemitch99/lattice-standard/pull/new/add_template).

9. Add a title and additional information relevant to the pull request (as needed).
File renamed without changes.
40 changes: 40 additions & 0 deletions source/front_matter/how_to_write_docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# How to Write Documentation

The documentation uses the [MyST](https://mystmd.org/) markup language and renders to [Sphinx](https://www.sphinx-doc.org) as HTML, PDF or EPUB documents.

In order to build the documentation locally, please create a software environment like this

```{code} bash
conda env create -y -f conda.yml
conda activate lattice-standard
```

and compile via

::::{tab-set}

:::{tab-item} HTML
```{code} bash
make html
```
:::

:::{tab-item} PDF
```{code} bash
make latexpdf
```
:::

::::

Open the file `build/html/index.html` with your web browser to visualize.
You are now ready to edit the markdown files that compose the documentation!

If you like to atuomatically rebuild changes on save of edited files, run:
```{code} bash
sphinx-autobuild source/ build/html
```
and open the URL shown in the terminal, usually [http://127.0.0.1:8000](http://127.0.0.1:8000).

If you add new markdown files, do not forget to add them to the table of contents defined `source/index.md`.
Finally, once you are happy with your changes, do not forget to commit and push them to your branch and open a pull request on GitHub.
File renamed without changes.
21 changes: 21 additions & 0 deletions source/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Accelerator Lattice Standard

This standard is an effort to create a standard to promote lattice information exchange for particle accelerators.

```{toctree}
:maxdepth: 1
:caption: Front Matter
front_matter/introduction.md
front_matter/governance.md
front_matter/contributing.md
front_matter/how_to_write_docs.md
```

```{toctree}
:maxdepth: 1
:caption: Standard
standard/introduction.md
standard/element_parameter.md
```
File renamed without changes.
File renamed without changes.

0 comments on commit cf03c81

Please sign in to comment.