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

Initial working version of theme #5

Merged
merged 33 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f4c36d4
feat: upgrade iati design system version
tillywoodfield May 29, 2024
183ee45
feat: add IATI header
tillywoodfield May 29, 2024
0dff569
feat: add IATI title bar
tillywoodfield May 29, 2024
38c2c8f
feat: add IATI footer
tillywoodfield May 29, 2024
1ae92bf
feat: expand page to full vertical height
tillywoodfield May 29, 2024
15f3a5c
feat: move relations into main content section
tillywoodfield May 30, 2024
161f6df
feat: style sidebar with global toc
tillywoodfield May 30, 2024
2a835cc
fix: add correct horizontal scroll for long code blocks
tillywoodfield May 30, 2024
72be288
feat: style aside sidebars
tillywoodfield May 30, 2024
8db14ef
feat: style footnotes
tillywoodfield May 30, 2024
976c9b7
feat: style sidebar subtitle
tillywoodfield May 30, 2024
9f49a35
feat: implement alignment classes used by sphinx
tillywoodfield May 30, 2024
974b116
feat: style tables
tillywoodfield May 30, 2024
2d062e4
feat: style description lists
tillywoodfield May 30, 2024
d08b4ae
feat: use line height variable
tillywoodfield May 30, 2024
c41a559
feat: add list style utilities
tillywoodfield May 30, 2024
7d93bf0
docs: move installation instructions to index page
tillywoodfield May 30, 2024
a4ccc16
docs: fix broken reference
tillywoodfield May 30, 2024
19a3982
docs: fix broken reference
tillywoodfield May 30, 2024
eace2b1
feat: use IATI search bar
tillywoodfield May 30, 2024
a23d5ed
feat: use social icons class in footer
tillywoodfield May 30, 2024
a38d4c3
feat: hide global toc on small screens
tillywoodfield May 30, 2024
e5a16e9
feat: add common IATI links to footer
tillywoodfield Jun 5, 2024
6869633
feat: move header within title bar
tillywoodfield Jun 5, 2024
fb1362e
feat: point header logo link to main IATI website
tillywoodfield Jun 5, 2024
e0a329d
feat: add home link to header
tillywoodfield Jun 5, 2024
6a599b6
feat: make header links smaller and use "#"
tillywoodfield Jun 5, 2024
f484216
feat: update global toc styles
tillywoodfield Jun 6, 2024
cf42314
feat: make next and previous buttons optional
tillywoodfield Jun 6, 2024
f379eb0
feat: move global toc to top of page on small screens
tillywoodfield Jun 6, 2024
2f6b5e2
docs(README): add instructions for local testing against other projects
tillywoodfield Jun 6, 2024
36d42a5
feat: remove "home" link from header
tillywoodfield Jun 7, 2024
f23ad1b
feat: reduce admonition variant colours
tillywoodfield Jun 7, 2024
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
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# IATI Sphinx Theme

## Development
## How do I use IATI Sphinx Theme?

