Documentation ¶
Index ¶
- Constants
- Variables
- func Build()
- func Compress(input []byte, output io.Writer)
- func Decompress(input io.Reader, output []byte)
- func Interface(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func Pretty(pretty bool) func(*Wikipedia) error
- func Rank()
- func Server(encyclopedia *Encyclopedia, router *httprouter.Router)
- func Size(size int) func(*Wikipedia) error
- func WikiTextToHTML(input string) string
- type Article
- func (*Article) Descriptor() ([]byte, []int)deprecated
- func (x *Article) GetID() uint64
- func (x *Article) GetText() string
- func (x *Article) GetTitle() string
- func (a *Article) HTML() string
- func (*Article) ProtoMessage()
- func (x *Article) ProtoReflect() protoreflect.Message
- func (x *Article) Reset()
- func (x *Article) String() string
- type Compressed
- type Encyclopedia
- func (e *Encyclopedia) Article(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (e *Encyclopedia) Lookup(title string) (article *Article)
- func (e *Encyclopedia) Search(query string) []Result
- func (e *Encyclopedia) WikiSearch(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- type Index
- type LRU
- type Node
- type Page
- type Result
- type Wikipedia
- func (t *Wikipedia) AST() *node32
- func (t *Wikipedia) Add(rule pegRule, begin, end, index uint32)
- func (p *Wikipedia) Init(options ...func(*Wikipedia) error) error
- func (p *Wikipedia) Parse(rule ...int) error
- func (t *Wikipedia) PrettyPrintSyntaxTree(buffer string)
- func (t *Wikipedia) Print()
- func (p *Wikipedia) PrintSyntaxTree()
- func (p *Wikipedia) Reset()
- func (p *Wikipedia) SprintSyntaxTree() string
- func (t *Wikipedia) Tokens() []token32
- func (t *Wikipedia) Trim(length uint32)
- func (p *Wikipedia) WriteSyntaxTree(w io.Writer)
Constants ¶
View Source
const EntryTemplate = `` /* 747-byte string literal not displayed */
EntryTemplate is a entry page
View Source
const IndexPage = `` /* 255-byte string literal not displayed */
IndexPage is the index page
View Source
const ResultsTemplate = `` /* 227-byte string literal not displayed */
ResultsTemplate is the template for search results
Variables ¶
View Source
var ( // WikiRegex is a regex for wiki syntax WikiRegex = regexp.MustCompile("[^A-Za-z]+") // NumCPU is the number of CPUs NumCPU = runtime.NumCPU() )
View Source
var File_wikipedia_proto protoreflect.FileDescriptor
Functions ¶
func Interface ¶
func Interface(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Interface outputs the search interface
func Server ¶
func Server(encyclopedia *Encyclopedia, router *httprouter.Router)
Server start server mode
func WikiTextToHTML ¶
WikiTextToHTML converts wikitext to html
Types ¶
type Article ¶
type Article struct { Title string `protobuf:"bytes,1,opt,name=Title,proto3" json:"Title,omitempty"` ID uint64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` Text string `protobuf:"bytes,3,opt,name=Text,proto3" json:"Text,omitempty"` // contains filtered or unexported fields }
func (*Article) Descriptor
deprecated
func (*Article) ProtoMessage ¶
func (*Article) ProtoMessage()
func (*Article) ProtoReflect ¶
func (x *Article) ProtoReflect() protoreflect.Message
type Compressed ¶
type Compressed struct { Size uint64 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*Compressed) Descriptor
deprecated
func (*Compressed) Descriptor() ([]byte, []int)
Deprecated: Use Compressed.ProtoReflect.Descriptor instead.
func (*Compressed) GetData ¶
func (x *Compressed) GetData() []byte
func (*Compressed) GetSize ¶
func (x *Compressed) GetSize() uint64
func (*Compressed) ProtoMessage ¶
func (*Compressed) ProtoMessage()
func (*Compressed) ProtoReflect ¶
func (x *Compressed) ProtoReflect() protoreflect.Message
func (*Compressed) Reset ¶
func (x *Compressed) Reset()
func (*Compressed) String ¶
func (x *Compressed) String() string
type Encyclopedia ¶
Encyclopedia is an encyclopedia
func (*Encyclopedia) Article ¶
func (e *Encyclopedia) Article(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Article is the endpoint for view an article
func (*Encyclopedia) Lookup ¶
func (e *Encyclopedia) Lookup(title string) (article *Article)
Lookup looks up an article
func (*Encyclopedia) Search ¶
func (e *Encyclopedia) Search(query string) []Result
Search search for a page
func (*Encyclopedia) WikiSearch ¶
func (e *Encyclopedia) WikiSearch(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
WikiSearch searches for articles
type Index ¶
type Index struct { Indexes []uint32 `protobuf:"varint,1,rep,packed,name=indexes,proto3" json:"indexes,omitempty"` // contains filtered or unexported fields }
func (*Index) Descriptor
deprecated
func (*Index) GetIndexes ¶
func (*Index) ProtoMessage ¶
func (*Index) ProtoMessage()
func (*Index) ProtoReflect ¶
func (x *Index) ProtoReflect() protoreflect.Message
type Page ¶
type Page struct { Title string `xml:"title"` ID uint64 `xml:"id"` Text string `xml:"revision>text"` }
Page is a wikitext page
type Wikipedia ¶
func (*Wikipedia) PrettyPrintSyntaxTree ¶
func (t *Wikipedia) PrettyPrintSyntaxTree(buffer string)
func (*Wikipedia) PrintSyntaxTree ¶
func (p *Wikipedia) PrintSyntaxTree()
func (*Wikipedia) SprintSyntaxTree ¶
func (*Wikipedia) WriteSyntaxTree ¶
Click to show internal directories.
Click to hide internal directories.