actionview 7.0.1 → 7.1.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +340 -197
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +3 -3
  5. data/app/assets/javascripts/rails-ujs.esm.js +686 -0
  6. data/app/assets/javascripts/rails-ujs.js +630 -0
  7. data/lib/action_view/base.rb +33 -12
  8. data/lib/action_view/buffers.rb +106 -8
  9. data/lib/action_view/cache_expiry.rb +40 -43
  10. data/lib/action_view/context.rb +1 -1
  11. data/lib/action_view/deprecator.rb +7 -0
  12. data/lib/action_view/digestor.rb +1 -1
  13. data/lib/action_view/gem_version.rb +4 -4
  14. data/lib/action_view/helpers/active_model_helper.rb +1 -1
  15. data/lib/action_view/helpers/asset_tag_helper.rb +137 -52
  16. data/lib/action_view/helpers/asset_url_helper.rb +13 -12
  17. data/lib/action_view/helpers/atom_feed_helper.rb +5 -5
  18. data/lib/action_view/helpers/cache_helper.rb +3 -9
  19. data/lib/action_view/helpers/capture_helper.rb +32 -12
  20. data/lib/action_view/helpers/content_exfiltration_prevention_helper.rb +70 -0
  21. data/lib/action_view/helpers/controller_helper.rb +6 -0
  22. data/lib/action_view/helpers/csp_helper.rb +2 -2
  23. data/lib/action_view/helpers/csrf_helper.rb +3 -3
  24. data/lib/action_view/helpers/date_helper.rb +76 -64
  25. data/lib/action_view/helpers/debug_helper.rb +3 -3
  26. data/lib/action_view/helpers/form_helper.rb +72 -37
  27. data/lib/action_view/helpers/form_options_helper.rb +6 -3
  28. data/lib/action_view/helpers/form_tag_helper.rb +94 -50
  29. data/lib/action_view/helpers/javascript_helper.rb +1 -0
  30. data/lib/action_view/helpers/number_helper.rb +39 -331
  31. data/lib/action_view/helpers/output_safety_helper.rb +4 -4
  32. data/lib/action_view/helpers/rendering_helper.rb +5 -6
  33. data/lib/action_view/helpers/sanitize_helper.rb +52 -22
  34. data/lib/action_view/helpers/tag_helper.rb +27 -16
  35. data/lib/action_view/helpers/tags/base.rb +11 -52
  36. data/lib/action_view/helpers/tags/collection_check_boxes.rb +1 -0
  37. data/lib/action_view/helpers/tags/collection_radio_buttons.rb +1 -0
  38. data/lib/action_view/helpers/tags/collection_select.rb +3 -0
  39. data/lib/action_view/helpers/tags/date_field.rb +1 -1
  40. data/lib/action_view/helpers/tags/date_select.rb +2 -0
  41. data/lib/action_view/helpers/tags/datetime_field.rb +14 -6
  42. data/lib/action_view/helpers/tags/datetime_local_field.rb +11 -2
  43. data/lib/action_view/helpers/tags/grouped_collection_select.rb +3 -0
  44. data/lib/action_view/helpers/tags/month_field.rb +1 -1
  45. data/lib/action_view/helpers/tags/select.rb +4 -1
  46. data/lib/action_view/helpers/tags/select_renderer.rb +56 -0
  47. data/lib/action_view/helpers/tags/time_field.rb +1 -1
  48. data/lib/action_view/helpers/tags/time_zone_select.rb +3 -0
  49. data/lib/action_view/helpers/tags/week_field.rb +1 -1
  50. data/lib/action_view/helpers/tags/weekday_select.rb +3 -0
  51. data/lib/action_view/helpers/tags.rb +2 -0
  52. data/lib/action_view/helpers/text_helper.rb +157 -85
  53. data/lib/action_view/helpers/translation_helper.rb +6 -6
  54. data/lib/action_view/helpers/url_helper.rb +90 -65
  55. data/lib/action_view/helpers.rb +2 -0
  56. data/lib/action_view/layouts.rb +15 -10
  57. data/lib/action_view/log_subscriber.rb +49 -32
  58. data/lib/action_view/lookup_context.rb +29 -13
  59. data/lib/action_view/path_registry.rb +57 -0
  60. data/lib/action_view/path_set.rb +13 -14
  61. data/lib/action_view/railtie.rb +26 -3
  62. data/lib/action_view/record_identifier.rb +16 -9
  63. data/lib/action_view/renderer/abstract_renderer.rb +1 -1
  64. data/lib/action_view/renderer/collection_renderer.rb +10 -2
  65. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +21 -3
  66. data/lib/action_view/renderer/partial_renderer.rb +3 -2
  67. data/lib/action_view/renderer/renderer.rb +2 -0
  68. data/lib/action_view/renderer/streaming_template_renderer.rb +3 -2
  69. data/lib/action_view/renderer/template_renderer.rb +3 -2
  70. data/lib/action_view/rendering.rb +24 -6
  71. data/lib/action_view/ripper_ast_parser.rb +6 -6
  72. data/lib/action_view/routing_url_for.rb +7 -4
  73. data/lib/action_view/template/error.rb +14 -1
  74. data/lib/action_view/template/handlers/builder.rb +4 -4
  75. data/lib/action_view/template/handlers/erb/erubi.rb +23 -27
  76. data/lib/action_view/template/handlers/erb.rb +73 -1
  77. data/lib/action_view/template/handlers.rb +1 -1
  78. data/lib/action_view/template/html.rb +1 -1
  79. data/lib/action_view/template/raw_file.rb +1 -1
  80. data/lib/action_view/template/renderable.rb +1 -1
  81. data/lib/action_view/template/resolver.rb +15 -5
  82. data/lib/action_view/template/text.rb +1 -1
  83. data/lib/action_view/template/types.rb +25 -34
  84. data/lib/action_view/template.rb +242 -54
  85. data/lib/action_view/template_path.rb +2 -0
  86. data/lib/action_view/test_case.rb +176 -21
  87. data/lib/action_view/unbound_template.rb +15 -5
  88. data/lib/action_view/version.rb +1 -1
  89. data/lib/action_view/view_paths.rb +19 -28
  90. data/lib/action_view.rb +4 -1
  91. data/lib/assets/compiled/rails-ujs.js +36 -5
  92. metadata +27 -27
