Current section

Files

Jump to
html_to_markdown lib html_to_markdown html_metadata.ex
Raw

lib/html_to_markdown/html_metadata.ex

# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:22cbc7728e7527feef8e06cb67ad8290c07e3c276a312d04d887bbecdf8f6101
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule HtmlToMarkdown.HtmlMetadata do
@moduledoc """
Comprehensive metadata extraction result from HTML document.
Contains all extracted metadata types in a single structure,
suitable for serialization and transmission across language boundaries.
# Examples
```
let metadata = HtmlMetadata {
document: Default::default(),
headers: Vec::new(),
links: Vec::new(),
images: Vec::new(),
structured_data: Vec::new(),
};
assert!(metadata.headers.is_empty());
```
"""
@typedoc "Comprehensive metadata extraction result from HTML document."
@type t :: %__MODULE__{
document: HtmlToMarkdown.DocumentMetadata.t(),
headers: [HtmlToMarkdown.HeaderMetadata.t()],
links: [HtmlToMarkdown.LinkMetadata.t()],
images: [HtmlToMarkdown.ImageMetadata.t()],
structured_data: [HtmlToMarkdown.StructuredData.t()]
}
defstruct document: nil,
headers: [],
links: [],
images: [],
structured_data: []
defimpl Jason.Encoder do
@doc false
def encode(value, opts) do
value
|> Map.from_struct()
|> Enum.reject(fn {_k, v} -> v == nil end)
|> Enum.into(%{})
|> Jason.Encoder.encode(opts)
end
end
end