-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
Most code examples in the documentation follow this pattern:
1> do_something().
{ok, some_result}
2> do_something_else().
{ok, other_result}That is, prompt+input followed by output.
When using the copy button on such code examples, what gets copied to the clipboard is garbage, give or take.
The prompts are removed from the input lines, which is fine.
The results are not removed, and moreover, the following input line is placed directly after it, on the same line.
Even if the results were to be left out from the examples, the following inputs are placed directly after the previous one. Since that way, there is no whitespace after the . finishing the previous input line, this is a syntax error.
(Note: Don't be confused by the copy button on my example above. This one is put there by GitHub.)
To Reproduce
Taking code examples from ets:select_reverse/1 for illustration.
This is what is shown in the document:
1> T = ets:new(x,[ordered_set]).
2> [ ets:insert(T,{N}) || N <- lists:seq(1,10) ].
...
3> {R0,C0} = ets:select_reverse(T,[{'_',[],['$_']}],4).
...
4> R0.
[{10},{9},{8},{7}]
5> {R1,C1} = ets:select_reverse(C0).
...
6> R1.
[{6},{5},{4},{3}]
7> {R2,C2} = ets:select_reverse(C1).
...
8> R2.
[{2},{1}]
9> '$end_of_table' = ets:select_reverse(C2).
...... and this is what ends up on the clipboard when the copy button is used:
T = ets:new(x,[ordered_set]).[ ets:insert(T,{N}) || N <- lists:seq(1,10) ].
...{R0,C0} = ets:select_reverse(T,[{'_',[],['$_']}],4).
...R0.
[{10},{9},{8},{7}]{R1,C1} = ets:select_reverse(C0).
...R1.
[{6},{5},{4},{3}]{R2,C2} = ets:select_reverse(C1).
...R2.
[{2},{1}]'$end_of_table' = ets:select_reverse(C2).
...Expected behavior
The copy button should produce code that can be directly pasted into the shell. Otherwise, if that can't be done, remove the copy button since it is useless.
Affected versions
All that use the new documentation system (?)