@@ -1,14 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "cgi"
4
+ require "action_view/helpers/content_exfiltration_prevention_helper"
4
5
  require "action_view/helpers/url_helper"
5
6
  require "action_view/helpers/text_helper"
6
7
  require "active_support/core_ext/string/output_safety"
7
8
  require "active_support/core_ext/module/attribute_accessors"
8
9
 
9
10
  module ActionView
10
- # = Action View Form Tag Helpers
11
11
  module Helpers # :nodoc:
12
+ # = Action View Form Tag \Helpers
13
+ #
12
14
  # Provides a number of methods for creating form tags that don't rely on an Active Record object assigned to the template like
13
15
  # FormHelper does. Instead, you provide the names and values manually.
14
16
  #
@@ -19,6 +21,7 @@ module ActionView
19
21
 
20
22
  include UrlHelper
21
23
  include TextHelper
24
+ include ContentExfiltrationPreventionHelper
22
25
 
23
26
  mattr_accessor :embed_authenticity_token_in_remote_forms
24
27
  self.embed_authenticity_token_in_remote_forms = nil
@@ -62,7 +65,7 @@ module ActionView
62
65
  #
63
66
  # <%= form_tag('/posts', remote: true) %>
64
67
  # # => <form action="/posts" method="post" data-remote="true">
65
-
68
+ #
66
69
  # form_tag(false, method: :get)
67
70
  # # => <form method="get">
68
71
  #
@@ -88,11 +91,11 @@ module ActionView
88
91
  # attribute name.
89
92
  #
90
93
  # <%= label_tag :post, :title %>
91
- # <%= text_field_tag :post, :title, aria: { describedby: field_id(:post, :title, :error) } %>
94
+ # <%= text_field :post, :title, aria: { describedby: field_id(:post, :title, :error) } %>
92
95
  # <%= tag.span("is blank", id: field_id(:post, :title, :error) %>
93
96
  #
94
97
  # In the example above, the <tt><input type="text"></tt> element built by
95
- # the call to <tt>text_field_tag</tt> declares an
98
+ # the call to <tt>text_field</tt> declares an
96
99
  # <tt>aria-describedby</tt> attribute referencing the <tt><span></tt>
