Docxir.SpanMerger (docxir v0.1.0)
View SourceMerges adjacent HTML inline-block div elements with identical CSS classes.
This optimization reduces the output HTML size by combining consecutive inline-block div elements that have the same class attribute.
Note: Uses inline-block divs instead of spans to allow nesting of block elements and provide better control over dimensions and spacing.
Summary
Functions
Merges adjacent inline-block divs with the same CSS class in a list of HTML fragments.
Functions
Merges adjacent inline-block divs with the same CSS class in a list of HTML fragments.
Parameters
items- List of HTML fragments as strings
Returns
- String with merged adjacent inline-block divs
Examples
iex> items = [
...> ~s(<div class="inline-block text-xs">Hello</div>),
...> ~s(<div class="inline-block text-xs"> World</div>),
...> ~s(<div class="inline-block font-bold">!</div>)
...> ]
iex> Docxir.SpanMerger.merge(items)
~s(<div class="inline-block text-xs">Hello World</div><div class="inline-block font-bold">!</div>)