Forum
Behavior of smarttext does not match documentation
The behavior of the type="smarttext"
field does not match the documentation. Instead of turning --
into an en-dash and ---
into an em-dash as described in the documentation, it turns --
into an em-dash and there is no way to create an en-dash.
This seems to be due to a wrong configuration of the SmartyPants class. The observed behavior corresponds to the default settings of the SmartyPants class while the documented behavior corresponds to the option SMARTYPANTS_ATTR_LONG_EM_DASH_SHORT_EN
. The following change fixes the problem:
diff --git a/perch/core/lib/PerchFieldTypes.class.php b/perch/core/lib/PerchFieldTypes.class.php
index 3cb9be0..ae34b3c 100644
--- a/perch/core/lib/PerchFieldTypes.class.php
+++ b/perch/core/lib/PerchFieldTypes.class.php
@@ -1915,7 +1915,7 @@ class PerchFieldType_smarttext extends PerchFieldType
// sneaky autoloading hack
}
- $SmartyPants = new \Michelf\SmartyPants;
+ $SmartyPants = new \Michelf\SmartyPants(\Michelf\SMARTYPANTS_ATTR_LONG_EM_DASH_SHORT_EN);
$value = $SmartyPants->transform($value);
if (PERCH_HTML_ENTITIES==false) {
Maybe you could include this change in the next update?
P.S.: Is there no way to subscribe to a new thread by email right when I create it?
Thanks, we've logged it.
You can change your forum notification preferences in your account.
This should be fixed in the 2.8.16 release. Thanks!