Skip to content

Commit

Permalink
Fixed errors in deprecation path of social plugin settings
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed May 8, 2023
1 parent b0d59f2 commit 8b50290
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions material/plugins/social/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ class SocialPluginConfig(Config):

# Deprecated options
cards_color = opt.Deprecated(
option_type = opt.Type(dict, default = {}),
message =
"Deprecated, use 'cards_layout_options.background_color' "
"and 'cards_layout_options.color' with 'default' layout"
)
)
cards_font = opt.Deprecated(
option_type = opt.Type(str),
message = "Deprecated, use 'cards_layout_options.font_family'"
)

Expand Down Expand Up @@ -138,12 +140,10 @@ def on_config(self, config):
self.color = colors.get(primary, self.color)

# Retrieve color overrides
options = self.config.cards_layout_options
self.color = {
**self.color,
**{
"fill": self.config.cards_layout_options.get("background_color"),
"text": self.config.cards_layout_options.get("color")
}
"fill": options.get("background_color", self.color["fill"]),
"text": options.get("color", self.color["text"])
}

# Retrieve custom_dir path
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/social/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ class SocialPluginConfig(Config):

# Deprecated options
cards_color = opt.Deprecated(
option_type = opt.Type(dict, default = {}),
message =
"Deprecated, use 'cards_layout_options.background_color' "
"and 'cards_layout_options.color' with 'default' layout"
)
)
cards_font = opt.Deprecated(
option_type = opt.Type(str),
message = "Deprecated, use 'cards_layout_options.font_family'"
)

Expand Down Expand Up @@ -138,12 +140,10 @@ def on_config(self, config):
self.color = colors.get(primary, self.color)

# Retrieve color overrides
options = self.config.cards_layout_options
self.color = {
**self.color,
**{
"fill": self.config.cards_layout_options.get("background_color"),
"text": self.config.cards_layout_options.get("color")
}
"fill": options.get("background_color", self.color["fill"]),
"text": options.get("color", self.color["text"])
}

# Retrieve custom_dir path
Expand Down

0 comments on commit 8b50290

Please sign in to comment.