Skip to content

Commit 607d66e

Browse files
authored
Normalize newline characters and update doc syntax
1 parent 20c7c37 commit 607d66e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/elixir/lib/io.ex

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ defmodule IO do
131131
defguardp is_device(term) when is_atom(term) or is_pid(term)
132132
defguardp is_iodata(data) when is_list(data) or is_binary(data)
133133

134-
@doc """
134+
@doc ~S"""
135135
Reads from the IO `device`.
136136
137137
The `device` is iterated as specified by the `line_or_chars` argument:
@@ -141,7 +141,7 @@ defmodule IO do
141141
non-textual inputs.
142142
143143
* if `line_or_chars` is `:line`, the device is iterated line by line.
144-
CRLF newlines ("\\r\\n") are automatically normalized to "\\n".
144+
CRLF newlines ("\r\n") are automatically normalized to "\n".
145145
146146
* if `line_or_chars` is `:eof` (since v1.13), the device is iterated until `:eof`.
147147
If the device is already at the end, it returns `:eof` itself.
@@ -186,7 +186,7 @@ defmodule IO do
186186
:io.get_chars(map_dev(device), ~c"", count)
187187
end
188188

189-
@doc """
189+
@doc ~S"""
190190
Reads from the IO `device`. The operation is Unicode unsafe.
191191
192192
The `device` is iterated as specified by the `line_or_chars` argument:
@@ -196,7 +196,7 @@ defmodule IO do
196196
non-textual inputs.
197197
198198
* if `line_or_chars` is `:line`, the device is iterated line by line.
199-
CRLF newlines ("\\r\\n") are automatically normalized to "\\n".
199+
CRLF newlines ("\r\n") are automatically normalized to "\n".
200200
201201
* if `line_or_chars` is `:eof` (since v1.13), the device is iterated until `:eof`.
202202
If the device is already at the end, it returns `:eof` itself.
@@ -603,7 +603,7 @@ defmodule IO do
603603
@spec stream() :: Enumerable.t(String.t())
604604
def stream, do: stream(:stdio, :line)
605605

606-
@doc """
606+
@doc ~S"""
607607
Converts the IO `device` into an `IO.Stream`.
608608
609609
An `IO.Stream` implements both `Enumerable` and
@@ -612,7 +612,7 @@ defmodule IO do
612612
613613
The `device` is iterated by the given number of characters
614614
or line by line if `:line` is given. In case `:line` is given,
615-
"\\r\\n" is automatically normalized to "\n".
615+
"\r\n" is automatically normalized to "\n".
616616
617617
This reads from the IO as UTF-8. Check out
618618
`IO.binstream/2` to handle the IO as a raw binary.
@@ -632,11 +632,11 @@ defmodule IO do
632632
633633
Another example where you might want to collect a user input
634634
every new line and break on an empty line, followed by removing
635-
redundant new line characters (`"\\n"`):
635+
redundant new line characters (`"\n"`):
636636
637637
IO.stream(:stdio, :line)
638-
|> Enum.take_while(&(&1 != "\\n"))
639-
|> Enum.map(&String.replace(&1, "\\n", ""))
638+
|> Enum.take_while(&(&1 != "\n"))
639+
|> Enum.map(&String.replace(&1, "\n", ""))
640640
641641
"""
642642
@spec stream(device, :line | pos_integer) :: Enumerable.t()
@@ -658,16 +658,16 @@ defmodule IO do
658658
@spec binstream() :: Enumerable.t(binary)
659659
def binstream, do: binstream(:stdio, :line)
660660

661-
@doc """
661+
@doc ~S"""
662662
Converts the IO `device` into an `IO.Stream`. The operation is Unicode unsafe.
663663
664664
An `IO.Stream` implements both `Enumerable` and
665665
`Collectable`, allowing it to be used for both read
666666
and write.
667667
668668
The `device` is iterated by the given number of bytes or line
669-
by line if `:line` is given. In case `:line` is given, "\\r\\n"
670-
is automatically normalized to "\\n". Passing the number of bytes
669+
by line if `:line` is given. In case `:line` is given, "\r\n"
670+
is automatically normalized to "\n". Passing the number of bytes
671671
should be the preferred mode for reading non-textual inputs.
672672
673673
Note that an IO stream has side effects and every time

0 commit comments

Comments
 (0)