1
1
defmodule IO.ANSI.Docs do
2
2
@ moduledoc false
3
3
4
- @ bullet_text "• "
4
+ @ bullet_text_unicode "• "
5
+ @ bullet_text_ascii "* "
5
6
@ bullets [ ?* , ?- , ?+ ]
6
7
@ spaces [ " " , "\n " , "\t " ]
7
8
@@ -219,7 +220,10 @@ defmodule IO.ANSI.Docs do
219
220
end
220
221
221
222
defp traverse_erlang_html ( { :dt , _ , entries } , indent , options ) do
222
- [ "#{ indent } " , @ bullet_text | handle_erlang_html_text ( entries , indent <> " " , options ) ]
223
+ [
224
+ "#{ indent } " ,
225
+ bullet_text ( options ) | handle_erlang_html_text ( entries , indent <> " " , options )
226
+ ]
223
227
end
224
228
225
229
defp traverse_erlang_html ( { :dd , _ , entries } , indent , options ) do
@@ -240,7 +244,10 @@ defmodule IO.ANSI.Docs do
240
244
end
241
245
else
242
246
for { :li , _ , lines } <- entries do
243
- [ "#{ indent } " , @ bullet_text | handle_erlang_html_text ( lines , indent <> " " , options ) ]
247
+ [
248
+ "#{ indent } " ,
249
+ bullet_text ( options ) | handle_erlang_html_text ( lines , indent <> " " , options )
250
+ ]
244
251
end
245
252
end
246
253
end
@@ -424,7 +431,7 @@ defmodule IO.ANSI.Docs do
424
431
case stripped do
425
432
<< bullet , ?\s , item :: binary >> when bullet in @ bullets ->
426
433
write_text ( text , indent , options )
427
- process_list ( @ bullet_text , item , rest , count , indent , options )
434
+ process_list ( bullet_text ( options ) , item , rest , count , indent , options )
428
435
429
436
<< d1 , ?. , ?\s , item :: binary >> when d1 in ?0 .. ?9 ->
430
437
write_text ( text , indent , options )
@@ -930,6 +937,10 @@ defmodule IO.ANSI.Docs do
930
937
end
931
938
end
932
939
940
+ defp bullet_text ( options ) do
941
+ if options [ :enabled ] , do: @ bullet_text_unicode , else: @ bullet_text_ascii
942
+ end
943
+
933
944
defp color ( style , colors ) do
934
945
IO.ANSI . format_fragment ( colors [ style ] , colors [ :enabled ] )
935
946
end
0 commit comments