@use jp_utils::furi::segment::SegmentRef;
@use jp_utils::furi::segment::AsSegment;
@* TODO Figure out how to use Iterator instead of Vec for this template. *@
@type MyVec<'a> = Vec<SegmentRef<'a>>;
@(iter: MyVec, addl_classes: &str, show_furigana: bool)

<div class="furigana-kanji-container">@*
*@@for furi_part in iter {@*
    *@@for r in furi_part.reading_iter() {@*
      *@@if !furi_part.is_empty() {@*
              *@@if furi_part.is_kanji() {@*
                  *@<ruby>@*
                      *@<span class="kanji-preview @addl_classes">@*
                          *@@r.kanji().unwrap()@*
                      *@</span>@*
                      *@@if show_furigana {@*
                        *@<rp>（</rp>@*
                        *@<rt class="furigana-preview noselect @addl_classes">@*
                            *@@r.kana()@*
                        *@</rt>@*
                        *@<rp>）</rp>@*
                      *@}@*
                  *@</ruby>@*
              *@} else {@*
                  *@<span class="inline-kana-preview @addl_classes">@*
                      *@@r.kanji().unwrap_or_else(|| r.kana())@*
                  *@</span>@*
              *@}@*
      *@}@*
    *@}@*
*@}@*
*@</div>
