-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logic and examples for generic markdown and HTML drivers
- Loading branch information
Showing
17 changed files
with
531 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cato | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/cs3org/cato/resources" | ||
) | ||
|
||
func TestHTML(t *testing.T) { | ||
|
||
rootPath := "examples/" | ||
conf := &resources.CatoConfig{ | ||
Driver: "html", | ||
} | ||
|
||
if _, err := GenerateDocumentation(rootPath, conf); err != nil { | ||
t.Errorf("GenerateDocumentation(): %w", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package cato | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/cs3org/cato/resources" | ||
) | ||
|
||
func TestMarkdown(t *testing.T) { | ||
|
||
rootPath := "examples/" | ||
conf := &resources.CatoConfig{ | ||
Driver: "markdown", | ||
DriverConfig: map[string]map[string]interface{}{ | ||
"markdown": map[string]interface{}{ | ||
"ReferenceBase": "https://github.com/cs3org/cato/tree/master/examples", | ||
}, | ||
}, | ||
} | ||
|
||
if _, err := GenerateDocumentation(rootPath, conf); err != nil { | ||
t.Errorf("GenerateDocumentation(): %w", err) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
type FileSystem struct { | ||
CacheDirectory string `docs:"/var/tmp/;Path of cache directory"` | ||
EnableLogging bool `docs:"false;Whether to enable logging"` | ||
AvailableChecksums []string `docs:"[adler, rabin];The list of checksums provided by the file system"` | ||
// Configs for various metadata drivers | ||
DriverConfig map[string]map[string]interface{} `docs:"{json:{encoding: UTF8}, xml:{encoding: ASCII}}"` | ||
// Config for the HTTP uploads service | ||
Uploads *UploadConfig `docs:"&UploadConfig{HTTPPrefix: uploads, DisableTus: false}"` | ||
} | ||
|
||
type UploadConfig struct { | ||
// Whether to disable TUS protocol for uploads. | ||
DisableTus bool `json:"disable_tus" docs:"false"` | ||
// The prefix at which the uploads service should be exposed. | ||
HTTPPrefix string `json:"http_prefix" docs:"uploads"` | ||
} | ||
|
||
func (fs FileSystem) init() { | ||
if fs.CacheDirectory == "" { | ||
fs.CacheDirectory = "/var/tmp/" | ||
} | ||
if len(fs.AvailableChecksums) == 0 { | ||
fs.AvailableChecksums = []string{"adler", "rabin"} | ||
} | ||
if fs.DriverConfig == nil { | ||
fs.DriverConfig = map[string]map[string]interface{}{ | ||
"json": map[string]interface{}{ | ||
"encoding": "UTF8", | ||
}, | ||
"xml": map[string]interface{}{ | ||
"encoding": "ASCII", | ||
}, | ||
} | ||
} | ||
if fs.Uploads == nil { | ||
fs.Uploads = &UploadConfig{ | ||
HTTPPrefix: "uploads", | ||
} | ||
} | ||
} | ||
|
||
func main() { | ||
fs := FileSystem{ | ||
AvailableChecksums: []string{"adler32"}, | ||
} | ||
fmt.Printf("FileSystem: %+v", fs) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
<h2>struct: FileSystem</h2> | ||
<ul> | ||
<li><b>CacheDirectory</b> - string</li> | ||
<ul> | ||
<li>Path of cache directory </li> | ||
<li>Default: "/var/tmp/"</li> | ||
</ul> | ||
<li><b>EnableLogging</b> - bool</li> | ||
<ul> | ||
<li>Whether to enable logging </li> | ||
<li>Default: false</li> | ||
</ul> | ||
<li><b>AvailableChecksums</b> - []string</li> | ||
<ul> | ||
<li>The list of checksums provided by the file system </li> | ||
<li>Default: [adler, rabin]</li> | ||
</ul> | ||
<li><b>DriverConfig</b> - map[string]map[string]interface{}</li> | ||
<ul> | ||
<li>Configs for various metadata drivers </li> | ||
<li>Default: {json:{encoding: UTF8}, xml:{encoding: ASCII}}</li> | ||
</ul> | ||
<li><b>Uploads</b> - *UploadConfig</li> | ||
<ul> | ||
<li>Config for the HTTP uploads service </li> | ||
<li>Default: &UploadConfig{HTTPPrefix: uploads, DisableTus: false}</li> | ||
</ul> | ||
</ul> | ||
|
||
<h2>struct: UploadConfig</h2> | ||
<ul> | ||
<li><b>disable_tus</b> - bool</li> | ||
<ul> | ||
<li>Whether to disable TUS protocol for uploads. </li> | ||
<li>Default: false</li> | ||
</ul> | ||
<li><b>http_prefix</b> - string</li> | ||
<ul> | ||
<li>The prefix at which the uploads service should be exposed. </li> | ||
<li>Default: "uploads"</li> | ||
</ul> | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
## struct: FileSystem | ||
- **CacheDirectory** - string | ||
- Path of cache directory [[Ref]](https://github.com/cs3org/cato/tree/master/examples/filesystem.go#L6) | ||
- Default: "/var/tmp/" | ||
- **EnableLogging** - bool | ||
- Whether to enable logging [[Ref]](https://github.com/cs3org/cato/tree/master/examples/filesystem.go#L7) | ||
- Default: false | ||
- **AvailableChecksums** - []string | ||
- The list of checksums provided by the file system [[Ref]](https://github.com/cs3org/cato/tree/master/examples/filesystem.go#L8) | ||
- Default: [adler, rabin] | ||
- **DriverConfig** - map[string]map[string]interface{} | ||
- Configs for various metadata drivers [[Ref]](https://github.com/cs3org/cato/tree/master/examples/filesystem.go#L10) | ||
- Default: {json:{encoding: UTF8}, xml:{encoding: ASCII}} | ||
- **Uploads** - *UploadConfig | ||
- Config for the HTTP uploads service [[Ref]](https://github.com/cs3org/cato/tree/master/examples/filesystem.go#L12) | ||
- Default: &UploadConfig{HTTPPrefix: uploads, DisableTus: false} | ||
|
||
## struct: UploadConfig | ||
- **disable_tus** - bool | ||
- Whether to disable TUS protocol for uploads. [[Ref]](https://github.com/cs3org/cato/tree/master/examples/filesystem.go#L17) | ||
- Default: false | ||
- **http_prefix** - string | ||
- The prefix at which the uploads service should be exposed. [[Ref]](https://github.com/cs3org/cato/tree/master/examples/filesystem.go#L19) | ||
- Default: "uploads" |
Oops, something went wrong.