Skip to content

Commit 9ea91be

Browse files
committed
doc: adapt to the latest rustdoc version's theme switching code
1 parent 2ed3c96 commit 9ea91be

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/r3/src/common.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,8 @@ body.theme-ayu span.center img, body.theme-ayu center img {
115115
<!--
116116
// Monitors the current rustdoc theme and adds `.theme-NAME` to `<body>`
117117
function initThemeMonitor() {
118-
if (typeof getCurrentValue !== 'function' ||
119-
typeof switchTheme !== 'function' ||
120-
typeof getSystemValue !== 'function' ||
118+
if (typeof switchTheme !== 'function' ||
119+
typeof themeStyle !== 'object' ||
121120
typeof document.body.classList === 'undefined')
122121
{
123122
// Something is wrong, don't do anything
@@ -133,7 +132,9 @@ function initThemeMonitor() {
133132
document.body.classList.add(currentClassName);
134133
}
135134

136-
onApplyTheme(getCurrentValue("rustdoc-theme") || getSystemValue() || "light");
135+
var match = themeStyle.href.match(/([a-z]+)\.css$/);
136+
var currentStyle = (match && match[1]) || "light";
137+
onApplyTheme(currentStyle);
137138

138139
// Intercept calls to `switchTheme`
139140
var originalSwitchTheme = switchTheme;

0 commit comments

Comments
 (0)