Skip to content

Commit

Permalink
📚 Make octicon list a table (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored May 18, 2024
1 parent 5749864 commit fe583c5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Homepage = "https://github.com/executablebooks/sphinx-design"
Documentation = "https://sphinx-design.readthedocs.io"

[project.optional-dependencies]
code_style = ["pre-commit>=3,<4"]
code-style = ["pre-commit>=3,<4"]
rtd = ["myst-parser>=1,<3"]
testing = [
"myst-parser>=1,<3",
Expand All @@ -43,10 +43,10 @@ testing = [
"pytest-regressions",
"defusedxml",
]
theme_furo = ["furo~=2023.7.0"]
theme_pydata = ["pydata-sphinx-theme~=0.13.0"]
theme_rtd = ["sphinx-rtd-theme~=1.0"]
theme_sbt = ["sphinx-book-theme~=1.0"]
theme-furo = ["furo~=2023.7.0"]
theme-pydata = ["pydata-sphinx-theme~=0.13.0"]
theme-rtd = ["sphinx-rtd-theme~=1.0"]
theme-sbt = ["sphinx-book-theme~=1.0"]

[tool.flit.sdist]
exclude = [
Expand Down
37 changes: 23 additions & 14 deletions sphinx_design/icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,31 @@ class AllOcticons(SphinxDirective):
def run(self) -> list[nodes.Node]:
"""Run the directive."""
classes = self.options.get("class", [])
list_node = nodes.bullet_list()
table = nodes.table()
group = nodes.tgroup(cols=2)
table += group
group.extend(
(
nodes.colspec(colwidth=1),
nodes.colspec(colwidth=1),
)
)
body = nodes.tbody()
group += body
for icon in list_octicons():
item_node = nodes.list_item()
item_node.extend(
(
nodes.literal(icon, icon),
nodes.Text(": "),
nodes.raw(
"",
nodes.Text(get_octicon(icon, classes=classes)),
format="html",
),
)
row = nodes.row()
body += row
cell = nodes.entry()
row += cell
cell += nodes.literal(icon, icon)
cell = nodes.entry()
row += cell
cell += nodes.raw(
"",
get_octicon(icon, classes=classes),
format="html",
)
list_node += item_node
return [list_node]
return [table]


class fontawesome(nodes.Element, nodes.General): # noqa: N801
Expand Down

0 comments on commit fe583c5

Please sign in to comment.