wikipedia

package
v0.0.0-...-2e1bc12 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WikipediaURL

func WikipediaURL(pageId int, pageTitle string) string

Wikipedia generates the Wikipedia URL from the page ID and title.

Types

type Infobox

type Infobox struct {
	Name       string
	Attributes map[string]any
}

func NewInfobox

func NewInfobox(name string) *Infobox

type Manager

type Manager struct {
	// Override in tests to use a mock server
	BaseURL string
}

Manager provides reference management using Wikipedia API.

func NewManager

func NewManager() *Manager

func (*Manager) Ready

func (m *Manager) Ready() (bool, error)

func (*Manager) Search

func (m *Manager) Search(query string) ([]reference.Result, error)

type Parse

type Parse struct {
	Title  string      `json:"title"`
	PageID int         `json:"pageid"`
	Text   interface{} `json:"wikitext"`
}

func (Parse) RawText

func (p Parse) RawText() string

type ParseResponse

type ParseResponse struct {
	Parse Parse `json:"parse"`
}

type Query

type Query struct {
	Results []QueryResult `json:"search"`
}

type QueryResponse

type QueryResponse struct {
	Query Query `json:"query"`
}

type QueryResult

type QueryResult struct {
	Title  string `json:"title"`
	PageID int    `json:"pageid"`
}

type Result

type Result struct {
	PageID    int
	PageTitle string
	URL       string
	// contains filtered or unexported fields
}

func (*Result) Attributes

func (r *Result) Attributes() map[string]any

func (*Result) Description

func (r *Result) Description() string

Jump to

Keyboard shortcuts

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