pub struct DocumentMetadata {Show 18 fields
pub title: Option<String>,
pub authors: Vec<String>,
pub subject: Option<String>,
pub description: Option<String>,
pub keywords: Vec<String>,
pub language: Option<String>,
pub publisher: Option<String>,
pub identifier: Option<String>,
pub rights: Option<String>,
pub date: Option<String>,
pub created: Option<String>,
pub modified: Option<String>,
pub last_modified_by: Option<String>,
pub creator_tool: Option<String>,
pub properties: BTreeMap<String, String>,
pub gps: Option<GpsPosition>,
pub exif: BTreeMap<String, String>,
pub audio: BTreeMap<String, String>,
}Expand description
The metadata of a document. Every field is optional; a document whose
file carries nothing has the default, is_empty.
Dates are kept as the file wrote them, normalized to ISO 8601 where the
format defines one (Office and ODF dcterms dates, a PDF’s D: dates);
EXIF’s own YYYY:MM:DD HH:MM:SS stays as it is in exif and is turned
into ISO 8601 for date.
Fields§
§title: Option<String>§subject: Option<String>§description: Option<String>§keywords: Vec<String>§language: Option<String>§publisher: Option<String>§identifier: Option<String>§rights: Option<String>§date: Option<String>The document’s own date: an EPUB’s dc:date, a photo’s
DateTimeOriginal, an audio file’s date.
created: Option<String>§modified: Option<String>§last_modified_by: Option<String>§creator_tool: Option<String>The application that wrote the file (Office’s Application, ODF’s
meta:generator, EXIF’s Software, a PDF’s Producer).
properties: BTreeMap<String, String>The source’s other named properties, by a lower-case name
(revision, category, content_status, company, pages,
words, image_size, …).
gps: Option<GpsPosition>§exif: BTreeMap<String, String>EXIF tags by their exiftool name, each value as it displays
(Make, Model, DateTimeOriginal, ExposureTime, GPSLatitude,
…); binary tags (MakerNote, the thumbnail) are left out.
audio: BTreeMap<String, String>An audio file’s tags and stream facts by a lower-case name
(title, artist, album, genre, track, date, duration,
sample_rate, channels, codec, …).
Implementations§
Source§impl DocumentMetadata
impl DocumentMetadata
pub fn is_empty(&self) -> bool
Sourcepub fn to_json(&self) -> Value
pub fn to_json(&self) -> Value
The JSON object the docling JSON export carries as metadata
(empty fields left out).
Sourcepub fn from_json(value: &Value) -> Self
pub fn from_json(value: &Value) -> Self
Read back what to_json wrote (unknown keys are
ignored, missing ones default).
Sourcepub fn to_front_matter(&self) -> String
pub fn to_front_matter(&self) -> String
The YAML front matter block — ---, one line per present field in
a fixed order, --- — or an empty string for empty metadata.
Scalars print plain when YAML would read them back as the same
string (authors: [Test Author]) and double-quoted otherwise (a
date, a number, a colon, a leading symbol), so a front-matter parser
gets the strings the file held.