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:ff0d349bf60ffca91c8c2e98ed6afaf6e4fa7c9f3bac7a099090243e2040a80c
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
# Issues & docs: https://github.com/kreuzberg-dev/alef
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: map(),
headers: [map()],
links: [map()],
images: [map()],
structured_data: [map()]
}
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