You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by ro...@apache.org on 2024/09/25 08:45:39 UTC
(incubator-answer-plugins) 04/05: style: Format code
This is an automated email from the ASF dual-hosted git repository.
robin0716 pushed a commit to branch refactor/hooks-fetch
in repository https://gitbox.apache.org/repos/asf/incubator-answer-plugins.git
commit 8366710ad3ae43e1f51769d7d7a502cd5192a316
Author: robin <ro...@rnode.me>
AuthorDate: Wed Sep 25 16:45:14 2024 +0800
style: Format code
---
captcha-google-v2/i18n/translation.go | 14 +--
captcha-google-v2/recaptcha.go | 4 +-
render-markdown-codehighlight/i18n/translation.go | 13 ++-
.../renderMarkdownCodehighlight.go | 119 ++++++++++-----------
render-markdown-codehighlight/theme_list.go | 115 ++++++++++----------
5 files changed, 131 insertions(+), 134 deletions(-)
diff --git a/captcha-google-v2/i18n/translation.go b/captcha-google-v2/i18n/translation.go
index 7a84a0c..a76c644 100644
--- a/captcha-google-v2/i18n/translation.go
+++ b/captcha-google-v2/i18n/translation.go
@@ -20,12 +20,12 @@
package i18n
const (
- InfoName = "plugin.google_v2_captcha.backend.info.name"
- InfoDescription = "plugin.google_v2_captcha.backend.info.description"
- ConfigSiteKeyTitle = "plugin.google_v2_captcha.backend.config.site_key.title"
- ConfigSiteKeyDescription = "plugin.google_v2_captcha.backend.config.site_key.description"
- ConfigSecretKeyTitle = "plugin.google_v2_captcha.backend.config.secret_key.title"
- ConfigSecretKeyDescription = "plugin.google_v2_captcha.backend.config.secret_key.description"
- ConfigSiteVerifyEndpointTitle = "plugin.google_v2_captcha.backend.config.site_verify_endpoint.title"
+ InfoName = "plugin.google_v2_captcha.backend.info.name"
+ InfoDescription = "plugin.google_v2_captcha.backend.info.description"
+ ConfigSiteKeyTitle = "plugin.google_v2_captcha.backend.config.site_key.title"
+ ConfigSiteKeyDescription = "plugin.google_v2_captcha.backend.config.site_key.description"
+ ConfigSecretKeyTitle = "plugin.google_v2_captcha.backend.config.secret_key.title"
+ ConfigSecretKeyDescription = "plugin.google_v2_captcha.backend.config.secret_key.description"
+ ConfigSiteVerifyEndpointTitle = "plugin.google_v2_captcha.backend.config.site_verify_endpoint.title"
ConfigSiteVerifyEndpointDescription = "plugin.google_v2_captcha.backend.config.site_verify_endpoint.description"
)
diff --git a/captcha-google-v2/recaptcha.go b/captcha-google-v2/recaptcha.go
index 7083bdc..b610a81 100644
--- a/captcha-google-v2/recaptcha.go
+++ b/captcha-google-v2/recaptcha.go
@@ -42,8 +42,8 @@ type Captcha struct {
}
type CaptchaConfig struct {
- SiteKey string `json:"site_key"`
- SecretKey string `json:"secret_key"`
+ SiteKey string `json:"site_key"`
+ SecretKey string `json:"secret_key"`
SiteVerifyEndpoint string `json:"site_verify_endpoint"`
}
diff --git a/render-markdown-codehighlight/i18n/translation.go b/render-markdown-codehighlight/i18n/translation.go
index ed3059d..d9a08b5 100644
--- a/render-markdown-codehighlight/i18n/translation.go
+++ b/render-markdown-codehighlight/i18n/translation.go
@@ -17,11 +17,10 @@
* under the License.
*/
- package i18n
+package i18n
- const (
- InfoName = "plugin.render_markdown_codehighlight.backend.info.name"
- InfoDescription = "plugin.render_markdown_codehighlight.backend.info.description"
- ConfigCssFilteringTitle = "plugin.render_markdown_codehighlight.backend.config.css_filtering.title"
- )
-
+const (
+ InfoName = "plugin.render_markdown_codehighlight.backend.info.name"
+ InfoDescription = "plugin.render_markdown_codehighlight.backend.info.description"
+ ConfigCssFilteringTitle = "plugin.render_markdown_codehighlight.backend.config.css_filtering.title"
+)
diff --git a/render-markdown-codehighlight/renderMarkdownCodehighlight.go b/render-markdown-codehighlight/renderMarkdownCodehighlight.go
index 380e0dd..e97388b 100644
--- a/render-markdown-codehighlight/renderMarkdownCodehighlight.go
+++ b/render-markdown-codehighlight/renderMarkdownCodehighlight.go
@@ -17,51 +17,51 @@
* under the License.
*/
- package render_markdown_codehighlight
+package render_markdown_codehighlight
- import (
- "embed"
- "encoding/json"
- "log"
- "github.com/gin-gonic/gin"
- "strings"
- "github.com/apache/incubator-answer-plugins/render-markdown-codehighlight/i18n"
- "github.com/apache/incubator-answer-plugins/util"
- "github.com/apache/incubator-answer/plugin"
- )
-
- //go:embed info.yaml
- var Info embed.FS
-
- type Render struct {
- Config *RenderConfig
- }
-
- type RenderConfig struct {
- SelectTheme string `json:"select_theme"`
- }
-
- func init() {
- plugin.Register(&Render{
- Config: &RenderConfig{},
- })
- }
-
- func (r *Render) Info() plugin.Info {
- info := &util.Info{}
- info.GetInfo(Info)
-
- return plugin.Info{
- Name: plugin.MakeTranslator(i18n.InfoName),
- SlugName: info.SlugName,
- Description: plugin.MakeTranslator(i18n.InfoDescription),
- Author: info.Author,
- Version: info.Version,
- Link: info.Link,
- }
- }
+import (
+ "embed"
+ "encoding/json"
+ "github.com/apache/incubator-answer-plugins/render-markdown-codehighlight/i18n"
+ "github.com/apache/incubator-answer-plugins/util"
+ "github.com/apache/incubator-answer/plugin"
+ "github.com/gin-gonic/gin"
+ "log"
+ "strings"
+)
- func (r *Render) ConfigFields() []plugin.ConfigField {
+//go:embed info.yaml
+var Info embed.FS
+
+type Render struct {
+ Config *RenderConfig
+}
+
+type RenderConfig struct {
+ SelectTheme string `json:"select_theme"`
+}
+
+func init() {
+ plugin.Register(&Render{
+ Config: &RenderConfig{},
+ })
+}
+
+func (r *Render) Info() plugin.Info {
+ info := &util.Info{}
+ info.GetInfo(Info)
+
+ return plugin.Info{
+ Name: plugin.MakeTranslator(i18n.InfoName),
+ SlugName: info.SlugName,
+ Description: plugin.MakeTranslator(i18n.InfoDescription),
+ Author: info.Author,
+ Version: info.Version,
+ Link: info.Link,
+ }
+}
+
+func (r *Render) ConfigFields() []plugin.ConfigField {
themeOptions := make([]plugin.ConfigFieldOption, len(ThemeList))
for i, theme := range ThemeList {
@@ -87,20 +87,19 @@
},
}
}
-
- func (r *Render) ConfigReceiver(config []byte) error {
- c := &RenderConfig{}
- _ = json.Unmarshal(config, c)
- r.Config = c
- log.Println("Received theme:", r.Config.SelectTheme)
- return nil
- }
-
- func (r *Render) GetRenderConfig(ctx *gin.Context) (renderConfig *plugin.RenderConfig) {
- log.Println("Current theme:", r.Config.SelectTheme)
- renderConfig = &plugin.RenderConfig{
- SelectTheme: r.Config.SelectTheme,
- }
- return
- }
-
+
+func (r *Render) ConfigReceiver(config []byte) error {
+ c := &RenderConfig{}
+ _ = json.Unmarshal(config, c)
+ r.Config = c
+ log.Println("Received theme:", r.Config.SelectTheme)
+ return nil
+}
+
+func (r *Render) GetRenderConfig(ctx *gin.Context) (renderConfig *plugin.RenderConfig) {
+ log.Println("Current theme:", r.Config.SelectTheme)
+ renderConfig = &plugin.RenderConfig{
+ SelectTheme: r.Config.SelectTheme,
+ }
+ return
+}
diff --git a/render-markdown-codehighlight/theme_list.go b/render-markdown-codehighlight/theme_list.go
index 6051b67..dc16fa0 100644
--- a/render-markdown-codehighlight/theme_list.go
+++ b/render-markdown-codehighlight/theme_list.go
@@ -17,65 +17,64 @@
* under the License.
*/
-
package render_markdown_codehighlight
var ThemeList = []string{
-"1c-light",
- "a11y-all",
- "agate-dark",
- "an-dark",
- "androidstudio-dark",
- "arduino-light",
- "arta-dark",
- "ascetic-light",
- "atom-all",
- "brown-light",
- "codepen-dark",
- "color-light",
- "dark-dark",
- "default-light",
- "devibeans-dark",
- "docco-light",
- "far-dark",
- "felipec-dark",
- "foundation-light",
- "github-all",
- "gml-dark",
- "googlecode-light",
- "gradient-all",
- "grayscale-light",
- "hybrid-dark",
- "idea-light",
- "intellij-light",
- "ir-dark",
- "isbl-all",
- "kimbie-all",
- "lightfair-light",
- "lioshi-dark",
- "magula-light",
- "mono-light",
- "monokai-dark",
- "night-dark",
- "nnfx-all",
- "nord-dark",
- "obsidian-dark",
- "panda-all",
- "paraiso-all",
- "pojoaque-light",
- "purebasic-light",
- "qtcreator-all",
- "rainbow-dark",
- "routeros-light",
- "school-light",
- "shades-dark",
- "srcery-dark",
- "stackoverflow-all",
- "sunburst-dark",
- "tokyo-all",
- "tomorrow-dark",
- "vs-light",
- "vs2015-dark",
- "xcode-light",
- "xt256-dark",
+ "1c-light",
+ "a11y-all",
+ "agate-dark",
+ "an-dark",
+ "androidstudio-dark",
+ "arduino-light",
+ "arta-dark",
+ "ascetic-light",
+ "atom-all",
+ "brown-light",
+ "codepen-dark",
+ "color-light",
+ "dark-dark",
+ "default-light",
+ "devibeans-dark",
+ "docco-light",
+ "far-dark",
+ "felipec-dark",
+ "foundation-light",
+ "github-all",
+ "gml-dark",
+ "googlecode-light",
+ "gradient-all",
+ "grayscale-light",
+ "hybrid-dark",
+ "idea-light",
+ "intellij-light",
+ "ir-dark",
+ "isbl-all",
+ "kimbie-all",
+ "lightfair-light",
+ "lioshi-dark",
+ "magula-light",
+ "mono-light",
+ "monokai-dark",
+ "night-dark",
+ "nnfx-all",
+ "nord-dark",
+ "obsidian-dark",
+ "panda-all",
+ "paraiso-all",
+ "pojoaque-light",
+ "purebasic-light",
+ "qtcreator-all",
+ "rainbow-dark",
+ "routeros-light",
+ "school-light",
+ "shades-dark",
+ "srcery-dark",
+ "stackoverflow-all",
+ "sunburst-dark",
+ "tokyo-all",
+ "tomorrow-dark",
+ "vs-light",
+ "vs2015-dark",
+ "xcode-light",
+ "xt256-dark",
}