97
100
  # element, sharing a common <tt>id</tt> root (<tt>post_title</tt>, in this
98
101
  # case).
@@ -120,18 +123,18 @@ module ActionView
120
123
  # Return the value generated by the <tt>FormBuilder</tt> for the given
121
124
  # attribute name.
122
125
  #
123
- # <%= text_field_tag :post, :title, name: field_name(:post, :title, :subtitle) %>
124
- # <%# => <input type="text" name="post[title][subtitle]">
126
+ # <%= text_field :post, :title, name: field_name(:post, :title, :subtitle) %>
127
+ # <%# => <input type="text" name="post[title][subtitle]"> %>
125
128
  #
126
- # <%= text_field_tag :post, :tag, name: field_name(:post, :tag, multiple: true) %>
127
- # <%# => <input type="text" name="post[tag][]">
129
+ # <%= text_field :post, :tag, name: field_name(:post, :tag, multiple: true) %>
130
+ # <%# => <input type="text" name="post[tag][]"> %>
128
131
  #
129
132
  def field_name(object_name, method_name, *method_names, multiple: false, index: nil)
130
133
  names = method_names.map! { |name| "[#{name}]" }.join
131
134
 
132
135
  # a little duplication to construct fewer strings
133
136
  case
134
- when object_name.empty?
137
+ when object_name.blank?
135
138
  "#{method_name}#{names}#{multiple ? "[]" : ""}"
136
139
  when index
137
140
  "#{object_name}[#{index}][#{method_name}]#{names}#{multiple ? "[]" : ""}"
@@ -342,7 +345,7 @@ module ActionView
342
345
  # file_field_tag 'file', accept: 'text/html', class: 'upload', value: 'index.html'
343
346
  # # => <input accept="text/html" class="upload" id="file" name="file" type="file" value="index.html" />
344
347
  def file_field_tag(name, options = {})
345
- text_field_tag(name, nil, convert_direct_upload_option_to_url(name, options.merge(type: :file)))
348
+ text_field_tag(name, nil, convert_direct_upload_option_to_url(options.merge(type: :file)))
346
349
  end
347
350
 
348
351
  # Creates a password field, a masked text field that will hide the users input behind a mask character.
@@ -420,9 +423,17 @@ module ActionView
420
423
  content_tag :textarea, content.to_s.html_safe, { "name" => name, "id" => sanitize_to_id(name) }.update(options)
421
424
  end
422
425
 
426
+ ##
427
+ # :call-seq:
428
+ # check_box_tag(name, options = {})
429
+ # check_box_tag(name, value, options = {})
430
+ # check_box_tag(name, value, checked, options = {})
431
+ #
423
432
  # Creates a check box form input tag.
424
433
  #
425
434
  # ==== Options
435
+ # * <tt>:value</tt> - The value of the input. Defaults to <tt>"1"</tt>.
436
+ # * <tt>:checked</tt> - If set to true, the checkbox will be checked by default.
426
437
  # * <tt>:disabled</tt> - If set to true, the user will not be able to use this input.
427
438
  # * Any other key creates standard HTML options for the tag.
428
439
  #
@@ -441,16 +452,27 @@ module ActionView
441
452
  #
442
453
  # check_box_tag 'eula', 'accepted', false, disabled: true
443
454
  # # => <input disabled="disabled" id="eula" name="eula" type="checkbox" value="accepted" />
444
- def check_box_tag(name, value = "1", checked = false, options = {})
455
+ def check_box_tag(name, *args)
456
+ if args.length >= 4
457
+ raise ArgumentError, "wrong number of arguments (given #{args.length + 1}, expected 1..4)"
458
+ end
459
+ options = args.extract_options!
460
+ value, checked = args.empty? ? ["1", false] : [*args, false]
445
461
  html_options = { "type" => "checkbox", "name" => name, "id" => sanitize_to_id(name), "value" => value }.update(options.stringify_keys)
446
462
  html_options["checked"] = "checked" if checked
447
463
  tag :input, html_options
448
464
  end
449
465
 
