diff options
| author | Fuwn <[email protected]> | 2024-06-23 06:57:07 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-06-23 06:57:07 +0000 |
| commit | 74f1bfd0c1971ede4a8db3276f918dcbb0543acf (patch) | |
| tree | ccf713e5d698d612a1e26e0966bcf576f82f9a03 /src/gemtext/blockquote.gleam | |
| download | momoka-74f1bfd0c1971ede4a8db3276f918dcbb0543acf.tar.xz momoka-74f1bfd0c1971ede4a8db3276f918dcbb0543acf.zip | |
feat: initial releasev1.0.0
Diffstat (limited to 'src/gemtext/blockquote.gleam')
| -rw-r--r-- | src/gemtext/blockquote.gleam | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gemtext/blockquote.gleam b/src/gemtext/blockquote.gleam new file mode 100644 index 0000000..94aa937 --- /dev/null +++ b/src/gemtext/blockquote.gleam @@ -0,0 +1,20 @@ +import gemtext/gemtext.{type Gemtext} +import gleam/list +import gleam/string + +pub fn combine_adjacent_blockquote_lines(lines: List(Gemtext)) -> List(Gemtext) { + case lines { + [gemtext.BlockquoteLine(a), gemtext.BlockquoteLine(b), ..rest] -> + combine_adjacent_blockquote_lines([ + gemtext.Blockquote(string.join([a, b], "\n")), + ..rest + ]) + [gemtext.Blockquote(a), gemtext.BlockquoteLine(b), ..rest] -> + combine_adjacent_blockquote_lines([ + gemtext.Blockquote(string.join([a, b], "\n")), + ..rest + ]) + [g, ..rest] -> list.append([g], combine_adjacent_blockquote_lines(rest)) + [] -> [] + } +} |