fibr

package
v0.25.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FuncMap = template.FuncMap{
	"rebuildPaths": func(parts []string, index int) string {
		return fmt.Sprintf("/%s/", strings.Join(parts[:index+1], "/"))
	},
	"join": func(arr []string, separator string) string {
		return strings.Join(arr, separator)
	},
	"raw": func(content string) template.URL {
		return template.URL(content)
	},
	"splitLines": func(value string) []string {
		return strings.Split(value, "\n")
	},
	"add": func(a, b int) int {
		return a + b
	},
	"contains": func(arr []string, value string) bool {
		for _, item := range arr {
			if item == value {
				return true
			}
		}

		return false
	},
	"iconFromExtension": func(file provider.RenderItem) string {
		switch {
		case provider.ArchiveExtensions[file.Extension]:
			return "file-archive"
		case provider.AudioExtensions[file.Extension]:
			return "file-audio"
		case provider.CodeExtensions[file.Extension]:
			return "file-code"
		case provider.ExcelExtensions[file.Extension]:
			return "file-excel"
		case provider.ImageExtensions[file.Extension]:
			return "file-image"
		case provider.PdfExtensions[file.Extension]:
			return "file-pdf"
		case provider.VideoExtensions[file.Extension] != "":
			return "file-video"
		case provider.WordExtensions[file.Extension]:
			return "file-word"
		default:
			return "file"
		}
	},
}

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(crudApp provider.Crud, rendererApp *renderer.App, shareApp provider.ShareManager, webhookApp provider.WebhookManager, loginApp provider.Auth) App

func (App) TemplateFunc added in v0.4.1

func (a App) TemplateFunc(w http.ResponseWriter, r *http.Request) (renderer.Page, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL