Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Commit ee367b7

Browse files
committed
Initial scaffolding for the docs
0 parents  commit ee367b7

25 files changed

+885993
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build
2+
.vscode
3+
_build/
4+
__pycache__

.gitlab-ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-FileCopyrightText: 2021 GNOME Foundation
2+
#
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
stages:
6+
- check
7+
- deploy
8+
9+
image: fedora:39
10+
11+
build:
12+
stage: check
13+
needs: []
14+
script:
15+
- dnf install -y python3-pip
16+
- pip3 install --upgrade -r requirements.txt
17+
- sphinx-build -b html source build
18+
- mv build/_static/404.html build/404.html
19+
- mkdir _docs
20+
- mv build/* _docs/
21+
artifacts:
22+
paths:
23+
- _docs
24+
25+
pages:
26+
stage: deploy
27+
needs: ['build']
28+
script:
29+
- mv _docs public
30+
artifacts:
31+
paths:
32+
- public
33+
only:
34+
- main
35+

00localbuild.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
rm -rf ./build && sphinx-build -j auto -b html ./source ./build

COPYING.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Per-file attritubion
2+
3+
Allan Day, Calum Benson, Adam Elman, Seth Nickell, Colin Robertson:
4+
5+
* buttons.rst
6+
* check-boxes.rst:
7+
* dialogs.rst
8+
* keyboard-interaction.rst
9+
* menus.rst
10+
* radio-buttons.rst
11+
* sliders.rst
12+
* spin-buttons.rst
13+
* text-fields.rst
14+
* progress-bars.rst
15+
* tabs.rst
16+
* model-based.rst
17+
* drop-downs.rst
18+
19+
Allan Day, William Jon McCann:
20+
21+
* typography.rst
22+
23+
Allan Day, Calum Benson, Adam Elman, Seth Nickell, Colin Robertson, Ekaterina Gerasimova:
24+
25+
* writing-style.rst

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
all:
2+
sphinx-build -b html -j auto source build
3+
4+
clean:
5+
rm -rf build
6+
7+
run:
8+
epiphany build/index.html || firefox build/index.html
9+
10+
install:
11+
12+

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Human Interface Guidelines
2+
3+
The GNOME Human Interface Guidelines are the primary source of UX design documentation for GNOME. Live at [developer.gnome.org/hig](https://developer.gnome.org/hig).
4+
5+
This version replaces the previous version which was hosted as part of the [gnome-devel-docs](https://gitlab.gnome.org/GNOME/gnome-devel-docs/) module.
6+
7+
The HIG is written in [reStructuredText](https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html), generated using [Sphinx](https://www.sphinx-doc.org/en/master/index.html), and hosted using [GitLab pages](https://docs.gitlab.com/ee/user/project/pages/). It can be viewed online [here](https://developer.gnome.org/hig/).
8+
9+
## Goals for the HIG
10+
11+
Goals:
12+
13+
- App designers and developers are the primary audiences
14+
- Document the most important and commond design patterns
15+
- Be easy to digest: don't be too long or verbose
16+
- Use examples and demos as much as possible
17+
18+
Non-goals:
19+
20+
- Not a generic guide to UX design, and shouldn't try to fill in basic design knowledge, but should be accessible to those with relatively little design expertise
21+
- Don't document every design pattern or possible variation
22+
- Don't be prescriptive: allow designers to make their own choices, and give them the space to be creative
23+
24+
## How to build and edit
25+
26+
Sphinx can be used to build and preview the static html site locally, either with the browser or VS Code.
27+
28+
### 1. Install dependencies
29+
30+
On Fedora, run:
31+
32+
```
33+
dnf install -y python3-sphinx python3-pip
34+
pip3 install --upgrade furo
35+
```
36+
37+
### 2. Make changes
38+
39+
VS Code is a good choice for this, as it is able to preview the source files as rendered HTML.
40+
41+
### 3. Build
42+
43+
Building the docs checks for errors, as well as producing local static HTML of the HIG website.
44+
45+
To build, run `00localbuild.sh` from the project root. The build output can then be found in ``/build``.
46+
47+
### 4. Deploy changes
48+
49+
Changes to `main` branch are automatically deployed to the site using CI.
50+

requirements.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sphinx==6.2.*
2+
furo

requirements.txt

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.12
3+
# by the following command:
4+
#
5+
# pip-compile requirements.in
6+
#
7+
alabaster==0.7.16
8+
# via sphinx
9+
babel==2.14.0
10+
# via sphinx
11+
beautifulsoup4==4.12.3
12+
# via furo
13+
certifi==2023.11.17
14+
# via requests
15+
charset-normalizer==3.3.2
16+
# via requests
17+
docutils==0.19
18+
# via sphinx
19+
furo==2024.1.29
20+
# via -r requirements.in
21+
idna==3.6
22+
# via requests
23+
imagesize==1.4.1
24+
# via sphinx
25+
jinja2==3.1.3
26+
# via sphinx
27+
markupsafe==2.1.4
28+
# via jinja2
29+
packaging==23.2
30+
# via sphinx
31+
pygments==2.17.2
32+
# via
33+
# furo
34+
# sphinx
35+
requests==2.31.0
36+
# via sphinx
37+
snowballstemmer==2.2.0
38+
# via sphinx
39+
soupsieve==2.5
40+
# via beautifulsoup4
41+
sphinx==6.2.1
42+
# via
43+
# -r requirements.in
44+
# furo
45+
# sphinx-basic-ng
46+
sphinx-basic-ng==1.0.0b2
47+
# via furo
48+
sphinxcontrib-applehelp==1.0.8
49+
# via sphinx
50+
sphinxcontrib-devhelp==1.0.6
51+
# via sphinx
52+
sphinxcontrib-htmlhelp==2.0.5
53+
# via sphinx
54+
sphinxcontrib-jsmath==1.0.1
55+
# via sphinx
56+
sphinxcontrib-qthelp==1.0.7
57+
# via sphinx
58+
sphinxcontrib-serializinghtml==1.1.10
59+
# via sphinx
60+
urllib3==2.1.0
61+
# via requests

source/_ext/hig_palette.py

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
"""
2+
hig_www.hig_palette
3+
~~~~~~~~~~~~~~~~~~~
4+
5+
Access properties of GNOME's HIG palette via rST roles.
6+
"""
7+
8+
from urllib.parse import urljoin
9+
import base64
10+
11+
from docutils.utils import unescape
12+
from docutils import nodes
13+
from sphinx.errors import ExtensionError
14+
15+
# Name of this extension
16+
extname = "hig_palette"
17+
# The variable in conf.py that maps color names to (R, G, B) tuples
18+
colors_var = "hig_palette_colors_rgb"
19+
# This can be used within the CSS to apply styles to the resulting image
20+
svg_class_name = "hig-palette-swatch"
21+
22+
"""
23+
Creates an SVG containing a rect, filled with the RGB tuple passed in.
24+
"""
25+
def create_palette_svg_str(rgb):
26+
return """
27+
<svg width="100%%" height="100%%"
28+
xmlns="http://www.w3.org/2000/svg"
29+
xmlns:xlink="http://www.w3.org/1999/xlink">
30+
31+
<rect width="100%%" height="100%%" fill="rgb%s" />
32+
</svg>
33+
""" % rgb.__str__()
34+
35+
def create_rgb_node(rgb):
36+
output = rgb.__str__()
37+
return nodes.Text(output, output)
38+
39+
def create_hex_node(rgb):
40+
red, green, blue = rgb
41+
output = f"#{red:02x}{green:02x}{blue:02x}"
42+
return nodes.Text(output, output)
43+
44+
def create_svg_node(rgb, name):
45+
svg_str = create_palette_svg_str(rgb)
46+
svg_base64_str = base64.b64encode(svg_str.encode("ascii"))
47+
uri = f"data:image/svg+xml;base64,{svg_base64_str.decode('ascii')}"
48+
49+
node = nodes.image(svg_str)
50+
node["uri"] = uri
51+
52+
node['classes'].append(svg_class_name)
53+
node["alt"] = f"Color '{name}' from the GNOME HIG palette"
54+
55+
return node
56+
57+
"""
58+
Creates a role function that can be registered with Sphinx.
59+
"""
60+
def make_palette_role(color_mappings, representation):
61+
valid_representations = ["rgb", "hex", "svg"]
62+
63+
if not representation in valid_representations:
64+
raise ExtensionError("Cannot generate representation '%s' for colors"
65+
% representation, modname=extname)
66+
67+
def role(type, rawtext, text, lineno, inliner, options={}, content={}):
68+
color_name = unescape(text)
69+
70+
if not color_name in color_mappings:
71+
raise ExtensionError(
72+
"Definition for color '%s' not found in conf.py" % color_name,
73+
modname=extname)
74+
75+
color_rgb = color_mappings[color_name]
76+
node = None
77+
78+
if representation == "rgb":
79+
node = create_rgb_node(color_rgb)
80+
elif representation == "hex":
81+
node = create_hex_node(color_rgb)
82+
elif representation == "svg":
83+
node = create_svg_node(color_rgb, color_name)
84+
85+
return [node], []
86+
87+
return role
88+
89+
def setup_palette_roles(app):
90+
color_mappings = app.config[colors_var]
91+
92+
# returns a text node with a tuple (R, G, B) representing a defined color
93+
app.add_role("palette-rgb", make_palette_role(color_mappings, "rgb"))
94+
# returns a text node with the hexadecimal representation of a defined color
95+
app.add_role("palette-hex", make_palette_role(color_mappings, "hex"))
96+
# returns an image node set to an SVG from create_palette_svg()
97+
app.add_role("palette-svg", make_palette_role(color_mappings, "svg"))
98+
99+
def setup(app):
100+
app.add_config_value(colors_var, {}, "env")
101+
app.connect("builder-inited", setup_palette_roles)
102+
103+
return {
104+
"version": "0.1",
105+
"parallel_read_safe": True,
106+
"parellel_write_safe": True
107+
}

0 commit comments

Comments
 (0)