-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.go
59 lines (46 loc) · 1.25 KB
/
lib.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// This file contains most of the public interface of Alexandria (the library).
// The remainder is the types defined in datastructures.go.
// This file is part of Alexandria which is released under AGPLv3.
// Copyright (C) 2015-2018 Colin Benner
// See LICENSE or go to https://github.com/yzhs/alexandria/LICENSE for full
// license details.
package alexandria
import (
"github.com/yzhs/alexandria/backends/latex"
"github.com/yzhs/alexandria/common"
)
// Programm name and version
const (
NAME = "Alexandria"
VERSION = "0.1"
)
type scrollType int
const (
latexScroll scrollType = iota
markdownScroll
)
type (
Backend = common.Backend
ID = common.ID
Scroll = common.Scroll
Statistics = common.Statistics
)
var (
Assets = common.Assets
Config = common.Config
)
func NewBackend() common.Backend {
return latex.LatexToPngBackend{Renderer: &latex.XelatexImagemagickRenderer{}}
}
func LoadScrolls(ids []ID) ([]common.Scroll, error) {
return common.LoadScrolls(NewBackend(), ids)
}
func UpdateIndex() error {
return common.UpdateIndex(NewBackend())
}
func FindMatchingScrolls(query string) ([]ID, int, error) {
return common.FindMatchingScrolls(query)
}
func ComputeStatistics() (Statistics, error) {
return common.ComputeStatistics()
}