Skip to content

Commit

Permalink
fix: using quote escapes in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgarel committed Feb 21, 2024
1 parent cd17b03 commit 012b8f2
Show file tree
Hide file tree
Showing 60 changed files with 253 additions and 252 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"contribution"
],
"title_element": {
"title": "[% lang('contribution_panel_title') %]",
"title": "[% edq(lang('contribution_panel_title')) %]",
},
"elements": [
[%# Panels displaying data_quality errors / warnings / info %]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
[% icon_name = "data-info" %]
[% END %]
"title_element": {
"title": "[% lang(panel.tags_type _ '_panel_title') %]",
"subtitle": "[% lang(panel.tags_type _ '_panel_subtitle') %]",
"title": "[% edq(lang(panel.tags_type _ '_panel_title')) %]",
"subtitle": "[% edq(lang(panel.tags_type _ '_panel_subtitle')) %]",
"icon_url": "[% static_subdomain %]/images/icons/dist/[% icon_name %].svg",
"icon_color_from_evaluation": true,
},
Expand Down Expand Up @@ -58,7 +58,7 @@
{
"element_type": "action",
"action_element": {
"html": `[% lang(action_name) %]`,
"html": `[% edq(lang(action_name)) %]`,
"actions": [
"[% fix_action %]",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
[% END %]
"title_element": {
[% SET driving_100g_rounded = sprintf('%.1f', driving_100g) %]
"title": "[% f_lang('f_equal_to_driving_km_in_a_petrol_car', { 'kilometers' => driving_100g_rounded } ) %]",
"title": "[% edq(f_lang('f_equal_to_driving_km_in_a_petrol_car', { 'kilometers' => driving_100g_rounded } )) %]",
[% SET co2_100g_rounded = sprintf('%.0f', co2_100g * 1000) %]
"subtitle": "[% f_lang('f_carbon_footprint_per_100g_of_product', { 'grams' => co2_100g_rounded }) %]",
"subtitle": "[% edq(f_lang('f_carbon_footprint_per_100g_of_product', { 'grams' => co2_100g_rounded })) %]",
"icon_url": "[% static_subdomain %]/images/icons/dist/car.svg",
"icon_color_from_evaluation": true,
},
Expand All @@ -40,14 +40,14 @@
"table_element": {
"id": "ecoscore_carbon_impact_by_stages_table",
"table_type": "percents",
"title": "[% lang('ecoscore_impact_detail_by_stages') %]",
"title": "[% edq(lang('ecoscore_impact_detail_by_stages')) %]",
"columns": [
{
"text": "[% lang('ecoscore_stage') %]",
"text": "[% edq(lang('ecoscore_stage')) %]",
"type": "text",
},
{
"text": "[% lang('ecoscore_impact') %]",
"text": "[% edq(lang('ecoscore_impact')) %]",
"type": "percent",
}
],
Expand All @@ -58,7 +58,7 @@
"values": [
{
"icon_url": "[% static_subdomain %]/images/icons/dist/[% step %].svg",
"text": "[% lang("ecoscore_$step") %]"
"text": "[% edq(lang("ecoscore_$step")) %]"
},
{
[% co2_step = "co2_$step" %]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"icon_url": "[% static_subdomain %]/images/icons/dist/lca.svg",
"icon_color_from_evaluation": true,
"icon_size": "small",
"title": "[% lang('average_impact_of_the_category') %][% sep %]: [% panel.agribalyse_grade FILTER upper %] (Score: [% panel.agribalyse_score %]/100)",
"subtitle": "[% lang('categories_s') FILTER ucfirst %][% sep %]: [% panel.agribalyse_category_name.dquote %]",
"title": "[% edq(lang('average_impact_of_the_category')) %][% sep %]: [% panel.agribalyse_grade FILTER upper %] (Score: [% panel.agribalyse_score %]/100)",
"subtitle": "[% edq(lang('categories_s')) FILTER ucfirst %][% sep %]: [% panel.agribalyse_category_name.dquote %]",
"type": "grade",
"grade": "[% panel.agribalyse_grade %]",
},
Expand Down Expand Up @@ -39,14 +39,14 @@
"table_element": {
"id": "ecoscore_lca_impacts_by_stages_table",
"table_type": "percents",
"title": "[% lang('ecoscore_impact_detail_by_stages') %]",
"title": "[% edq(lang('ecoscore_impact_detail_by_stages')) %]",
"columns": [
{
"text": "[% lang('ecoscore_stage') %]",
"text": "[% edq(lang('ecoscore_stage')) %]",
"type": "text",
},
{
"text": "[% lang('ecoscore_impact') %]",
"text": "[% edq(lang('ecoscore_impact')) %]",
"type": "percent",
}
],
Expand All @@ -57,7 +57,7 @@
"values": [
{
"icon_url": "[% static_subdomain %]/images/icons/dist/[% step %].svg",
"text": "[% lang("ecoscore_$step") %]"
"text": "[% edq(lang("ecoscore_$step")) %]"
},
{
[% ef_step = "ef_$step" %]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
{
"element_type": "panel_group",
"panel_group_element": {
"title": "[% lang('life_cycle_analysis') %]",
"title": "[% edq(lang('life_cycle_analysis')) %]",
"panel_ids": [
"ecoscore_agribalyse",
],
Expand All @@ -50,7 +50,7 @@
{
"element_type": "panel_group",
"panel_group_element": {
"title": "[% lang('ecoscore_bonuses_and_maluses') %]",
"title": "[% edq(lang('ecoscore_bonuses_and_maluses')) %]",
"panel_ids": [
[% FOREACH adjustment IN ["production_system", "origins_of_ingredients", "threatened_species", "packaging"] %]
[% IF (adjustment == "origins_of_ingredients") or (adjustment == "packaging") or (product.ecoscore_data.adjustments.$adjustment.value != 0) %]
Expand All @@ -63,7 +63,7 @@
{
"element_type": "panel_group",
"panel_group_element": {
"title": "[% lang('ecoscore_for_this_product') %]",
"title": "[% edq(lang('ecoscore_for_this_product')) %]",
"panel_ids": [ "ecoscore_total"],
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[% SET climate_change_ratio_to_category = panel.climate_change / panel.ecoscore_extended_data_for_category.climate_change %]


// "title": "[% f_lang('f_equal_to_driving_km_in_a_petrol_car', { 'kilometers' => driving_100g_rounded } ) %]",
// "title": "[% edq(f_lang('f_equal_to_driving_km_in_a_petrol_car', { 'kilometers' => driving_100g_rounded } )) %]",
{
"level" :"info",
"topics": [
Expand All @@ -25,7 +25,7 @@
[% SET climate_change_ratio_percent_less = sprintf('%d', (1 - climate_change_ratio_to_category) * 100) %]
"title": "Environmental impact of ingredients [% climate_change_ratio_percent_less %]% smaller than similar products",
[% END %]
"subtitle": "Compared to: [% lang('categories_s') FILTER ucfirst %][% sep %]: [% panel.agribalyse_category_name.dquote %]",
"subtitle": "Compared to: [% edq(lang('categories_s')) FILTER ucfirst %][% sep %]: [% panel.agribalyse_category_name.dquote %]",
"type": "grade",
"icon_url": "[% static_subdomain %]/images/icons/dist/scale-balance.svg",
"icon_color_from_evaluation": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
],
"title_element": {
"icon_url": "[% static_subdomain %]/images/attributes/dist/ecoscore-not-applicable.svg",
"title": "[% lang("attribute_ecoscore_not_applicable_title") %]",
"title": "[% edq(lang('attribute_ecoscore_not_applicable_title')) %]",
"subtitle": "[% panel.subtitle %]",
"type": "grade",
"grade": "unknown",
Expand All @@ -15,7 +15,7 @@
"element_type": "text",
"text_element": {
"type": "summary",
"html": "[% lang("ecoscore_not_applicable_coming_soon") %]"
"html": "[% edq(lang('ecoscore_not_applicable_coming_soon')) %]"
}
},
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
],
"title_element": {
"icon_url": "[% static_subdomain %]/images/attributes/dist/ecoscore-unknown.svg",
"title": "[% lang("attribute_ecoscore_unknown_title") %] - [% lang("attribute_ecoscore_unknown_description_short") %]",
"title": "[% eqq(lang('attribute_ecoscore_unknown_title')) %] - [% edq(lang('attribute_ecoscore_unknown_description_short')) %]",
"type": "grade",
"grade": "unknown",
},
Expand All @@ -14,7 +14,7 @@
"element_type": "text",
"text_element": {
"type": "summary",
"html": "[% lang("ecoscore_unknown_call_to_help") %]"
"html": "[% edq(lang('ecoscore_unknown_call_to_help')) %]"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
[% IF product.ecoscore_data.adjustments.origins_of_ingredients.warning == "origins_are_100_percent_unknown" %]
"evaluation": "unknown",
"title_element": {
"title": "[% lang('ecoscore_origins_of_ingredients_missing_information') %]",
"subtitle": "[% lang('malus') %][% sep %]: [% product.ecoscore_data.adjustments.origins_of_ingredients.value %]",
"title": "[% edq(lang('ecoscore_origins_of_ingredients_missing_information')) %]",
"subtitle": "[% edq(lang('malus')) %][% sep %]: [% product.ecoscore_data.adjustments.origins_of_ingredients.value %]",
"icon_color_from_evaluation": true,
"icon_url": "[% static_subdomain %]/images/icons/dist/public.svg",
"icon_size": "small",
Expand All @@ -28,20 +28,20 @@
[% IF product.ecoscore_data.adjustments.origins_of_ingredients.value <= 0 %]
"evaluation": "bad",
"title_element": {
"title": "[% lang('ecoscore_origins_of_ingredients_impact_high') %]",
"title": "[% edq(lang('ecoscore_origins_of_ingredients_impact_high')) %]",
[% ELSIF product.ecoscore_data.adjustments.origins_of_ingredients.value <= 15 %]
"evaluation": "average",
"title_element": {
"title": "[% lang('ecoscore_origins_of_ingredients_impact_medium') %]",
"title": "[% edq(lang('ecoscore_origins_of_ingredients_impact_medium')) %]",
[% ELSE %]
"evaluation": "good",
"title_element": {
"title": "[% lang('ecoscore_origins_of_ingredients_impact_low') %]",
"title": "[% edq(lang('ecoscore_origins_of_ingredients_impact_low')) %]",
[% END %]
[% IF product.ecoscore_data.adjustments.origins_of_ingredients.value > 0 %]
"subtitle": "[% lang('bonus') %][% sep %]: +[% product.ecoscore_data.adjustments.origins_of_ingredients.value %]",
"subtitle": "[% edq(lang('bonus')) %][% sep %]: +[% product.ecoscore_data.adjustments.origins_of_ingredients.value %]",
[% ELSE %]
"subtitle": "[% lang('malus') %][% sep %]: [% product.ecoscore_data.adjustments.origins_of_ingredients.value %]",
"subtitle": "[% edq(lang('malus')) %][% sep %]: [% product.ecoscore_data.adjustments.origins_of_ingredients.value %]",
[% END %]
"icon_color_from_evaluation": true,
"icon_url": "[% static_subdomain %]/images/icons/dist/public.svg",
Expand All @@ -62,18 +62,18 @@
"element_type": "table",
"table_element": {
"id": "ecoscore_origins_of_ingredients_table",
"title": "[% lang('ecoscore_origins_of_ingredients') %]",
"title": "[% edq(lang('ecoscore_origins_of_ingredients')) %]",
"columns": [
{
"text": "[% lang('origin') %]",
"text": "[% edq(lang('origin')) %]",
"type": "text",
},
{
"text": "[% lang('percent_of_ingredients') %]",
"text": "[% edq(lang('percent_of_ingredients')) %]",
"type": "percent",
},
{
"text": "[% lang('ecoscore_impact') %]",
"text": "[% edq(lang('ecoscore_impact')) %]",
"type": "text",
}
],
Expand All @@ -100,13 +100,13 @@
},
{
[% IF score >= 15 %]
"text": "[% lang('low') FILTER ucfirst %]",
"text": "[% edq(lang('low')) FILTER ucfirst %]",
"evaluation": "good",
[% ELSIF score <= 0 %]
"text": "[% lang('high') FILTER ucfirst %]",
"text": "[% edq(lang('high')) FILTER ucfirst %]",
"evaluation": "bad",
[% ELSE %]
"text": "[% lang('medium') FILTER ucfirst %]",
"text": "[% edq(lang('medium')) FILTER ucfirst %]",
"evaluation": "neutral",
[% END %]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
[% IF not (product.ecoscore_data.adjustments.packaging.packagings && product.ecoscore_data.adjustments.packaging.packagings.size) %]
"evaluation": "unknown",
"title_element": {
"title": "[% lang('ecoscore_packaging_missing_information') %]",
"subtitle": "[% lang('malus') %][% sep %]: [% product.ecoscore_data.adjustments.packaging.value %]",
"title": "[% edq(lang('ecoscore_packaging_missing_information')) %]",
"subtitle": "[% edq(lang('malus')) %][% sep %]: [% product.ecoscore_data.adjustments.packaging.value %]",
"icon_color_from_evaluation": true,
"icon_url": "[% static_subdomain %]/images/icons/dist/packaging.svg",
"icon_size": "small",
Expand All @@ -26,17 +26,17 @@
[% IF product.ecoscore_data.adjustments.packaging.value <= -15 %]
"evaluation": "bad",
"title_element": {
"title": "[% lang('ecoscore_packaging_impact_high') %]",
"title": "[% edq(lang('ecoscore_packaging_impact_high')) %]",
[% ELSIF product.ecoscore_data.adjustments.packaging.value <= -5 %]
"evaluation": "average",
"title_element": {
"title": "[% lang('ecoscore_packaging_impact_medium') %]",
"title": "[% edq(lang('ecoscore_packaging_impact_medium')) %]",
[% ELSE %]
"evaluation": "good",
"title_element": {
"title": "[% lang('ecoscore_packaging_impact_low') %]",
"title": "[% edq(lang('ecoscore_packaging_impact_low')) %]",
[% END %]
"subtitle": "[% lang('malus') %][% sep %]: [% product.ecoscore_data.adjustments.packaging.value %]",
"subtitle": "[% edq(lang('malus')) %][% sep %]: [% product.ecoscore_data.adjustments.packaging.value %]",
"icon_color_from_evaluation": true,
"icon_url": "[% static_subdomain %]/images/icons/dist/packaging.svg",
"icon_size": "small",
Expand All @@ -46,22 +46,22 @@
"element_type": "table",
"table_element": {
"id": "ecoscore_packaging_components",
"title": "[% lang('packaging_parts') %]",
"title": "[% edq(lang('packaging_parts')) %]",
"columns": [
{
"text": "[% lang('packaging_shape') %]",
"text": "[% edq(lang('packaging_shape')) %]",
"type": "text",
},
{
"text": "[% lang('packaging_material') %]",
"text": "[% edq(lang('packaging_material')) %]",
"type": "text",
},
{
"text": "[% lang('packaging_recycling') %]",
"text": "[% edq(lang('packaging_recycling')) %]",
"type": "text",
},
{
"text": "[% lang('ecoscore_impact') %]",
"text": "[% edq(lang('ecoscore_impact')) %]",
"type": "text",
}
],
Expand All @@ -86,13 +86,13 @@
},
{
[% IF score >= 75 %]
"text": "[% lang('low') FILTER ucfirst %]",
"text": "[% edq(lang('low')) FILTER ucfirst %]",
"evaluation": "good",
[% ELSIF score <= 25 %]
"text": "[% lang('high') FILTER ucfirst %]",
"text": "[% edq(lang('high')) FILTER ucfirst %]",
"evaluation": "bad",
[% ELSE %]
"text": "[% lang('medium') FILTER ucfirst %]",
"text": "[% edq(lang('medium')) FILTER ucfirst %]",
"evaluation": "neutral",
[% END %]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[% IF product.ecoscore_data.adjustments.production_system.value == 0 %]
"evaluation": "neutral",
"title_element": {
"title": "[% lang('ecoscore_production_system_no_labels_with_environmental_benefits') %]",
"title": "[% edq(lang('ecoscore_production_system_no_labels_with_environmental_benefits')) %]",
"icon_color_from_evaluation": true,
"icon_url": "[% static_subdomain %]/images/icons/dist/agriculture.svg",
"icon_size": "small",
Expand All @@ -17,13 +17,13 @@
"icon_color_from_evaluation": true,
"icon_url": "[% static_subdomain %]/images/icons/dist/agriculture.svg",
"icon_size": "small",
"subtitle": "[% lang('bonus') %][% sep %]: +[% product.ecoscore_data.adjustments.production_system.value %]",
"subtitle": "[% edq(lang('bonus')) %][% sep %]: +[% product.ecoscore_data.adjustments.production_system.value %]",
[% IF product.ecoscore_data.adjustments.production_system.value >= 20 %]
"title": "[% lang('ecoscore_production_system_labels_with_environmental_benefits_very_high') %]",
"title": "[% edq(lang('ecoscore_production_system_labels_with_environmental_benefits_very_high')) %]",
[% ELSIF product.ecoscore_data.adjustments.production_system.value >= 15 %]
"title": "[% lang('ecoscore_production_system_labels_with_environmental_benefits_high') %]",
"title": "[% edq(lang('ecoscore_production_system_labels_with_environmental_benefits_high')) %]",
[% ELSE %]
"title": "[% lang('ecoscore_production_system_labels_with_environmental_benefits') %]",
"title": "[% edq(lang('ecoscore_production_system_labels_with_environmental_benefits')) %]",
[% END %]
},
"elements": [
Expand Down
Loading

0 comments on commit 012b8f2

Please sign in to comment.