epub-metadata-4.3: Library for parsing epub document metadata

Safe HaskellSafe-Inferred
LanguageHaskell98

Codec.Epub.Data.Metadata

Description

Data types for working with the metadata of epub documents

This module defines the Metadata structure which contains most of the taxonomic information about the literary work. Metadata is probably the most important data structure in this library.

Both commonly-used versions of epub (2.x and 3.x) are supported by these types.

Synopsis

Documentation

data Metadata Source

package/metadata tag

This is perhaps the most useful data structure in this library. It contains most of the information tools will want to use to organize epub documents.

Constructors

Metadata 

Fields

metaIds :: [Identifier]

at least one required

metaTitles :: [Title]

at least one required

metaLangs :: [String]

dc:language tags, at least one required

metaContributors :: [Creator]
 
metaCreators :: [Creator]
 
metaDates :: [Date]
 
metaModified :: Maybe String

meta tag with property dcterms:modified, present only in epub3 documents

metaSource :: Maybe String

dc:source tags

metaType :: Maybe String

dc:type tags

metaCoverages :: [String]

dc:coverage tags

metaDescriptions :: [Description]
 
metaFormats :: [String]

dc:format tags

metaPublishers :: [String]

dc:publisher tags

metaRelations :: [String]

dc:relation tags

metaRights :: [String]

dc:rights tags

metaSubjects :: [String]

dc:subject tags

data Identifier Source

package/metadata/dc:identifier tag

Constructors

Identifier 

Fields

idId :: Maybe String

id attribute

idType :: Maybe String

identifier-type property from meta tag

idScheme :: Maybe String

scheme from attribute or meta tag

idText :: String

identifier tag text

data Title Source

package/metadata/dc:title tag

Constructors

Title 

Fields

titleLang :: Maybe String

lang attribute

titleType :: Maybe String

title-type property from meta tag

titleSeq :: Maybe Int

display-sequence property from meta

titleText :: String

title tag text

Instances

data Creator Source

package/metadata/dc:creator or package/metadata/dc:contributor tags

This structure is used for both contributor and creator as they are exactly the same.

Constructors

Creator 

Fields

creatorRole :: Maybe String

role from attribute or meta tag

creatorFileAs :: Maybe String

file-as from attribute or meta tag

creatorSeq :: Maybe Int

display-sequence property from meta

creatorText :: String

creator or contributor tag text

Instances

data Date Source

package/metadata/dc:date tag, opf:event attribute, text

Constructors

Date (Maybe String) String 

Instances

data Description Source

package/metadata/dc:description tag, xml:lang attribute, text

Constructors

Description (Maybe String) String 

data Refinement Source

Refinements represent meta tags within the metadata section that refine other tags. These are used during the parsing phase and are discarded as their information is slotted into the data they refine (CreatorS, TitleS, IdentifierS, etc..)

This is specific to epub3

Constructors

Refinement 

Fields

refId :: String

id attribute

refProp :: String

property attribute

refScheme :: String

scheme attribute

refText :: String

meta tag text

emptyMetadata :: Metadata Source

Note: This isn't valid as-is, some required values are empty lists!

refineIdentifier :: [Refinement] -> Identifier -> Identifier Source

Used internally by Codec.Epub.Parse.Metadata to merge epub3 meta tag info into the data gathered from an identifier tag

refineTitle :: [Refinement] -> (String, Title) -> Title Source

Used internally by Codec.Epub.Parse.Metadata to merge epub3 meta tag info into the data gathered from a title tag

getModified :: [Refinement] -> Maybe String Source

Used internally by Codec.Epub.Parse.Metadata to populate the metadata modified field with data extracted from the epub3 meta tag with property dcterms:modified

refineCreator :: [Refinement] -> (String, Creator) -> Creator Source

Used internally by Codec.Epub.Parse.Metadata to merge epub3 meta tag info into the data gathered from contributor and creator tags