citation

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: GPL-2.0, GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportBibtex

func ExportBibtex(citations []Citation)

exports all citations to bibtex

func ExportJson

func ExportJson(citations []Citation)

exports citations to short json

func GetEntryType added in v0.0.4

func GetEntryType(resourceType string) string

converts various resource types to a bibtex entry type https://www.bibtex.com/e/entry-types/ https://github.com/papis/papis/blob/master/papis/crossref.py

Types

type Citation

type Citation struct {
	Address      string // address
	Author       []CitationAuthor
	Booktitle    string // booktitle
	Chapter      string // chapter
	Citekey      string // citekey (generated)
	Doi          string // doi
	Editor       []CitationAuthor
	File         string // appended file
	Howpublished string // how published
	Institution  string // institution
	Id           int    // database id (generated)
	Isbn         string // isbn
	Issn         string // issn
	Journal      string // journal name
	Number       string // issue number
	Organization string // organization
	Pages        string // pages
	Publisher    string // publisher
	ResourceType string // needs to be converted to bibtex entry type
	Series       string // series
	School       string // school
	Title        string // title
	Url          string // doi url
	UrlDate      string // access date (generated)
	Volume       string // volume
	Year         string // year
}

the organized form of a citation

func ParseFromBibtex

func ParseFromBibtex(bibtex string) []Citation

tries to parse a bibtex string to []Citation assumes a reasonably well formatted bibtex file https://www.bibtex.com/g/bibtex-format/

func (*Citation) CopyFile

func (self *Citation) CopyFile(file string) string

copies source file to the bibliography folder and returns new name

func (*Citation) GetAuthorCitekey

func (self *Citation) GetAuthorCitekey() string

returns author abbreviation for citekey

func (*Citation) GetAuthorTui

func (self *Citation) GetAuthorTui() string

returns short author string for TUI either:

family name (if one author),
family and family (2 authors),
family et al. (more authors)

func (*Citation) GetAuthorsSql

func (self *Citation) GetAuthorsSql(citAuthors []CitationAuthor) string

returns authors as delimited string for the sql database

func (*Citation) GetCiteKey

func (self *Citation) GetCiteKey() string

returns citekey

func (*Citation) GetTitle

func (self *Citation) GetTitle() string

returns abbreviated title

func (*Citation) GetYear

func (self *Citation) GetYear() string

returns publication year

func (Citation) Print

func (self Citation) Print()

prints citation summary

type CitationAuthor

type CitationAuthor struct {
	Family string `json:"family"`
	Given  string `json:"given"`
}

an author's family and given name

func ParseAuthorsSql

func ParseAuthorsSql(authors string) []CitationAuthor

parses authors delimited string to []CitationAuthor

type CitationShort

type CitationShort struct {
	Authors string
	Title   string
	Year    string
	Citekey string
}

'short' citations for json export

Jump to

Keyboard shortcuts

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