Please see the [IATI Sphinx Theme Documentation](https://iati-sphinx-theme.readthedocs.io/en/latest/) for usage instructions.

## How do I contribute to IATI Sphinx Theme?

### Install dependencies

Expand Down Expand Up @@ -38,3 +42,34 @@ mypy iati_sphinx_theme/
pip install -e .
sphinx-autobuild -a docs docs/_build/html --watch iati_sphinx_theme/
```

### Testing a local version of the theme against another project

To run a local version of the theme with another project, e.g. `my-docs`, take the following steps:

1. Clone the `sphinx-theme` repository, and checkout the branch or tag you want to use.

2. Run the following command in the `sphinx-theme` directory, to build the CSS for the theme.

```
npm run build
```

3. Go to `my-docs` directory, and install the Sphinx theme

```
pip install -e /path/to/sphinx-theme
```

4. Set the `html_theme` option in your `conf.py`

```python
html_theme = "iati_sphinx_theme"
```

5. Start the docs development server:

```
pip install sphinx-autobuild
sphinx-autobuild docs docs/_build/html
```
22 changes: 18 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ IATI Sphinx Theme
=================

.. toctree::
:titlesonly:
:maxdepth: 2
:caption: Usage
:hidden:

installation
Home <self>

.. toctree::
:titlesonly:
Expand All @@ -17,3 +14,20 @@ IATI Sphinx Theme
:hidden:

kitchen-sink/index

Installation
============

1.
Install the theme in your Sphinx project.

.. code-block:: none

pip install iati-sphinx-theme

2.
In your project's :code:`conf.py` set the :code:`html_theme`.

.. code-block:: python

html_theme = "iati_sphinx_theme"
17 changes: 0 additions & 17 deletions docs/installation.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/kitchen-sink/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
API documentation
*****************

Using Sphinx's :ref:`sphinx.ext.autodoc` plugin, it is possible to auto-generate documentation of a Python module.
Using Sphinx's :code:`sphinx.ext.autodoc` plugin, it is possible to auto-generate documentation of a Python module.

.. tip::
Avoid having in-function-signature type annotations with autodoc,
Expand Down
4 changes: 3 additions & 1 deletion docs/kitchen-sink/generic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ Code with Sidebar
References
==========

.. _footnotes:

Footnotes
---------

Expand All @@ -173,7 +175,7 @@ and ``]_``. This follow the basic pattern in restructured text to use concise
symbol combinations inside a paragraph that are unlikely to appear in normal text.

There is also simple markup to do hyperlinks, both to web URL's and as
cross references within a Sphinx document, like to :ref:`transformation`.
cross references within a Sphinx document, like to :ref:`footnotes`.

More elaborate documents by some of the authors are
http://introcs.cs.luc.edu and
Expand Down
7 changes: 7 additions & 0 deletions docs/kitchen-sink/lists.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ Enumerated Lists
a. nested lists are numbered separately
b. nested lists need a blank line before and after

A. Upper Alpha

5. Roman numerals can also be used

i. nested lists are numbered separately
ii. nested lists need a blank line before and after

6. Upper Roman

I. first item
II. second item

#. Can have automatic number with the ``#`` character.

Definition Lists
Expand Down
1 change: 1 addition & 0 deletions iati_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@

def setup(app: sphinx.application.Sphinx) -> None:
app.add_html_theme("iati_sphinx_theme", path.abspath(path.dirname(__file__)))
app.config["html_permalinks_icon"] = "#"
3 changes: 3 additions & 0 deletions iati_sphinx_theme/globaltoc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="globaltoc">
{{ toctree(includehidden=theme_globaltoc_includehidden, collapse=theme_globaltoc_collapse, maxdepth=theme_globaltoc_maxdepth) }}
</div>
87 changes: 87 additions & 0 deletions iati_sphinx_theme/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{% extends "basic/layout.html" %}

{%- block header %}
<div class="iati-title-bar">
<header class="iati-header">
<div>
<a href="https://iatistandard.org/">
<img
src="http://styles.iatistandard.org/assets/svg/source/logo-colour.svg"
class="iati-header__logo"
/>
</a>
</div>
<ul class="iati-header__nav">
<li class="iati-header__nav-item">
<a href="{{ pathto('search') }}">Search</a>
</li>
</ul>
</header>
<div class="iati-title-bar__title">
{{ _(project) }}
</div>
</div>
{% endblock %}

{%- block relbar1 %}{% endblock %}
{%- block relbar2 %}{% endblock %}
{%- block sidebar1 %}{% endblock %}
{%- block sidebar2 %}{% endblock %}

{%- block content %}
<main class="iati-main">
{%- include "globaltoc.html" %}
{{ super() }}
</main>
{% endblock %}

{%- block document %}
{{ super() }}
{%- if theme_show_relations|tobool %}
{%- include "relations.html" %}
{%- endif %}
{% endblock %}

{%- block footer %}
<footer class="iati-footer" role="contentinfo">
<div>
<a href="https://iatistandard.org/">
<img
src="http://styles.iatistandard.org/assets/svg/source/logo-white.svg"
class="iati-footer__logo"
/>
</a>
<div class="iati-footer__list">
<span class="iati-footer__list-title">Useful Links</span>
<ul>
<li><a href="https://iatistandard.org/en/contact/">Contact</a></li>
<li><a href="https://iatistandard.org/en/privacy-policy/">Privacy Policy</a></li>
</ul>
</div>
</div>
<hr />
<div>
<div>
{{- copyright_block() -}}
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.
</div>
<div class="iati-footer__social-icons">
<a href="https://twitter.com/IATI_aid" aria-label="Twitter">
<i class="iati-icon iati-icon--twitter"></i>
</a>
<a
href="https://www.youtube.com/channel/UCAVH1gcgJXElsj8ENC-bDQQ"
aria-label="YouTube"
>
<i class="iati-icon iati-icon--youtube"></i>
</a>
<a
href="https://www.linkedin.com/company/international-aid-transparency-initiative/"
aria-label="LinkedIn"
>
<i class="iati-icon iati-icon--linkedin"></i>
</a>
</div>
</div>
</footer>
{%- endblock %}
18 changes: 18 additions & 0 deletions iati_sphinx_theme/relations.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<div class="relations">
{%- if prev %}
<div>
<p class="relations__label">Previous</p>
<a href="{{ prev.link|e }}">
{{ prev.title }}
</a>
</div>
{%- endif %}
{%- if next %}
<div class="right">
<p class="relations__label">Next</p>
<a href="{{ next.link|e }}">
{{ next.title }}
</a>
</div>
{%- endif %}
</div>
17 changes: 17 additions & 0 deletions iati_sphinx_theme/search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "basic/search.html" %}

{% block searchbox %}
<form action="" method="get" class="iati-search-bar">
<input
type="text"
name="q"
aria-labelledby="search-documentation"
value=""
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
/>
<button type="submit" class="iati-button">Search</button>
</form>
{% endblock %}
4 changes: 4 additions & 0 deletions iati_sphinx_theme/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
inherit = basic
stylesheet = iati.css
pygments_style = default

[options]
globaltoc_maxdepth = 2
show_relations = False
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"devDependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"iati-design-system": "1.0.0",
"iati-design-system": "^1.2.0",
"sass": "^1.75.0",
"semantic-release": "^23.1.1",
"semantic-release-pypi": "^3.0.0"
Expand Down
35 changes: 13 additions & 22 deletions styles/_admonitions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,23 @@
.versionchanged,
div.deprecated {
@extend .iati-callout;
}

.admonition-title,
.topic-title {
@extend .iati-callout__title;
}
&.attention {
@extend .iati-callout--purple;
}

.attention,
.caution,
.warning,
.versionchanged {
@extend .iati-callout--orange;
}
&.caution {
@extend .iati-callout--orange;
}

.danger,
.error,
div.deprecated {
@extend .iati-callout--red;
}

.versionadded {
@extend .iati-callout--green;
}
&.note {
@extend .iati-callout--green;
}

.tip {
@extend .iati-callout--purple;
.admonition-title,
.topic-title {
@extend .iati-callout__title;
}
}

.versionmodified {
Expand Down
16 changes: 16 additions & 0 deletions styles/_footnotes.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@use "pkg:iati-design-system" as *;

aside.footnote-list {
font-size: 0.9em;
}

aside.footnote {
display: flex;
flex-flow: row nowrap;
align-items: flex-start;

& > * {
margin: 0.2em;
line-height: $line-height-body;
}
}
Loading