fibr

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 16 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 Service added in v0.26.0

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

func New

func New(crudService provider.Crud, rendererService *renderer.Service, shareService provider.ShareManager, webhookService provider.WebhookManager, loginService provider.Auth) Service

func (Service) TemplateFunc added in v0.26.0

func (s Service) 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