How to read text into a dictionary

I have some data like:



---
title1
line1
line2
---
title2
line1
line2

and i want a structure of :

%{title1: [title1/line1, title1/line2], title2: [title2/line1, title2/line2}

Here is my code, but i cannot get the dict:

defmodule Index do
    @spliter "---"
    def build_custom_index(index_path) do
        {:ok, contents} = File.read(index_path)
        contents \
        |> String.split(@spliter, trim: true)
        |> Stream.map( &(String.split(&1, "\n", trim: true)) )
        |> Stream.filter( &(Enum.count(&1) > 0) )
        |> Enum.each( fn group -> 
            [head | tail] = group
            tail \
            |> Enum.each( fn line -> 
                new_line = head <> "/" <> line
            end)
        end)
    end
end

This is actually my first Elixir program, I have searched several materials but still in trouble.

I have used Python before.

Would anyone help… many thanks.