File tree 4 files changed +24
-14
lines changed
4 files changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -20,10 +20,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
20
21
21
### Issues Fix
22
22
23
- - Fixed few regex-based/legacy highlight corrections (fixed #285 )
24
- - Closed #251
25
- - Fixed darkened sidebars when disabling ` options.sidebars.disabled `
26
- - Fixes #311
23
+ - Fixed few regex-based/legacy highlight corrections (fixed #285 )
24
+ - Closed #251
25
+ - Fixed bug where the current theme gets compiled multiple times instead of compiling all themes #290
26
+ - Fixed darkened sidebars when disabling ` options.sidebars.disabled `
27
+ - Fixes #311
27
28
28
29
## [ v1.0.1] - 23 July 2023
29
30
Original file line number Diff line number Diff line change @@ -99,10 +99,10 @@ function M.reset()
99
99
end
100
100
101
101
function M .get_compiled_info (opts )
102
+ opts = opts or {}
102
103
local output_path = opts .output_path or M .options .compile_path
103
104
local file_suffix = opts .file_suffix or M .options .compile_file_suffix
104
- local style = opts .name or M .theme
105
- return output_path , util .join_paths (output_path , style .. file_suffix )
105
+ return output_path , util .join_paths (output_path , (opts .theme or M .theme ) .. file_suffix )
106
106
end
107
107
108
108
function M .hash ()
Original file line number Diff line number Diff line change @@ -24,14 +24,20 @@ function M.reset()
24
24
require (' github-theme.override' ).reset ()
25
25
end
26
26
27
+ --- Compiles all themes/styles with their current settings.
28
+ --- @return nil
27
29
function M .compile ()
28
30
require (' github-theme.lib.log' ).clear ()
29
-
30
31
local compiler = require (' github-theme.lib.compiler' )
31
32
local themes = require (' github-theme.palette' ).themes
32
- for _ , style in ipairs (themes ) do
33
- compiler .compile ({ style = style })
33
+ local current_theme = config .theme
34
+ for _ , theme in ipairs (themes ) do
35
+ -- Compile current theme last (see discussion in #290)
36
+ if theme ~= current_theme then
37
+ compiler .compile ({ theme = theme })
38
+ end
34
39
end
40
+ compiler .compile ({ theme = current_theme })
35
41
end
36
42
37
43
-- Avoid g:colors_name reloading
Original file line number Diff line number Diff line change @@ -22,10 +22,14 @@ local function should_link(link)
22
22
return link and link ~= ' '
23
23
end
24
24
25
+ --- Compiles a single theme/style. `opts.theme` specifies the theme to compile,
26
+ --- otherwise the currently-set theme will be compiled.
27
+ --- @param opts ? { theme : string }
28
+ --- @return nil
25
29
function M .compile (opts )
26
30
opts = opts or {}
27
- local theme = config .theme
28
- local spec = require (' github-theme.spec' ).load (theme )
31
+ opts . theme = opts . theme or config .theme
32
+ local spec = require (' github-theme.spec' ).load (opts . theme )
29
33
local groups = require (' github-theme.group' ).from (spec )
30
34
local background = spec .palette .meta .light and ' light' or ' dark'
31
35
@@ -39,7 +43,7 @@ vim.o.termguicolors = true
39
43
vim.g.colors_name = "%s"
40
44
vim.o.background = "%s"
41
45
]] ,
42
- theme ,
46
+ opts . theme ,
43
47
background
44
48
),
45
49
}
@@ -68,8 +72,6 @@ vim.o.background = "%s"
68
72
end
69
73
70
74
table.insert (lines , ' end)' )
71
-
72
- opts .name = theme
73
75
local output_path , output_file = config .get_compiled_info (opts )
74
76
util .ensure_dir (output_path )
75
77
@@ -97,6 +99,7 @@ Bellow is the error message:
97
99
tmpfile
98
100
)
99
101
)
102
+
100
103
local efile = io.open (tmpfile , ' wb' )
101
104
efile :write (table.concat (lines , ' \n ' ))
102
105
efile :close ()
You can’t perform that action at this time.
0 commit comments