NLdoc.Conversion.Reader.Docx.Files.CoreProperties (NLdoc.Conversion.Reader.Docx v1.1.2)

View Source

This module parses the core properties (docProps/core.xml) file in a Docx document into a simple key-value map.

Summary

Functions

Converts a map of core properties into NLdoc spec descriptors to be set as metadata on the root document.

Parses the contents of a Docx core properties (docProps/core.xml) file into a key-value map of all the properties.

Reads a (list of) Docx core properties file(s) at the given path(s) and parses it/them into a key-value map of all the properties.

Types

t()

@type t() :: %{required(String.t()) => String.t()}

Functions

convert(props)

@spec convert(t()) :: [NLdoc.Spec.descriptor()]

Converts a map of core properties into NLdoc spec descriptors to be set as metadata on the root document.

parse(arg1)

@spec parse(Saxy.XML.element() | [Saxy.XML.element()]) :: t()

Parses the contents of a Docx core properties (docProps/core.xml) file into a key-value map of all the properties.

Examples

iex> NLdoc.Conversion.Reader.Docx.Files.CoreProperties.parse(
...>   {"cp:coreProperties", [], [
...>     {"dc:title", [], ["Jesus He Knows Me"]},
...>     {"dc:creator", [], ["Genesis"]},
...>     {"cp:keywords", [], ["song, music, satire, televangelists, religious hypocrisy, pop-rock, social commentary"]},
...>     {"dc:description", [], ["Satirical song that mocks televangelists and religious hypocrisy, blending upbeat, catchy pop-rock with biting social commentary."]},
...>     {"cp:lastModifiedBy", [], ["Phil Collins"]},
...>     {"cp:revision", [], ["42"]},
...>     {"dcterms:created", [{"xsi:type", "dcterms:W3CDTF"}], ["1991-03-15T07:56:00Z"]},
...>     {"dcterms:modified", [{"xsi:type", "dcterms:W3CDTF"}], ["1991-07-10T01:23:01Z"]}
...>   ]}
...> )
%{
  "dc:title" => "Jesus He Knows Me",
  "dc:creator" => "Genesis",
  "cp:keywords" => "song, music, satire, televangelists, religious hypocrisy, pop-rock, social commentary",
  "dc:description" => "Satirical song that mocks televangelists and religious hypocrisy, blending upbeat, catchy pop-rock with biting social commentary.",
  "cp:lastModifiedBy" => "Phil Collins",
  "cp:revision" => "42",
  "dcterms:created" => "1991-03-15T07:56:00Z",
  "dcterms:modified" => "1991-07-10T01:23:01Z"
}

read!(filepath)

@spec read!(filepath :: String.t()) :: t()
@spec read!(filepaths :: [String.t()]) :: t()

Reads a (list of) Docx core properties file(s) at the given path(s) and parses it/them into a key-value map of all the properties.