466
+ ##
467
+ # :call-seq:
468
+ # radio_button_tag(name, value, options = {})
469
+ # radio_button_tag(name, value, checked, options = {})
470
+ #
450
471
  # Creates a radio button; use groups of radio buttons named the same to allow users to
451
472
  # select from a group of options.
452
473
  #
453
474
  # ==== Options
475
+ # * <tt>:checked</tt> - If set to true, the radio button will be selected by default.
454
476
  # * <tt>:disabled</tt> - If set to true, the user will not be able to use this input.
455
477
  # * Any other key creates standard HTML options for the tag.
456
478
  #
@@ -466,7 +488,12 @@ module ActionView
466
488
  #
467
489
  # radio_button_tag 'color', "green", true, class: "color_input"
468
490
  # # => <input checked="checked" class="color_input" id="color_green" name="color" type="radio" value="green" />
469
- def radio_button_tag(name, value, checked = false, options = {})
491
+ def radio_button_tag(name, value, *args)
492
+ if args.length >= 3
493
+ raise ArgumentError, "wrong number of arguments (given #{args.length + 2}, expected 2..4)"
494
+ end
495
+ options = args.extract_options!
496
+ checked = args.empty? ? false : args.first
470
497
  html_options = { "type" => "radio", "name" => name, "id" => "#{sanitize_to_id(name)}_#{sanitize_to_id(value)}", "value" => value }.update(options.stringify_keys)
471
498
  html_options["checked"] = "checked" if checked
472
499
  tag :input, html_options
@@ -495,9 +522,9 @@ module ActionView
495
522
  # submit_tag "Edit", class: "edit_button"
496
523
  # # => <input class="edit_button" data-disable-with="Edit" name="commit" type="submit" value="Edit" />
497
524
  #
498
- # ==== Deprecated: Rails UJS attributes
525
+ # ==== Deprecated: \Rails UJS attributes
499
526
  #
500
- # Prior to Rails 7, Rails shipped with the JavaScript library called @rails/ujs on by default. Following Rails 7,
527
+ # Prior to \Rails 7, \Rails shipped with the JavaScript library called @rails/ujs on by default. Following \Rails 7,
501
528
  # this library is no longer on by default. This library integrated with the following options:
502
529
  #
503
530
  # * <tt>confirm: 'question?'</tt> - If present the unobtrusive JavaScript
@@ -555,9 +582,9 @@ module ActionView
555
582
  # # <strong>Ask me!</strong>
556
583
  # # </button>
557
584
  #
558
- # ==== Deprecated: Rails UJS attributes
585
+ # ==== Deprecated: \Rails UJS attributes
559
586
  #
560
- # Prior to Rails 7, Rails shipped with a JavaScript library called @rails/ujs on by default. Following Rails 7,
587
+ # Prior to \Rails 7, \Rails shipped with a JavaScript library called @rails/ujs on by default. Following \Rails 7,
561
588
  # this library is no longer on by default. This library integrated with the following options:
562
589
  #
563
590
  # * <tt>confirm: 'question?'</tt> - If present, the
@@ -657,9 +684,11 @@ module ActionView
657
684
  # Creates a text field of type "color".
658
685
  #
659
686
  # ==== Options
660
- # * Accepts the same options as text_field_tag.
687
+ #
688
+ # Supports the same options as #text_field_tag.
661
689
  #
662
690
  # ==== Examples
691
+ #
663
692
  # color_field_tag 'name'
664
693
  # # => <input id="name" name="name" type="color" />
665
694
  #
@@ -678,9 +707,11 @@ module ActionView
678
707
  # Creates a text field of type "search".
679
708
  #
680
709
  # ==== Options
681
- # * Accepts the same options as text_field_tag.
710
+ #
711
+ # Supports the same options as #text_field_tag.
682
712
  #
683
713
  # ==== Examples
714
+ #
684
715
  # search_field_tag 'name'
685
716
  # # => <input id="name" name="name" type="search" />
686
717
  #
@@ -699,9 +730,11 @@ module ActionView
699
730
  # Creates a text field of type "tel".
700
731
  #
701
732
  # ==== Options
702
- # * Accepts the same options as text_field_tag.
733
+ #
734
+ # Supports the same options as #text_field_tag.
703
735
  #
704
736
  # ==== Examples
737
+ #
705
738
  # telephone_field_tag 'name'
