metadata

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 License: MIT Imports: 8 Imported by: 1

README

Publication metadata parser (YAML)

Go Reference

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MARCCodes = map[string]string{}/* 273 elements not displayed */

MARC Code List for Relators

https://www.loc.gov/marc/relators/relacode.html

View Source
var SchemeToOnix = map[string]string{
	"ISBN-10":              "02",
	"GTIN-13":              "03",
	"UPC":                  "04",
	"ISMN-10":              "05",
	"DOI":                  "06",
	"LCCN":                 "13",
	"GTIN-14":              "14",
	"ISBN-13":              "15",
	"Legal deposit number": "17",
	"URN":                  "22",
	"OCLC":                 "23",
	"ISMN-13":              "25",
	"ISBN-A":               "26",
	"JP":                   "27",
	"OLCC":                 "28",
}

Scheme to Onix CodeList 5 mapper. https://onix-codelists.io/codelist/5

Functions

This section is empty.

Types

type Author

type Author struct {
	Role   string `yaml:"role,omitempty"`
	Text   string `yaml:"text"`
	FileAs string `yaml:"file-as,omitempty"`
}

Author of publication.

func (Author) MARC

func (author Author) MARC() string

MarkCode return MARC Code string for Author Role.

func (*Author) UnmarshalYAML

func (author *Author) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implement yaml.Unmarshaler interface.

type Authors

type Authors []Author

Authors is a list of Author.

func (Authors) MarshalYAML

func (authors Authors) MarshalYAML() (interface{}, error)

MarshalYAML implement yaml.Marshaler interface.

func (*Authors) UnmarshalYAML

func (authors *Authors) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implement yaml.Unmarshaler interface.

type Date

type Date string

Date subscribe the publication date.

A string value in YYYY-MM-DD format. (Only the year is necessary.)

func (Date) MarshalYAML

func (date Date) MarshalYAML() (interface{}, error)

MarshalYAML implement yaml.Marshaler interface.

func (*Date) UnmarshalYAML

func (date *Date) UnmarshalYAML(value *yaml.Node) (err error)

UnmarshalYAML implement yaml.Unmarshaler interface.

type Identifier

type Identifier struct {
	Scheme string `yaml:",omitempty"`
	Text   string `yaml:"text"`
}

Identifier of publication.

Valid values for scheme are ISBN-10, GTIN-13, UPC, ISMN-10, DOI, LCCN, GTIN-14, ISBN-13, Legal deposit number, URN, OCLC, ISMN-13, ISBN-A, JP, OLCC.

func (Identifier) MarshalYAML

func (id Identifier) MarshalYAML() (interface{}, error)

MarshalYAML implement yaml.Marshaler interface.

func (Identifier) Onix

func (id Identifier) Onix() string

Onix return string with Onix CodeList 5: Product identifier type

func (*Identifier) UnmarshalYAML

func (id *Identifier) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implement yaml.Unmarshaler interface.

type Identifiers

type Identifiers []Identifier

Identifiers describe array of Identifier

func (Identifiers) MarshalYAML

func (ids Identifiers) MarshalYAML() (interface{}, error)

MarshalYAML implement yaml.Marshaler interface.

func (*Identifiers) UnmarshalYAML

func (ids *Identifiers) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implement yaml.Unmarshaler interface.

type Publication

type Publication struct {
	Identifier          Identifiers `yaml:"identifier"`
	Title               Titles      `yaml:"title"`
	Language            string      `yaml:"lang,omitempty"` // or legacy: language
	Date                Date        `yaml:"date,omitempty"`
	Creator             Authors     `yaml:"creator"`
	Contributor         Authors     `yaml:"contributor,omitempty"`
	Subject             Strings     `yaml:"subject,omitempty,flow"`
	Description         string      `yaml:"description,omitempty"`
	Type                string      `yaml:"type,omitempty"`
	Format              string      `yaml:"format,omitempty"`
	Publisher           string      `yaml:"publisher,omitempty"`
	Source              string      `yaml:"source,omitempty"`
	Relation            string      `yaml:"relation,omitempty"`
	Coverage            string      `yaml:"coverage,omitempty"`
	Rights              string      `yaml:"rights,omitempty"`
	BelongsToCollection string      `yaml:"belongs-to-collection,omitempty"` // identifies the name of a collection to which the EPUB Publication belongs.
	GroupPosition       string      `yaml:"group-position,omitempty"`        // indicates the numeric position in which the EPUB Publication belongs relative to other works belonging to the same belongs-to-collection field.
	CoverImage          string      `yaml:"cover-image,omitempty"`
	Stylesheets         []string    `yaml:"css,omitempty"` // or legacy: stylesheet
	// PageDirection
	IBooks *struct {
		Version        Version `yaml:"version,omitempty"`
		SpecifiedFonts bool    `yaml:"specified-fonts,omitempty"`
	} `yaml:"ibooks,omitempty"`
	Properties map[string]interface{} `yaml:",omitempty,inline"`
}

Publication metadata.

func Load

func Load(filename string) (*Publication, error)

Load return parsed publication metadata from file.

func Parse

func Parse(data []byte) (*Publication, error)

Parse return parsed publication metadata.

func (Publication) EPUB

func (p Publication) EPUB() (meta epub.Metadata)

EPUB return converted to EPUB3 Metadata data.

type Strings

type Strings []string

Strings list of string.

func (Strings) MarshalYAML

func (s Strings) MarshalYAML() (interface{}, error)

MarshalYAML implement yaml.Marshaler interface.

func (*Strings) UnmarshalYAML

func (s *Strings) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implement yaml.Unmarshaler interface.

type Title

type Title struct {
	Type   string `yaml:",omitempty"`
	Text   string `yaml:"text"`
	FileAs string `yaml:"file-as,omitempty"`
}

Title of publication.

Valid values for type are main, subtitle, short, collection, edition, extended.

func (*Title) UnmarshalYAML

func (title *Title) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implement yaml.Unmarshaler interface.

type Titles

type Titles []Title

Titles is a lis of Title.

func (Titles) Main

func (titles Titles) Main() string

Main return first main title.

func (Titles) MarshalYAML

func (titles Titles) MarshalYAML() (interface{}, error)

MarshalYAML implement yaml.Marshaler interface.

func (Titles) Subtitle

func (titles Titles) Subtitle() string

Subtitle return first subtitle.

func (*Titles) UnmarshalYAML

func (titles *Titles) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implement yaml.Unmarshaler interface.

type Version

type Version string

Version subscribe the publication version string.

func (Version) MarshalYAML

func (ver Version) MarshalYAML() (interface{}, error)

MarshalYAML implement yaml.Marshaler interface.

func (*Version) UnmarshalYAML

func (ver *Version) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implement yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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