Skip to main content

src/proute@generate@text.erl

-module(proute@generate@text).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/proute/generate/text.gleam").
-export([doc_lines/1, indent_multiline/2, indent_lines/1]).

-file("src/proute/generate/text.gleam", 4).
-spec doc_lines(list(binary())) -> binary().
doc_lines(Lines) ->
    _pipe = Lines,
    _pipe@1 = gleam@list:map(
        _pipe,
        fun(Line) -> <<"/// "/utf8, Line/binary>> end
    ),
    _pipe@2 = gleam@string:join(_pipe@1, <<"\n"/utf8>>),
    (fun(Text) -> <<Text/binary, "\n"/utf8>> end)(_pipe@2).

-file("src/proute/generate/text.gleam", 15).
-spec indent_multiline(binary(), integer()) -> binary().
indent_multiline(Text, Spaces) ->
    Prefix = gleam@string:repeat(<<" "/utf8>>, Spaces),
    _pipe = Text,
    _pipe@1 = gleam@string:split(_pipe, <<"\n"/utf8>>),
    _pipe@2 = gleam@list:map(
        _pipe@1,
        fun(Line) -> <<Prefix/binary, Line/binary>> end
    ),
    gleam@string:join(_pipe@2, <<"\n"/utf8>>).

-file("src/proute/generate/text.gleam", 11).
-spec indent_lines(binary()) -> binary().
indent_lines(Text) ->
    indent_multiline(Text, 2).