706
739
  # # => <input id="name" name="name" type="tel" />
707
740
  #
@@ -721,9 +754,11 @@ module ActionView
721
754
  # Creates a text field of type "date".
722
755
  #
723
756
  # ==== Options
724
- # * Accepts the same options as text_field_tag.
757
+ #
758
+ # Supports the same options as #text_field_tag.
725
759
  #
726
760
  # ==== Examples
761
+ #
727
762
  # date_field_tag 'name'
728
763
  # # => <input id="name" name="name" type="date" />
729
764
  #
@@ -741,23 +776,28 @@ module ActionView
741
776
 
742
777
  # Creates a text field of type "time".
743
778
  #
744
- # === Options
779
+ # ==== Options
780
+ #
781
+ # Supports the same options as #text_field_tag. Additionally, supports:
782
+ #
745
783
  # * <tt>:min</tt> - The minimum acceptable value.
746
784
  # * <tt>:max</tt> - The maximum acceptable value.
747
785
  # * <tt>:step</tt> - The acceptable value granularity.
748
786
  # * <tt>:include_seconds</tt> - Include seconds and ms in the output timestamp format (true by default).
749
- # * Otherwise accepts the same options as text_field_tag.
750
787
  def time_field_tag(name, value = nil, options = {})
751
788
  text_field_tag(name, value, options.merge(type: :time))
752
789
  end
753
790
 
754
791
  # Creates a text field of type "datetime-local".
755
792
  #
756
- # === Options
793
+ # ==== Options
794
+ #
795
+ # Supports the same options as #text_field_tag. Additionally, supports:
796
+ #
757
797
  # * <tt>:min</tt> - The minimum acceptable value.
758
798
  # * <tt>:max</tt> - The maximum acceptable value.
759
799
  # * <tt>:step</tt> - The acceptable value granularity.
760
- # * Otherwise accepts the same options as text_field_tag.
800
+ # * <tt>:include_seconds</tt> - Include seconds in the output timestamp format (true by default).
761
801
  def datetime_field_tag(name, value = nil, options = {})
762
802
  text_field_tag(name, value, options.merge(type: "datetime-local"))
763
803
  end
@@ -766,22 +806,26 @@ module ActionView
766
806
 
767
807
  # Creates a text field of type "month".
768
808
  #
769
- # === Options
809
+ # ==== Options
810
+ #
811
+ # Supports the same options as #text_field_tag. Additionally, supports:
812
+ #
770
813
  # * <tt>:min</tt> - The minimum acceptable value.
771
814
  # * <tt>:max</tt> - The maximum acceptable value.
772
815
  # * <tt>:step</tt> - The acceptable value granularity.
773
- # * Otherwise accepts the same options as text_field_tag.
774
816
  def month_field_tag(name, value = nil, options = {})
775
817
  text_field_tag(name, value, options.merge(type: :month))
776
818
  end
777
819
 
778
820
  # Creates a text field of type "week".
779
821
  #
780
- # === Options
822
+ # ==== Options
823
+ #
824
+ # Supports the same options as #text_field_tag. Additionally, supports:
825
+ #
781
826
  # * <tt>:min</tt> - The minimum acceptable value.
782
827
  # * <tt>:max</tt> - The maximum acceptable value.
783
828
  # * <tt>:step</tt> - The acceptable value granularity.
784
- # * Otherwise accepts the same options as text_field_tag.
785
829
  def week_field_tag(name, value = nil, options = {})
786
830
  text_field_tag(name, value, options.merge(type: :week))
787
831
  end
@@ -789,9 +833,11 @@ module ActionView
789
833
  # Creates a text field of type "url".
790
834
  #
791
835
  # ==== Options
792
- # * Accepts the same options as text_field_tag.
836
+ #
837
+ # Supports the same options as #text_field_tag.
793
838
  #
794
839
  # ==== Examples
840
+ #
795
841
  # url_field_tag 'name'
796
842
  # # => <input id="name" name="name" type="url" />
797
843
  #
@@ -810,9 +856,11 @@ module ActionView
810
856
  # Creates a text field of type "email".
811
857
  #
812
858
  # ==== Options
813
- # * Accepts the same options as text_field_tag.
859
+ #
860
+ # Supports the same options as #text_field_tag.
814
861
  #
