aboutsummaryrefslogtreecommitdiffhomepage
path: root/docshelper
diff options
context:
space:
mode:
Diffstat (limited to 'docshelper')
-rw-r--r--docshelper/docs.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/docshelper/docs.go b/docshelper/docs.go
index 3de350f61..94cb70dec 100644
--- a/docshelper/docs.go
+++ b/docshelper/docs.go
@@ -19,14 +19,19 @@ import (
"encoding/json"
)
+// DocProviders contains all DocProviders added to the system.
var DocProviders = make(map[string]DocProvider)
+// AddDocProvider adds or updates the DocProvider for a given name.
func AddDocProvider(name string, provider DocProvider) {
DocProviders[name] = provider
}
+// DocProvider is used to save arbitrary JSON data
+// used for the generation of the documentation.
type DocProvider func() map[string]interface{}
+// MarshalJSON returns a JSON representation of the DocProvider.
func (d DocProvider) MarshalJSON() ([]byte, error) {
return json.MarshalIndent(d(), "", " ")
}