Documentation
¶
Overview ¶
Package csl converts citation-style language (CSL) metadata to/from the commonmeta metadata format.
Index ¶
- Variables
- func Load(filename string) (commonmeta.Data, error)
- func LoadAll(filename string) ([]commonmeta.Data, error)
- func Read(content Content) (commonmeta.Data, error)
- func ReadAll(content []Content) ([]commonmeta.Data, error)
- func Write(data commonmeta.Data) ([]byte, error)
- func WriteAll(list []commonmeta.Data) ([]byte, error)
- type Author
- type CSL
- type Content
- type Publisher
Constants ¶
This section is empty.
Variables ¶
View Source
var CMToCSLMappings = map[string]string{
"Article": "article",
"JournalArticle": "article-journal",
"BlogPost": "post-weblog",
"Book": "book",
"BookChapter": "chapter",
"Collection": "collection",
"Dataset": "dataset",
"Document": "document",
"Entry": "entry",
"Event": "event",
"Figure": "figure",
"Image": "graphic",
"LegalDocument": "legal_case",
"Manuscript": "manuscript",
"Map": "map",
"Audiovisual": "motion_picture",
"Patent": "patent",
"Performance": "performance",
"Journal": "periodical",
"PersonalCommunication": "personal_communication",
"Report": "report",
"Review": "review",
"Software": "software",
"Presentation": "speech",
"Standard": "standard",
"Dissertation": "thesis",
"WebPage": "webpage",
}
View Source
var CSLToCMMappings = map[string]string{
"article": "Article",
"article-journal": "JournalArticle",
"article-magazine": "Article",
"article-newspaper": "Article",
"bill": "LegalDocument",
"book": "Book",
"broadcast": "Audiovisual",
"chapter": "BookChapter",
"classic": "Book",
"collection": "Collection",
"dataset": "Dataset",
"document": "Document",
"entry": "Entry",
"entry-dictionary": "Entry",
"entry-encyclopedia": "Entry",
"event": "Event",
"figure": "Figure",
"graphic": "Image",
"hearing": "LegalDocument",
"interview": "Document",
"legal_case": "LegalDocument",
"legislation": "LegalDocument",
"manuscript": "Manuscript",
"map": "Map",
"motion_picture": "Audiovisual",
"musical_score": "Document",
"pamphlet": "Document",
"paper-conference": "ProceedingsArticle",
"patent": "Patent",
"performance": "Performance",
"periodical": "Journal",
"personal_communication": "PersonalCommunication",
"post": "Post",
"post-weblog": "BlogPost",
"regulation": "LegalDocument",
"report": "Report",
"review": "Review",
"review-book": "Review",
"software": "Software",
"song": "Audiovisual",
"speech": "Presentation",
"standard": "Standard",
"thesis": "Dissertation",
"treaty": "LegalDocument",
"webpage": "WebPage",
}
source: https://docs.citationstyles.org/en/stable/specification.html?highlight=book#appendix-iii-types
Functions ¶
func Load ¶ added in v0.6.6
func Load(filename string) (commonmeta.Data, error)
Load loads the metadata for a single work from a CSL file
func LoadAll ¶ added in v0.6.6
func LoadAll(filename string) ([]commonmeta.Data, error)
LoadAll loads the metadata for a list of works from a CSL file and converts it to the Commonmeta format
func Read ¶ added in v0.2.1
func Read(content Content) (commonmeta.Data, error)
Read reads CSL metadata and converts it into Commonmeta metadata.
func ReadAll ¶ added in v0.6.6
func ReadAll(content []Content) ([]commonmeta.Data, error)
ReadAll reads a list of CSL metadata and returns a list of works in Commonmeta format
Types ¶
type Author ¶ added in v0.2.4
type Author struct {
Family string `json:"family,omitempty"`
Given string `json:"given,omitempty"`
NonDroppingParticle string `json:"non-dropping-particle,omitempty"`
Literal string `json:"literal,omitempty"`
}
Authors represents the author in the CSL item.
type CSL ¶ added in v0.2.4
type CSL struct {
ID string `json:"id"`
Type string `json:"type"`
Abstract string `json:"abstract,omitempty"`
Accessed struct {
DateAsParts []dateutils.DateSlice `json:"date-parts"`
DateTime string `json:"date-time"`
} `json:"accessed"`
Author []Author `json:"author,omitempty"`
Categories []string `json:"categories,omitempty"`
ContainerTitle string `json:"container-title,omitempty"`
ContainerTitleShort string `json:"container-title-short,omitempty"`
DOI string `json:"DOI,omitempty"`
Editor []Author `json:"editor,omitempty"`
ISSN string `json:"ISSN,omitempty"`
Issue string `json:"issue,omitempty"`
Issued struct {
DateAsParts []dateutils.DateSlice `json:"date-parts"`
DateTime string `json:"date-time"`
} `json:"issued"`
Keyword string `json:"keyword,omitempty"`
Language string `json:"language,omitempty"`
License string `json:"license,omitempty"`
Note string `json:"note,omitempty"`
Page string `json:"page,omitempty"`
PMID string `json:"PMID,omitempty"`
Publisher string `json:"publisher,omitempty"`
Source string `json:"source,omitempty"`
Submitted struct {
DateAsParts []dateutils.DateSlice `json:"date-parts"`
DateTime string `json:"date-time"`
} `json:"submitted"`
Title string `json:"title,omitempty"`
URL string `json:"URL,omitempty"`
Version string `json:"version,omitempty"`
Volume string `json:"volume,omitempty"`
}
CSL represents the CSL metadata.
type Content ¶
type Content struct {
*CSL
Publisher json.RawMessage `json:"publisher"`
}
Click to show internal directories.
Click to hide internal directories.