udocs

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	README_MD    = "README.md"
	SUMMARY_MD   = "SUMMARY.md"
	SIDEBAR_JSON = "sidebar.json"
	INDEX_HTML   = "index.html"
)

Variables

View Source
var DefaultQuipClient = NewQuipClient(os.Getenv("UDOCS_QUIP_ACCESS_TOKEN"))

Functions

func ArchivePath

func ArchivePath() string

func Build

func Build(route, dir string, dao storage.Dao) error

func BuildPath

func BuildPath() string

func ConfPath

func ConfPath() string

func DefaultTemplateFiles

func DefaultTemplateFiles() []string

func DeployPath

func DeployPath() string

func ExtractRoute

func ExtractRoute(r io.Reader) string

func GetRemotePage

func GetRemotePage(url string) ([]byte, error)

func IsQuipBlob

func IsQuipBlob(filename string) bool

func IsQuipThread

func IsQuipThread(filename string) bool

func IsSummaryFile

func IsSummaryFile(filename string) bool

func LoadQuipDocuments

func LoadQuipDocuments(summary Summary, dao storage.Dao) error

func ParseSummaryHeader

func ParseSummaryHeader(scanner *bufio.Scanner) string

func RootPath

func RootPath() string

func SearchPath

func SearchPath() string

func UpdateSearchIndex

func UpdateSearchIndex(summary Summary, dao storage.Dao) error

func Validate

func Validate(dir string) error

Validate validates the the given docs directory meets the format required by UDocs. Specifically, the directory must exist, be named "docs" , and include both a README.md and SUMMARY.md file at the root of the directory.

func WatchFiles

func WatchFiles(dir string, watch chan struct{}, kill chan error)

Types

type Page

type Page struct {
	Title     string `json:"title"`
	Path      string `json:"path"`
	TreeLevel int    `json:"tree_level"`
	SubPages  []Page `json:"sub_pages"`
}

type QuipClient

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

func NewQuipClient

func NewQuipClient(accessToken string) *QuipClient

func (*QuipClient) GetBlob

func (qc *QuipClient) GetBlob(threadID, blobID string) ([]byte, error)

func (*QuipClient) GetThread

func (qc *QuipClient) GetThread(id string) (*Thread, error)
type Sidebar []Summary

func LoadSidebar

func LoadSidebar(dao storage.Dao) (Sidebar, error)

func (Sidebar) Merge

func (s Sidebar) Merge(summary Summary) Sidebar

func (Sidebar) Save

func (s Sidebar) Save(dao storage.Dao) error

type Summary

type Summary struct {
	Route  string `json:"route"`
	Header string `json:"header"`
	Pages  []Page `json:"pages"`
}

func ParseSummary

func ParseSummary(route string, data []byte) (Summary, error)

type Template

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

func MustParseTemplate

func MustParseTemplate(params map[string]interface{}, files ...string) *Template

func (*Template) Execute

func (t *Template) Execute(w io.Writer, name string, b []byte) error

func (*Template) WithParameter

func (t *Template) WithParameter(k string, v interface{}) *Template

type Thread

type Thread struct {
	ExpandedUserIds []string `json:"expanded_user_ids"`
	UserIds         []string `json:"user_ids"`
	SharedFolderIds []string `json:"shared_folder_ids"`
	HTML            string   `json:"html"`
	ThreadMetadata  struct {
		CreatedUsec int64  `json:"created_usec"`
		UpdatedUsec int64  `json:"updated_usec"`
		ID          string `json:"id"`
		Title       string `json:"title"`
		Link        string `json:"link"`
	} `json:"thread"`
}

Jump to

Keyboard shortcuts

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