Module: Sterile
- Defined in:
- lib/sterile/sterile.rb
Class Method Summary collapse
- .old_smart_format_rules ⇒ Object
-
.smart_format_rules ⇒ Object
# what would replace the Sterile rules with more broadly applicable Zs [/(pZs|A|“|(|[)‘/, ”\1‘“], [/(S)’()/, ”\1’\2“], [/(pZs|A|(|[)”(?!s)/, “\1“\2”], [/“(pZs|S|Z)/, ””\1“], [/‘([pZs.]|Z)/, ”’\1“], ] + old_smart_format_rules.
Class Method Details
.old_smart_format_rules ⇒ Object
3 |
# File 'lib/sterile/sterile.rb', line 3 alias_method :old_smart_format_rules, :smart_format_rules |
.smart_format_rules ⇒ Object
# what would replace the Sterile rules with more broadly applicable Zs
[/(\p{Zs}|\A|"|\(|\[)'/, "\\1‘"],
[/(\S)'([^\'\p{Zs}])/, "\\1’\\2"],
[/(\p{Zs}|\A|\(|\[)"(?!\s)/, "\\1“\\2"],
[/"(\p{Zs}|\S|\Z)/, "”\\1"],
[/'([\p{Zs}.]|\Z)/, "’\\1"],
] + old_smart_format_rules
13 14 15 16 17 18 19 20 |
# File 'lib/sterile/sterile.rb', line 13 def smart_format_rules [ [/(\S)'([^\'\p{Zs}])/, "\\1’\\2"], [/(\p{Zs})"(?!\s)/, "\\1“\\2"], [/"(\p{Zs})/, "”\\1"], [/'([\p{Zs}.])/, "’\\1"], ] + old_smart_format_rules end |