diff --git a/edivorce/apps/core/templates/dashboard/print_form.html b/edivorce/apps/core/templates/dashboard/print_form.html index 3cf8f50c..c28ff802 100644 --- a/edivorce/apps/core/templates/dashboard/print_form.html +++ b/edivorce/apps/core/templates/dashboard/print_form.html @@ -89,7 +89,7 @@ diff --git a/edivorce/apps/core/templates/pdf/form1.html b/edivorce/apps/core/templates/pdf/form1.html index e4824abc..7fb58131 100644 --- a/edivorce/apps/core/templates/pdf/form1.html +++ b/edivorce/apps/core/templates/pdf/form1.html @@ -1,5 +1,6 @@ {% load static %} {% load input_field %} +{% load format_utils %} @@ -297,7 +298,7 @@ {% check_list source=responses.want_which_orders value='Spousal support' as order_wanted %} Claimant 1 and Claimant 2 are asking for an order for spousal support as follows: - {% if order_wanted and responses.spouse_support_details %} {{responses.spouse_support_details|linebreaksbr }} {% else %}   {% endif %} + {% if order_wanted and responses.spouse_support_details %} {{responses.spouse_support_details|linebreaksul }} {% else %}   {% endif %} @@ -325,7 +326,7 @@ an unequal division of family property and family debt as follows: - {% if responses.deal_with_property_debt == 'unequal division' and responses.how_to_divide_property_debt %} {{ responses.how_to_divide_property_debt|linebreaksbr }} {% else %} {% endif %} + {% if responses.deal_with_property_debt == 'unequal division' and responses.how_to_divide_property_debt %} {{ responses.how_to_divide_property_debt|linebreaksul }} {% else %} {% endif %} @@ -334,7 +335,7 @@ {% check_list source=responses.want_other_property_claims value='Ask for other property claims' as other_wanted %} Claimant 1 and Claimant 2 ask for an order respecting an interest in property or for compensation instead of an interest in that property, as follows: - {% if other_wanted and responses.other_property_claims %} {{ responses.other_property_claims|linebreaksbr }} {% else %} {% endif %} + {% if other_wanted and responses.other_property_claims %} {{ responses.other_property_claims|linebreaksul }} {% else %} {% endif %} @@ -344,7 +345,7 @@ {% check_list source=responses.want_which_orders value='Other orders' as order_wanted %} - Claimant 1 and Claimant 2 are asking for an order in the following terms: {% if responses.other_orders_detail %} {{ responses.other_orders_detail|linebreaksbr }} {% else %}   {% endif %} + Claimant 1 and Claimant 2 are asking for an order in the following terms: {% if responses.other_orders_detail %} {{ responses.other_orders_detail|linebreaksul }} {% else %}   {% endif %}

[set out terms of proposed order]

diff --git a/edivorce/apps/core/templatetags/format_utils.py b/edivorce/apps/core/templatetags/format_utils.py new file mode 100644 index 00000000..a9b57a22 --- /dev/null +++ b/edivorce/apps/core/templatetags/format_utils.py @@ -0,0 +1,14 @@ +from django import template +import re +from django.utils.safestring import mark_safe + +register = template.Library() + + +@register.filter +def linebreaksul(value): + "Converts strings with newlines into s" + value = re.sub(r'\r\n|\r|\n', '\n', value.strip()) # normalize newlines + lines = re.split('\n', value) + lines = ['
  • %s
  • ' % line for line in lines] + return mark_safe('' % '\n'.join(lines))