815
862
  # ==== Examples
863
+ #
816
864
  # email_field_tag 'name'
817
865
  # # => <input id="name" name="name" type="email" />
818
866
  #
@@ -831,15 +879,18 @@ module ActionView
831
879
  # Creates a number field.
832
880
  #
833
881
  # ==== Options
882
+ #
883
+ # Supports the same options as #text_field_tag. Additionally, supports:
884
+ #
834
885
  # * <tt>:min</tt> - The minimum acceptable value.
835
886
  # * <tt>:max</tt> - The maximum acceptable value.
836
887
  # * <tt>:in</tt> - A range specifying the <tt>:min</tt> and
837
888
  # <tt>:max</tt> values.
838
889
  # * <tt>:within</tt> - Same as <tt>:in</tt>.
839
890
  # * <tt>:step</tt> - The acceptable value granularity.
840
- # * Otherwise accepts the same options as text_field_tag.
841
891
  #
842
892
  # ==== Examples
893
+ #
843
894
  # number_field_tag 'quantity'
844
895
  # # => <input id="quantity" name="quantity" type="number" />
845
896
  #
@@ -881,12 +932,13 @@ module ActionView
881
932
  # Creates a range form element.
882
933
  #
883
934
  # ==== Options
884
- # * Accepts the same options as number_field_tag.
935
+ #
936
+ # Supports the same options as #number_field_tag.
885
937
  def range_field_tag(name, value = nil, options = {})
886
938
  number_field_tag(name, value, options.merge(type: :range))
887
939
  end
888
940
 
889
- # Creates the hidden UTF8 enforcer tag. Override this method in a helper
941
+ # Creates the hidden UTF-8 enforcer tag. Override this method in a helper
890
942
  # to customize the tag.
891
943
  def utf8_enforcer_tag
892
944
  # Use raw HTML to ensure the value is written as an HTML entity; it
@@ -955,7 +1007,8 @@ module ActionView
955
1007
 
956
1008
  def form_tag_html(html_options)
957
1009
  extra_tags = extra_tags_for_form(html_options)
958
- tag(:form, html_options, true) + extra_tags
1010
+ html = tag(:form, html_options, true) + extra_tags
1011
+ prevent_content_exfiltration(html)
959
1012
  end
960
1013
 
961
1014
  def form_tag_with_body(html_options, content)
@@ -984,24 +1037,15 @@ module ActionView
984
1037
  tag_options.delete("data-disable-with")
985
1038
  end
986
1039
 
987
- def convert_direct_upload_option_to_url(name, options)
988
- if options.delete(:direct_upload) && respond_to?(:rails_direct_uploads_url)
989
- options["data-direct-upload-url"] = rails_direct_uploads_url
990
-
991
- if options[:object] && options[:object].class.respond_to?(:reflect_on_attachment)
992
- attachment_reflection = options[:object].class.reflect_on_attachment(name)
993
-
994
- class_with_attachment = "#{options[:object].class.name.underscore}##{name}"
995
- options["data-direct-upload-attachment-name"] = class_with_attachment
1040
+ def convert_direct_upload_option_to_url(options)
1041
+ return options unless options.delete(:direct_upload)
996
1042
 
997
- service_name = attachment_reflection.options[:service_name] || ActiveStorage::Blob.service.name
998
- options["data-direct-upload-token"] = ActiveStorage::DirectUploadToken.generate_direct_upload_token(
999
- class_with_attachment,
1000
- service_name,
1001
- session
1002
- )
1003
- end
1043
+ if respond_to?(:rails_direct_uploads_url)
1044
+ options["data-direct-upload-url"] = rails_direct_uploads_url
1045
+ elsif respond_to?(:main_app) && main_app.respond_to?(:rails_direct_uploads_url)
1046
+ options["data-direct-upload-url"] = main_app.rails_direct_uploads_url
1004
1047
  end
1048
+
1005
1049
  options
1006
1050
  end
1007
1051
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  module ActionView
4
4
  module Helpers # :nodoc:
5
+ # = Action View JavaScript \Helpers
5
6
  module JavaScriptHelper
6
7
  JS_ESCAPE_MAP = {
7
8
  "\\" => "\\\\",