Changing the template that displays the standard description field for converting strings to breaks is not difficult, but requires a little attention to avoid creating a security hole.
Override the kss_generic_macros.pt layer skin template either in the theme product or in a special folder.
You can then use Products.PythonScripts.standard.newline_to_br to convert strings to strings. You will need to insert the converted text with a "structure" to avoid breaking out of the gaps.
Since you will use the "structure", you must also manually remove the html description (use html_quote from the standard) before applying newline_to_br, or you will create a vector to attack XSS.
The key section of the macro, when fixed, can read:
<div metal:define-macro="description-field-view" id="parent-fieldname-description" tal:define="kss_class python:getKssClasses('description', templateId='kss_generic_macros', macro='description-field-view'); pps modules/Products.PythonScripts.standard" tal:condition="context/Description" tal:attributes="class string:documentDescription$kss_class;"> <span metal:define-slot="inside" tal:replace="structure python:pps.newline_to_br(pps.html_quote(context.Description()))">Description</span> </div>
Stevem
source share