Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update manual #1

Merged
merged 8 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ jobs:
with:
name: python-package-distributions
path: dist/
- name: Upgrade Dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade sigstore cryptography
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The default theme in JupyterBooks is usually not desired and need to be changed

This extension applies styling changes, e.g. using specific fonts, and adding particular colours for admonitions. You can see how the TU Delft theme looks like applied in this [example book](http://teachbooks.io/TU-Delft-Theme-Example/).

This extension also automatically sets the Delft University of Technology logo (unless specified otherwise).

## Installation
To install the Sphinx-Image-Inverter, follow these steps:
Expand Down Expand Up @@ -39,6 +40,14 @@ sphinx:

By following the steps above, the theme will be applied automatically. To see the examples of usage visit the [TeachBooks manual](https://teachbooks.io/manual/intro.html).

If the Delft University of Technology logo should not be set (i.e. use logos defined by the user), include the following in your `_config.yml` file:
```
sphinx:
config:
...
tud_change_logo: False
```


## Contribute
This tool's repository is stored on [GitHub](https://github.com/TeachBooks/Sphinx-TUDelft-theme). The `README.md` of the branch `Manual` is also part of the [TeachBooks manual](https://teachbooks.io/manual/intro.html) as a submodule. If you'd like to contribute, you can create a fork and open a pull request on the [GitHub repository](https://github.com/TeachBooks/Sphinx-TUDelft-theme). To update the `README.md` shown in the TeachBooks manual, create a fork and open a merge request for the [GitHub repository of the manual](https://github.com/TeachBooks/manual). If you intent to clone the manual including its submodules, clone using: `git clone [email protected]:TeachBooks/manual.git`.
This tool's repository is stored on [GitHub](https://github.com/TeachBooks/Sphinx-TUDelft-theme). The `README.md` of the branch `Manual` is also part of the [TeachBooks manual](https://teachbooks.io/manual/intro.html) as a submodule. If you'd like to contribute, you can create a fork and open a pull request on the [GitHub repository](https://github.com/TeachBooks/Sphinx-TUDelft-theme). To update the `README.md` shown in the TeachBooks manual, create a fork and open a merge request for the [GitHub repository of the manual](https://github.com/TeachBooks/manual). If you intent to clone the manual including its submodules, clone using: `git clone [email protected]:TeachBooks/manual.git`.
23 changes: 23 additions & 0 deletions src/sphinx_tudelft_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,33 @@ def copy_stylesheet(app: Sphinx, exc: None) -> None:
copy_asset_file(style, static_dir)
copy_asset_file(fonts_src_dir, fonts_dest_dir)

def copy_logos(app: Sphinx, exc: None) -> None:
base_dir = os.path.dirname(__file__)
light = os.path.join(base_dir, 'static', 'TUDelft_logo_descriptor_rgb.png')
dark = os.path.join(base_dir, 'static', 'TUDelft_logo_descriptor_white.png')

if app.builder.format == 'html' and not exc:
static_dir = os.path.join(app.builder.outdir, '_static')

copy_asset_file(light, static_dir)
copy_asset_file(dark, static_dir)

def set_logo(app,conf) -> None:
if conf.tud_change_logo:
print('Changing logo to TU Delft logo')
old = app.config.html_theme_options
old['logo'] = {'image_light':'TUDelft_logo_descriptor_rgb.png','image_dark': 'TUDelft_logo_descriptor_white.png'}
app.config.html_theme_options = old
else:
print('Using user-defined logo')


def setup(app: Sphinx):
app.add_config_value('tud_change_logo', True, 'env')
app.add_css_file('tudelft_style.css')
app.connect('build-finished', copy_stylesheet)
app.connect('build-finished', copy_logos)
app.connect('config-inited',set_logo)
return {
"version": __version__,
"parallel_read_safe": True,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading