Skip to content
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
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

module(
name = "score_docs_as_code",
version = "1.2.0",
version = "1.3.0",
compatibility_level = 1,
)

Expand Down
1 change: 0 additions & 1 deletion docs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def docs(source_dir = "docs", data = [], deps = []):
By using this function, you'll get any and all updates for documentation targets in one place.
"""

data = data + ["@score_docs_as_code//src:docs_assets"]
call_path = native.package_name()

if call_path != "":
Expand Down
11 changes: 0 additions & 11 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,6 @@ compile_pip_requirements(
],
)

filegroup(
name = "docs_assets",
srcs = glob(
[
"assets/**/*",
],
allow_empty = True,
),
visibility = ["//visibility:public"],
)

# Running this executes the `collect_source_files.bzl` aspect.
# Collects all source files from specified targets in 'deps', and makes them available for parsing for the source_code_linker

Expand Down
17 changes: 11 additions & 6 deletions src/extensions/score_layout/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@aspect_rules_py//py:defs.bzl", "py_library")
load("@pip_process//:requirements.bzl", "all_requirements")
load("@pip_process//:requirements.bzl", "requirement")

py_library(
name = "score_layout",
srcs = glob(
["*.py"],
),
srcs = glob([
"*.py",
# Adding assets as src instead of data ensures they are included in the
# library as they would normally be, and we do not need to go through bazel's
# RUNFILES_DIR mechanism to access them. This makes the code much simpler.
# And it makes the library far easier extractable from bazel into a normal
# python package if we ever want to do that.
"assets/**",
]),
imports = ["."],
visibility = ["//visibility:public"],
# TODO: Figure out if all requirements are needed or if we can break it down a bit
deps = all_requirements,
deps = [requirement("sphinx")],
)
32 changes: 16 additions & 16 deletions src/extensions/score_layout/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,20 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
import os
import logging
from pathlib import Path
from typing import Any

import html_options
import sphinx_options
from sphinx.application import Sphinx

logger = logging.getLogger(__name__)


def setup(app: Sphinx) -> dict[str, str | bool]:
logger.debug("score_layout setup called")

app.connect("config-inited", update_config)
return {
"version": "0.1",
Expand All @@ -29,27 +33,23 @@ def setup(app: Sphinx) -> dict[str, str | bool]:


def update_config(app: Sphinx, _config: Any):
logger.debug("score_layout update_config called")

app.config.needs_layouts = sphinx_options.needs_layouts
app.config.needs_global_options = sphinx_options.needs_global_options
app.config.html_theme = html_options.html_theme
app.config.html_context = html_options.return_html_context(app)
app.config.html_theme_options = html_options.return_html_theme_options(app)

# Setting HTML static path
if r := os.getenv("RUNFILES_DIR"):
if (Path(r) / "score_docs_as_code+").exists():
# Docs-as-code used as a module with bazel 8
module = "score_docs_as_code+"
elif (Path(r) / "score_docs_as_code~").exists():
# Docs-as-code used as a module with bazel 7
module = "score_docs_as_code~"
else:
# Docs-as-code is the current module
module = "_main"
app.config.html_static_path.append(str(Path(r) / module / "src/assets"))

puml = Path(r) / module / "src/assets/puml-theme-score.puml"
app.config.needs_flow_configs = {"score_config": f"!include {puml}"}
logger.debug(f"score_layout __file__: {__file__}")

score_layout_path = Path(__file__).parent.resolve()
logger.debug(f"score_layout_path: {score_layout_path}")

app.config.html_static_path.append(str(score_layout_path / "assets"))

puml = score_layout_path / "assets" / "puml-theme-score.puml"
app.config.needs_flow_configs = {"score_config": f"!include {puml}"}

app.add_css_file("css/score.css", priority=500)
app.add_css_file("css/score_needs.css", priority=500)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ html {

The base color is TEAL */

/* TODO: Does not work as intended */
.version-switcher__container[data-theme="light"] {
background-color: #a382c5;
}

Comment on lines +16 to +19
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

button.btn.version-switcher__button (for the button itself)
.version-switcher__menu a.list-group-item (for the list that pops out)

These are the two selectors you would need to change the background.
at least works locally.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both with 'background-color' that was correct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MaximilianSoerenPollak I'll have a look. Separate PR, so this one gets merged first of all.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries :) Was just bored, so figured it out quickly.

html[data-theme="light"] {
/* Search Box background color. */
--bs-btn-hover-bg: #a382c5;
/* Menu svg items */
--pst-color-muted: #FFF;
/* Text color within cards (same background as page header) */
Expand Down