@gov-cy/govcy-frontend-renderer 1.16.1 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -79,6 +79,7 @@ const inputData =
|
|
|
79
79
|
{"label": {"en":"Accessibility", "el":"Προσβασιμότητα"}, "href": "#"},
|
|
80
80
|
{"label": {"en":"Help us improve this service", "el":"Βοηθήστε μας να βελτιώσουμε αυτή την υπηρεσία"}, "href": "#"}
|
|
81
81
|
],
|
|
82
|
+
"copyrightText" : {"en":"Republic of Cyprus, 2025", "el":"Κυπριακή Δημοκρατία, 2025"},
|
|
82
83
|
"menu" : {"en":"Menu", "el":"Μενου"},
|
|
83
84
|
"title" : {"en":"Service title", "el":"Τιτλός υπηρεσίας"},
|
|
84
85
|
"headerTitle" : {"en":"Header title", "el":"Τιτλός επικεφαλιδας"},
|
|
@@ -173,6 +174,7 @@ const inputData =
|
|
|
173
174
|
{"label": {"en":"Accessibility", "el":"Προσβασιμότητα"}, "href": "#"},
|
|
174
175
|
{"label": {"en":"Help us improve this service", "el":"Βοηθήστε μας να βελτιώσουμε αυτή την υπηρεσία"}, "href": "#"}
|
|
175
176
|
],
|
|
177
|
+
"copyrightText" : {"en":"Republic of Cyprus, 2025", "el":"Κυπριακή Δημοκρατία, 2025"},
|
|
176
178
|
"menu" : {"en":"Menu", "el":"Μενου"},
|
|
177
179
|
"title" : {"en":"Service title", "el":"Τιτλός υπηρεσίας"},
|
|
178
180
|
"headerTitle" : {"en":"Header title", "el":"Τιτλός επικεφαλιδας"},
|
|
@@ -315,6 +317,7 @@ The `inputData` object has the following structure:
|
|
|
315
317
|
- **site.lang**: the language of the site. It is used both in the `<html lang` attribute and to define the default language to be used by the individual design elements defined in the template.
|
|
316
318
|
- **site.languages**: the languages in the language menu.
|
|
317
319
|
- **site.footerLinks**: the links of the footer.
|
|
320
|
+
- **site.copyrightText**: the text of the copyright in the footer, including the year.
|
|
318
321
|
- **site.menu**: the menu label.
|
|
319
322
|
- **site.title**: the title of the site. It is used in the `<title>`, `<meta property="og:title"` and `<meta property="twitter:title"` tags of the head.
|
|
320
323
|
- **site.description**: the description of the site. It is used in the `<meta name="description"`, `<meta property="og:description"` and `<meta property="twitter:description"` tags of the head.
|
|
@@ -6691,32 +6691,41 @@ context.setVariable("textType", t_3);
|
|
|
6691
6691
|
if(frame.topLevel) {
|
|
6692
6692
|
context.addExport("textType", t_3);
|
|
6693
6693
|
}
|
|
6694
|
+
var t_4;
|
|
6695
|
+
t_4 = env.getFilter("default").call(context, runtime.memberLookup((l_params),"showNewLine"),false);
|
|
6696
|
+
frame.set("showNewLine", t_4, true);
|
|
6697
|
+
if(frame.topLevel) {
|
|
6698
|
+
context.setVariable("showNewLine", t_4);
|
|
6699
|
+
}
|
|
6700
|
+
if(frame.topLevel) {
|
|
6701
|
+
context.addExport("showNewLine", t_4);
|
|
6702
|
+
}
|
|
6694
6703
|
if(runtime.memberLookup((l_params),"text")) {
|
|
6695
|
-
env.getTemplate("utilities/govcyUtilities.njk", false, "elements/textElement.njk", false, function(t_5
|
|
6696
|
-
if(t_5) { cb(t_5); return; }
|
|
6697
|
-
t_4.getExported(function(t_6,t_4) {
|
|
6704
|
+
env.getTemplate("utilities/govcyUtilities.njk", false, "elements/textElement.njk", false, function(t_6,t_5) {
|
|
6698
6705
|
if(t_6) { cb(t_6); return; }
|
|
6699
|
-
|
|
6700
|
-
|
|
6706
|
+
t_5.getExported(function(t_7,t_5) {
|
|
6707
|
+
if(t_7) { cb(t_7); return; }
|
|
6708
|
+
if(Object.prototype.hasOwnProperty.call(t_5, "govcyLocalizeContent")) {
|
|
6709
|
+
var t_8 = t_5.govcyLocalizeContent;
|
|
6701
6710
|
} else {
|
|
6702
6711
|
cb(new Error("cannot import 'govcyLocalizeContent'")); return;
|
|
6703
6712
|
}
|
|
6704
|
-
context.setVariable("govcyLocalizeContent",
|
|
6705
|
-
if(Object.prototype.hasOwnProperty.call(
|
|
6706
|
-
var
|
|
6713
|
+
context.setVariable("govcyLocalizeContent", t_8);
|
|
6714
|
+
if(Object.prototype.hasOwnProperty.call(t_5, "govcyLangAttribute")) {
|
|
6715
|
+
var t_9 = t_5.govcyLangAttribute;
|
|
6707
6716
|
} else {
|
|
6708
6717
|
cb(new Error("cannot import 'govcyLangAttribute'")); return;
|
|
6709
6718
|
}
|
|
6710
|
-
context.setVariable("govcyLangAttribute",
|
|
6719
|
+
context.setVariable("govcyLangAttribute", t_9);
|
|
6711
6720
|
if(runtime.contextOrFrameLookup(context, frame, "textType") == "p" || runtime.contextOrFrameLookup(context, frame, "textType") == "h1" || runtime.contextOrFrameLookup(context, frame, "textType") == "h2" || runtime.contextOrFrameLookup(context, frame, "textType") == "h3" || runtime.contextOrFrameLookup(context, frame, "textType") == "h4" || runtime.contextOrFrameLookup(context, frame, "textType") == "span") {
|
|
6712
|
-
var
|
|
6713
|
-
|
|
6714
|
-
frame.set("textTag",
|
|
6721
|
+
var t_10;
|
|
6722
|
+
t_10 = runtime.contextOrFrameLookup(context, frame, "textType");
|
|
6723
|
+
frame.set("textTag", t_10, true);
|
|
6715
6724
|
if(frame.topLevel) {
|
|
6716
|
-
context.setVariable("textTag",
|
|
6725
|
+
context.setVariable("textTag", t_10);
|
|
6717
6726
|
}
|
|
6718
6727
|
if(frame.topLevel) {
|
|
6719
|
-
context.addExport("textTag",
|
|
6728
|
+
context.addExport("textTag", t_10);
|
|
6720
6729
|
}
|
|
6721
6730
|
t_2 += "<";
|
|
6722
6731
|
t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "textType"), env.opts.autoescape);
|
|
@@ -6732,10 +6741,14 @@ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"classes"), env.opt
|
|
|
6732
6741
|
t_2 += "\"";
|
|
6733
6742
|
;
|
|
6734
6743
|
}
|
|
6735
|
-
|
|
6736
|
-
t_2 += "
|
|
6737
|
-
|
|
6738
|
-
|
|
6744
|
+
if(runtime.contextOrFrameLookup(context, frame, "showNewLine")) {
|
|
6745
|
+
t_2 += " style=\"white-space: pre-line;\"";
|
|
6746
|
+
;
|
|
6747
|
+
}
|
|
6748
|
+
t_2 += runtime.suppressValue((lineno = 19, colno = 219, runtime.callWrap(t_9, "govcyLangAttribute", context, [runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
|
|
6749
|
+
t_2 += ">";
|
|
6750
|
+
t_2 += runtime.suppressValue((lineno = 19, colno = 259, runtime.callWrap(t_8, "govcyLocalizeContent", context, [runtime.memberLookup((l_params),"text"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
|
|
6751
|
+
t_2 += "</";
|
|
6739
6752
|
t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "textType"), env.opts.autoescape);
|
|
6740
6753
|
t_2 += ">";
|
|
6741
6754
|
;
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@param {string} lang The language used. Can be 'en','el'. Optional.
|
|
3
3
|
@param {object} text The text. Will escape text, Example `{en:"Content",el:"Περιεχομένο"}`
|
|
4
4
|
@param {string} type The type of the element. Can be `p`,`h1`,`h2`,`h3`,`h4`,`span`. Default is `p`
|
|
5
|
+
@param {boolean} showNewLine Whether to show new line characters on HTML using `style="white-space: pre-line;"`. Default is `false`
|
|
5
6
|
@param {string} id The elemen't id. Will escape text. Optional
|
|
6
7
|
@param {string} classes Additional classes to add to the outer div. Optional
|
|
7
8
|
@returns html Elements with sanitzed html
|
|
@@ -9,15 +10,14 @@
|
|
|
9
10
|
{% macro textElement(params) -%}
|
|
10
11
|
{# set default values #}
|
|
11
12
|
{%- set textType = params.type | default('p') -%}
|
|
13
|
+
{%- set showNewLine = params.showNewLine | default(false) -%}
|
|
12
14
|
{# text and type are mandatory #}
|
|
13
15
|
{%- if params.text -%}
|
|
14
16
|
{#- Import localizer from utilities -#}
|
|
15
17
|
{%- from "../utilities/govcyUtilities.njk" import govcyLocalizeContent, govcyLangAttribute -%}
|
|
16
18
|
{%- if textType == 'p' or textType == 'h1' or textType == 'h2' or textType == 'h3' or textType == 'h4' or textType == 'span' -%}
|
|
17
19
|
{%- set textTag = textType -%}
|
|
18
|
-
<{{ textType }}{% if params.id %} id="{{ params.id }}"{% endif %}{% if params.classes %} class="{{ params.classes }}"{% endif %}{{ govcyLangAttribute(params.lang) }}>
|
|
19
|
-
{{ govcyLocalizeContent(params.text, params.lang) }}
|
|
20
|
-
</{{ textType }}>
|
|
20
|
+
<{{ textType }}{% if params.id %} id="{{ params.id }}"{% endif %}{% if params.classes %} class="{{ params.classes }}"{% endif %}{% if showNewLine %} style="white-space: pre-line;"{% endif %}{{ govcyLangAttribute(params.lang) }}>{{ govcyLocalizeContent(params.text, params.lang) }}</{{ textType }}>
|
|
21
21
|
{%- endif -%}
|
|
22
22
|
{%- endif -%}
|
|
23
23
|
{%- endmacro %}
|
|
@@ -15,7 +15,8 @@ To use this template you need to pass the following data:
|
|
|
15
15
|
{"label": {"en":"Cookies", "el":"Cookies"}, "href": "#"},
|
|
16
16
|
{"label": {"en":"Accessibility", "el":"Προσβασιμότητα"}, "href": "#"},
|
|
17
17
|
{"label": {"en":"Help us improve this service", "el":"Βοηθήστε μας να βελτιώσουμε αυτή την υπηρεσία"}, "href": "#"},
|
|
18
|
-
],
|
|
18
|
+
],
|
|
19
|
+
"copyrightText" : {"en":"Republic of Cyprus, 2025", "el":"Κυπριακή Δημοκρατία, 2025"},
|
|
19
20
|
"menu" : {"en":"Menu", "el":"Μενου"},
|
|
20
21
|
"title" : {"en":"Service title", "el":"Τιτλός υπηρεσίας"},
|
|
21
22
|
"headerTitle" : {"en":"Header title", "el":"Τιτλός επικεφαλιδας"},
|
|
@@ -184,7 +185,7 @@ To use this template you need to pass the following data:
|
|
|
184
185
|
{%- endif %}
|
|
185
186
|
<div class="govcy-d-flex govcy-align-items-center govcy-flex-wrap">
|
|
186
187
|
<span class="govcy-fs-2 govcy-fw-bold govcy-mr-6">gov.cy</span>
|
|
187
|
-
<span class="govcy-mr-6 govcy-mt-2 govcy-mb-2">©
|
|
188
|
+
<span class="govcy-mr-6 govcy-mt-2 govcy-mb-2">© {{ govcyLocalizeContent(site.copyrightText, site.lang) }}</span>
|
|
188
189
|
</div>
|
|
189
190
|
</div>
|
|
190
191
|
<div class="govcy-my-4">
|