Skip to content

Commit 7f64cd5

Browse files
sbryngelsonclaude
andcommitted
Use CSS classes for seamless split <code> tags around Fortran %
The previous split <code> approach preserved % but created a visible gap due to border/padding on each element. Add f90l/f90r CSS classes that strip internal borders and padding so adjacent code spans render as one seamless pill: <code class="f90l">bc_y%</code><code class="f90r">beg</code>. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 101f9fb commit 7f64cd5

2 files changed

Lines changed: 25 additions & 6 deletions

File tree

docs/custom.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@
33
* Overrides for doxygen-awesome theme
44
*/
55

6+
/* Seamless split <code> tags for Fortran % struct accessors.
7+
* Doxygen consumes %<word> even inside code spans, so we split around %
8+
* into adjacent <code> elements and remove internal borders/padding. */
9+
code.f90l {
10+
border-right: 0;
11+
border-top-right-radius: 0;
12+
border-bottom-right-radius: 0;
13+
padding-right: 0;
14+
}
15+
code.f90r {
16+
border-left: 0;
17+
border-top-left-radius: 0;
18+
border-bottom-left-radius: 0;
19+
padding-left: 0;
20+
}
21+
622
/* Fix inline code visibility in colored admonition blocks (warning, attention, important, note, etc.) */
723

824
/* Warning/Attention/Important blocks (red/pink background) */

toolchain/mfc/gen_physics_docs.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,18 @@ def _format_message(msg: str) -> str:
8888
msg = re.sub(r"for (support|pulse) = \1\b", r"for the given \1", msg)
8989
msg = re.sub(r"for (support|pulse) = (\d+)", r"for \1 = \2", msg)
9090

91-
# Wrap code-like tokens in backticks (or <code> for Fortran % accessors).
92-
# Doxygen treats %<word> as "suppress auto-link" and consumes the %,
93-
# even inside backtick and <code> spans. To preserve the Fortran %
94-
# accessor, split into adjacent <code> tags so % is never followed
95-
# by a word character: <code>bc_y%</code><code>beg</code>.
91+
# Wrap code-like tokens in code formatting.
92+
# Doxygen consumes %<word> as "suppress auto-link" even inside backtick
93+
# and <code> spans. For Fortran % accessors, use split <code> tags with
94+
# CSS classes that remove internal borders, making them visually seamless.
9695
def _wrap_code(match: re.Match) -> str:
9796
token = match.group(1)
9897
if "%" in token:
99-
return "<code>" + token.replace("%", "%</code><code>") + "</code>"
98+
parts = token.split("%")
99+
result = parts[0]
100+
for part in parts[1:]:
101+
result += '%</code><code class="f90r">' + part
102+
return '<code class="f90l">' + result + "</code>"
100103
return f"`{token}`"
101104

102105
msg = _CODE_RE.sub(_wrap_code, msg)

0 commit comments

Comments
 (0)