j1_template 2019.4.11 → 2019.4.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/layouts/_unused/layout_resource_generator.html.org +58 -0
  3. data/_includes/themes/j1/layouts/layout_resource_generator.html +21 -30
  4. data/_includes/themes/j1/procedures/layouts/_unused/resource_writer.proc.org +240 -0
  5. data/_includes/themes/j1/procedures/layouts/resource_writer.proc +123 -169
  6. data/lib/j1/version.rb +1 -1
  7. data/lib/starter_web/Gemfile +1 -1
  8. data/lib/starter_web/_cc_test_data/_config.yml +1 -1
  9. data/lib/starter_web/_config.yml +1 -1
  10. data/lib/starter_web/_data/{_old_configs → _unused}/j1_categories.yml +0 -0
  11. data/lib/starter_web/_data/{_old_configs → _unused}/j1_colors.yml +0 -0
  12. data/lib/starter_web/_data/{_old_configs → _unused}/j1_config.yml +0 -0
  13. data/lib/starter_web/_data/{_old_configs → _unused}/j1_font_sizes.yml +0 -0
  14. data/lib/starter_web/_data/{_old_configs → _unused}/j1_i18n.yml +0 -0
  15. data/lib/starter_web/_data/{_old_configs → _unused}/j1_resources.org.yml +0 -0
  16. data/lib/starter_web/_data/{_old_configs → _unused}/j1_resources.yml +0 -0
  17. data/lib/starter_web/assets/themes/j1/adapter/js/themer.js +21 -21
  18. data/lib/starter_web/assets/themes/j1/adapter/js/toccer.js +8 -8
  19. data/lib/starter_web/assets/themes/j1/core/js/_unused/j1.js +1835 -0
  20. data/lib/starter_web/assets/themes/j1/core/js/j1.js +59 -0
  21. data/lib/starter_web/assets/themes/j1/core/js/template.js +1 -1
  22. data/lib/starter_web/assets/themes/j1/core/js/template.js.map +1 -1
  23. data/lib/starter_web/assets/themes/j1/core/js/template.min.js +1 -1
  24. data/lib/starter_web/dot.gitignore +1 -0
  25. data/lib/starter_web/favicon.ico +0 -0
  26. data/lib/starter_web/package.json +1 -1
  27. data/lib/starter_web/pages/public/start/downloads/quickstarter/100_linux_starter.adoc +1 -1
  28. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  29. data/lib/starter_web/utilsrv/package.json +1 -1
  30. metadata +12 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82bd4b5573fd9d6663b937dc2f2ec3cd0c8e28df60e5e1006e2c88fd47cbe169
4
- data.tar.gz: a4b7fe566cd31a9cff279fa8576c136a9412a272a217e7b003e6ea1d55218a4a
3
+ metadata.gz: 17fdae74b90c5a9ffcd6f648da202dcf5be415dd0a31e946c12717d32b4e3234
4
+ data.tar.gz: 67b7febc107df940d9c0ff16f98820a534719b101cbe63c38e7bb5c932aa84b0
5
5
  SHA512:
6
- metadata.gz: '09e1b352ccd672d244e31140d646f4d5ce9c1ead6aa29037d5887f61ff2e5409c5abc1bf970bc055682b241da6992168881af6f247e4da749f034e04cf192b9b'
7
- data.tar.gz: d121fd7f4f73071710960300503c9b63799266f47259900c6120e614fd9e4cadaf537f1e48ec1a6a4b404b3964ff1b182cd97d8602c994f1257cf4c1f2df51c9
6
+ metadata.gz: defb92f844f98263e053b4429ec6e823806a6760d3ec63fa230b426fb062e12be9fd47f82c4eeb7f1ad60fc4358d89df446778dece571a9d63efb1cb0d381c6c
7
+ data.tar.gz: 230e92a51b3e9e6b993103ea5aa9e26862dc9c3487093ec34eac03c5d2ba1849bd9d81f0f39a0276fbcf5b8b33a470907f424039afdf180053cd323c3fd3703e
@@ -0,0 +1,58 @@
1
+ {% comment %}
2
+ # -----------------------------------------------------------------------------
3
+ # ~/_includes/themes/j1/layouts/layout_resource_generator.html
4
+ # Liquid template to generate all resource entries defined for a layout
5
+ #
6
+ # Product/Info:
7
+ # https://jekyll.one
8
+ #
9
+ # Copyright (C) 2019 Juergen Adams
10
+ #
11
+ # J1 Template is licensed under the MIT License.
12
+ # See: https://github.com/jekyll-one-org/j1_template/blob/master/LICENSE
13
+ # -----------------------------------------------------------------------------
14
+ # NOTE:
15
+ # Do NOT add any RESOURCES here. Go for ...
16
+ # -----------------------------------------------------------------------------
17
+ # Test data:
18
+ # liquid_var: {{ liquid_var | debug }}
19
+ # -----------------------------------------------------------------------------
20
+ {% endcomment %}
21
+
22
+ {% comment %} Liquid procedures
23
+ -------------------------------------------------------------------------------- {% endcomment %}
24
+ {% capture resource_writer %}themes/{{site.template.name}}/procedures/layouts/resource_writer.proc{% endcapture %}
25
+
26
+ {% comment %} Variables
27
+ -------------------------------------------------------------------------------- {% endcomment %}
28
+ {% assign resource_placement = include.region %}
29
+ {% assign items_collate = site.data.resources %}
30
+
31
+
32
+ {% comment %} Main
33
+ -------------------------------------------------------------------------------- {% endcomment %}
34
+
35
+ {% if page.debug2 %}
36
+ <!-- [DEBUG2 ] [j1.layout_resource_generator.html ] [ resource DATA to be loaded: {{items_collate}} ] -->
37
+ {% endif %}
38
+
39
+ <!-- [INFO ] [j1.layout_resource_generator.html ] [ start processing: region: {{resource_placement}}, layout: {{page.layout}} ] -->
40
+ {% for item in items_collate %}
41
+
42
+ {% assign array_name = item[0] %}
43
+ {% assign array_value = item[1] %}
44
+
45
+ {% if array_name == 'globals' %}
46
+ {% assign global_array = array_value %}
47
+ {% endif %}
48
+
49
+ {% if page.debug2 %}
50
+ <!-- [DEBUG2 ] [j1.layout_resource_generator.html ] [ generate item: {{array_name}} ] -->
51
+ <!-- [DEBUG2 ] [j1.layout_resource_generator.html ] [ place DATA: {{array_value}} ] -->
52
+ {% endif %}
53
+
54
+ <!-- [INFO ] [j1.layout_resource_generator.html ] [ call resource writer for: {{array_name}} ] -->
55
+ {% include {{ resource_writer }} region=resource_placement globals=global_array resources=array_value %}
56
+
57
+ {% endfor %}
58
+ <!-- [INFO ] [j1.layout_resource_generator.html ] [ end processing ] -->
@@ -11,48 +11,39 @@
11
11
  # J1 Template is licensed under the MIT License.
12
12
  # See: https://github.com/jekyll-one-org/j1_template/blob/master/LICENSE
13
13
  # -----------------------------------------------------------------------------
14
- # NOTE:
15
- # Do NOT add any RESOURCES here. Go for ...
14
+ # NOTE:
15
+ # Do NOT add any RESOURCES here. Go for ...
16
16
  # -----------------------------------------------------------------------------
17
17
  # Test data:
18
18
  # liquid_var: {{ liquid_var | debug }}
19
19
  # -----------------------------------------------------------------------------
20
- {% endcomment %}
20
+ {% endcomment %}
21
21
 
22
- {% comment %} Liquid procedures
22
+ {% comment %} liquid procedures
23
23
  -------------------------------------------------------------------------------- {% endcomment %}
24
24
  {% capture resource_writer %}themes/{{site.template.name}}/procedures/layouts/resource_writer.proc{% endcapture %}
25
25
 
26
- {% comment %} Variables
27
- -------------------------------------------------------------------------------- {% endcomment %}
28
- {% assign resource_placement = include.region %}
29
- {% assign items_collate = site.data.resources %}
30
-
31
-
32
- {% comment %} Main
26
+ {% comment %} variables
33
27
  -------------------------------------------------------------------------------- {% endcomment %}
28
+ {% assign placement = include.region %}
29
+ {% assign globals = site.data.resources.globals %}
30
+ {% assign items = site.data.resources.resources %}
34
31
 
35
32
  {% if page.debug2 %}
36
- <!-- [DEBUG2 ] [j1.layout_resource_generator.html ] [ resource DATA to be loaded: {{items_collate}} ] -->
33
+ <!-- [DEBUG2 ] [j1.layout_resource_generator.html ] [ resource DATA to be loaded: {{items}} ] -->
37
34
  {% endif %}
38
35
 
39
- <!-- [INFO ] [j1.layout_resource_generator.html ] [ start processing: region: {{resource_placement}}, layout: {{page.layout}} ] -->
40
- {% for item in items_collate %}
41
-
42
- {% assign array_name = item[0] %}
43
- {% assign array_value = item[1] %}
44
-
45
- {% if array_name == 'globals' %}
46
- {% assign global_array = array_value %}
47
- {% endif %}
48
-
49
- {% if page.debug2 %}
50
- <!-- [DEBUG2 ] [j1.layout_resource_generator.html ] [ generate item: {{array_name}} ] -->
51
- <!-- [DEBUG2 ] [j1.layout_resource_generator.html ] [ place DATA: {{array_value}} ] -->
52
- {% endif %}
53
-
54
- <!-- [INFO ] [j1.layout_resource_generator.html ] [ call resource writer for: {{array_name}} ] -->
55
- {% include {{ resource_writer }} region=resource_placement globals=global_array resources=array_value %}
56
36
 
37
+ {% comment %} main
38
+ -------------------------------------------------------------------------------- {% endcomment %}
39
+ <!-- [INFO ] [j1.layout_resource_generator.html ] [ start processing region: {{placement}}, layout: {{page.layout}} ] -->
40
+ {% for item in items %}
41
+ {% for element in item %}
42
+ {% if element[0] == 'resource' %}
43
+ {% assign resource = element[1] %}
44
+ <!-- [INFO ] [j1.layout_resource_generator.html ] [ process resource: {{resource.id}} ] -->
45
+ {% include {{ resource_writer }} region=placement global=globals resource=resource %}
46
+ {% endif %}
47
+ {% endfor %}
57
48
  {% endfor %}
58
- <!-- [INFO ] [j1.layout_resource_generator.html ] [ end processing ] -->
49
+ <!-- [INFO ] [j1.layout_resource_generator.html ] [ end processing ] -->
@@ -0,0 +1,240 @@
1
+ {% comment %}
2
+ # -----------------------------------------------------------------------------
3
+ # ~/_includes/themes/j1/procedures/layouts/resource_writer.proc
4
+ # Liquid PROCEDURE to place HTML resources for every LAYOUT
5
+ #
6
+ # Product/Info:
7
+ # https://jekyll.one
8
+ #
9
+ # Copyright (C) 2019 Juergen Adams
10
+ #
11
+ # J1 Template is licensed under the MIT License.
12
+ # See: https://github.com/jekyll-one-org/j1_template/blob/master/LICENSE
13
+ # -----------------------------------------------------------------------------
14
+ # Test data:
15
+ # liquid_var: {{ liquid_var | debug }}
16
+ # -----------------------------------------------------------------------------
17
+ {% endcomment %}
18
+
19
+ {% comment %} Liquid procedures
20
+ -------------------------------------------------------------------------------- {% endcomment %}
21
+ {% capture select_location %}themes/{{site.template.name}}/procedures/global/select_location.proc{% endcapture %}
22
+
23
+ {% comment %} Variables
24
+ -------------------------------------------------------------------------------- {% endcomment %}
25
+ {% assign items = include.resources %}
26
+ {% assign globals = include.globals %}
27
+ {% assign placement = include.region %}
28
+ {% assign environment = site.environment %}
29
+
30
+
31
+ {% comment %} Main
32
+ -------------------------------------------------------------------------------- {% endcomment %}
33
+ {% for global in globals %}
34
+ {% assign key = global[0] %}
35
+ {% assign value = global[1] %}
36
+ {% if key == 'base_path' %} {% assign base_path = value %} {% endif %}
37
+ {% if key == 'location' %} {% assign location = value %} {% endif %}
38
+ {% endfor %}
39
+
40
+ {% for resources in items %}
41
+ {% for resource in resources %}
42
+
43
+ {% if page.debug %}
44
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ process resource: {{resource}} ] -->
45
+ {% endif %}
46
+
47
+
48
+ {% for parameters in resource %}
49
+ {% for parameter in parameters %}
50
+
51
+ {% comment %} Reset data variables
52
+ ------------------------------------------------------------------------
53
+ {% if parameter == "name" %}
54
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ skip processing on parameter: {{parameter}} ] -->
55
+ {% continue %}
56
+ {% endif %}
57
+ ------------------------------------------------------------------------
58
+ {% endcomment %}
59
+
60
+ {% assign data_type = parameter | is_type %}
61
+ {% if data_type == 'array' %}
62
+ {% assign key = parameter[0] %}
63
+ {% assign value = parameter[1] %}
64
+
65
+ {% if page.debug %}
66
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ process parameter: {{key}} ] -->
67
+ {% endif %}
68
+
69
+ {% if key == 'enabled' %} {% assign enabled = value %} {% endif %}
70
+ {% if key == 'id' %} {% assign id = value %} {% endif %}
71
+ {% if key == 'comment' %} {% assign comment = value %} {% endif %}
72
+ {% if key == 'layout' %} {% assign layouts = value %} {% endif %}
73
+ {% if key == 'region' %} {% assign region = value %} {% endif %}
74
+ {% if key == 'required' %} {% assign required = value %} {% endif %}
75
+ {% if key == 'script_load' %} {% assign script_load = value %} {% endif %}
76
+ {% if key == 'pass_init_data' %} {% assign pass_init_data = value %} {% endif %}
77
+ {% if key == 'data' %} {% assign data = value %} {% endif %}
78
+ {% endif %}
79
+ {% endfor %}
80
+ {% endfor %}
81
+
82
+ {% assign is_placed = false %}
83
+
84
+ {% if page.debug %}
85
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ placement detected as: {{is_placed}} ] -->
86
+ {% endif %}
87
+
88
+ {% if script_load == 'sync' %} {% assign script_load = '' %} {% endif %}
89
+
90
+ {% if enabled and placement == 'head' %}
91
+
92
+ {% assign layout_valid = false %}
93
+ {% for layout in layouts %}
94
+ {% assign layout = layout | downcase %}
95
+ {% if layout == page.layout or layout == "all" %} {% assign layout_valid = true %} {% endif %}
96
+ {% endfor %}
97
+
98
+ {% assign resource_valid = false %}
99
+ {% if required == 'always' %}
100
+ {% assign resource_valid = true %}
101
+ {% else %}
102
+ {% for page_resource in page.resources %}
103
+ {% if page_resource == id %} {% assign resource_valid = true %} {% endif %}
104
+ {% endfor %}
105
+ {% endif %}
106
+
107
+
108
+ {% if layout_valid and resource_valid and is_placed == false %}
109
+
110
+ {% comment %} Process all data keys
111
+ ------------------------------------------------------------------------ {% endcomment %}
112
+ {% for data_var in data %}
113
+
114
+ {% assign data_key = data_var[0] %}
115
+ {% assign data_value = data_var[1] %}
116
+
117
+
118
+ {% if page.debug %}
119
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ placement detected as: {{is_placed}} ] -->
120
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ process data_key: {{data_key}} ] -->
121
+ {% endif %}
122
+
123
+ {% if page.debug %}
124
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ process data_value: {{data_value}} ] -->
125
+ {% endif %}
126
+
127
+
128
+ {% if data_key == 'files' %}
129
+
130
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, {{comment}} ] -->
131
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, place general file resources for ID: {{id}} ] -->
132
+
133
+ {% for file in data_value %}
134
+
135
+ {% assign splitted_resource = file | split: ":" %}
136
+ {% assign url_detected = splitted_resource | size %}
137
+
138
+ {% assign splitted_resource = file | split: "." %}
139
+ {% assign split_count = splitted_resource | size %}
140
+
141
+ {% if split_count > 1 %}
142
+ {% assign resource_ext = splitted_resource | last %}
143
+
144
+ {% case resource_ext %}
145
+ {% when 'json' %}
146
+ {% if url_detected > 1 %}
147
+ <script {{script_load}} type="application/json" src="{{file}}"></script>
148
+ {% else %}
149
+ <script {{script_load}} type="application/json" src="{{base_path}}/{{file}}"></script>
150
+ {% endif %}
151
+ {% when 'js' %}
152
+ {% if url_detected > 1 %}
153
+ <script {{script_load}} src="{{file}}"></script>
154
+ {% else %}
155
+ <script {{script_load}} src="{{base_path}}/{{file}}"></script>
156
+ {% endif %}
157
+ {% when 'css' %}
158
+ {% if url_detected > 1 %}
159
+ <link rel="stylesheet" type="text/css" href="{{file}}" />
160
+ {% else %}
161
+ <link rel="stylesheet" type="text/css" href="{{base_path}}/{{file}}" />
162
+ {% endif %}
163
+ {% else %}
164
+ <--! UNKNOWN resource type detected for: "{{file}}" -->
165
+ {% endcase %}
166
+ {% else %}
167
+ {% if url_detected > 1 %}
168
+ <link rel="stylesheet" type="text/css" href="{{file}}" />
169
+ {% else %}
170
+ <link rel="stylesheet" type="text/css" href="{{base_path}}/{{file}}" />
171
+ {% endif %}
172
+ {% endif %}
173
+
174
+ {% endfor %}
175
+ {% endif %}
176
+
177
+ {% if data_key == 'css' %}
178
+ {% for locator in data_value %}
179
+
180
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, {{comment}} ] -->
181
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, place {{data_key}} files for resource ID: {{id}} ] -->
182
+
183
+ {% include {{select_location}} location=location locator=locator %}
184
+ {% assign my_location = {{location_source}} %}
185
+
186
+ {% if environment == 'development' %}
187
+ {% if location == 'remote' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.css" /> {% endif %}
188
+ {% if location == 'local' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.css" /> {% endif %}
189
+ {% else %}
190
+ {% if location == 'remote' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.min.css" /> {% endif %}
191
+ {% if location == 'local' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.min.css" /> {% endif %}
192
+ {% endif %}
193
+
194
+ {% endfor %}
195
+ {% endif %}
196
+
197
+ {% if data_key == 'js' %}
198
+ {% for locator in data_value %}
199
+
200
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}} {{comment}} ] -->
201
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout {{layout}}, place {{data_key}} files for resource ID: {{id}} ] -->
202
+
203
+ {% include {{select_location}} location=location locator=locator %}
204
+ {% assign my_location = {{location_source}} %}
205
+
206
+ {% if environment == 'development' %}
207
+ {% if location == 'remote' %} <script {{script_load}} src="{{my_location}}.js"></script> {% endif %}
208
+ {% if location == 'local' %} <script {{script_load}} src="{{my_location}}.js"></script> {% endif %}
209
+ {% else %}
210
+ {% if location == 'remote' %} <script {{script_load}} src="{{my_location}}.min.js"></script> {% endif %}
211
+ {% if location == 'local' %} <script {{script_load}} src="{{my_location}}.min.js"></script> {% endif %}
212
+ {% endif %}
213
+
214
+ {% endfor %}
215
+ {% endif %}
216
+
217
+ {% endfor %}
218
+
219
+ {% comment %} END Process all data keys
220
+ ------------------------------------------------------------------------ {% endcomment %}
221
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ placement for all data_keys finished ] -->
222
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ reset all data_keys ] -->
223
+ {% assign is_placed = true %}
224
+ {% assign name = nil %}
225
+ {% assign enabled = nil %}
226
+ {% assign id = nil %}
227
+ {% assign comment = nil %}
228
+ {% assign layouts = nil %}
229
+ {% assign region = nil %}
230
+ {% assign required = nil %}
231
+ {% assign script_load = nil %}
232
+ {% assign pass_init_data = nil %}
233
+ {% assign data = nil %}
234
+
235
+ {% endif %}
236
+ {% endif %}
237
+ {% endfor %}
238
+ {% endfor %}
239
+
240
+
@@ -16,225 +16,179 @@
16
16
  # -----------------------------------------------------------------------------
17
17
  {% endcomment %}
18
18
 
19
- {% comment %} Liquid procedures
19
+ {% comment %} liquid procedures
20
20
  -------------------------------------------------------------------------------- {% endcomment %}
21
21
  {% capture select_location %}themes/{{site.template.name}}/procedures/global/select_location.proc{% endcapture %}
22
22
 
23
- {% comment %} Variables
23
+ {% comment %} variables
24
24
  -------------------------------------------------------------------------------- {% endcomment %}
25
- {% assign items = include.resources %}
26
- {% assign globals = include.globals %}
27
- {% assign placement = include.region %}
28
- {% assign environment = site.environment %}
25
+ {% assign environment = site.environment %}
26
+ {% assign placement = include.region %}
27
+ {% assign resource_globals = include.global %}
28
+ {% assign resource_settings = include.resource %}
29
29
 
30
+ {% comment %} helpers
31
+ -------------------------------------------------------------------------------- {% endcomment %}
32
+ {% assign is_placed = false %}
33
+
34
+ {% if page.debug2 %}
35
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ process resource: {{resource_settings}} ] -->
36
+ {% endif %}
30
37
 
31
- {% comment %} Main
38
+ {% comment %} main
32
39
  -------------------------------------------------------------------------------- {% endcomment %}
33
- {% for global in globals %}
40
+ {% for global in resource_globals %}
34
41
  {% assign key = global[0] %}
35
42
  {% assign value = global[1] %}
36
43
  {% if key == 'base_path' %} {% assign base_path = value %} {% endif %}
37
44
  {% if key == 'location' %} {% assign location = value %} {% endif %}
38
45
  {% endfor %}
39
46
 
40
- {% for resources in items %}
41
- {% for resource in resources %}
42
-
43
- {% if page.debug %}
44
- <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ process resource: {{resource}} ] -->
45
- {% endif %}
46
-
47
-
48
- {% for parameters in resource %}
49
- {% for parameter in parameters %}
50
-
51
- {% comment %} Reset data variables
52
- ------------------------------------------------------------------------
53
- {% if parameter == "name" %}
54
- <!-- [INFO ] [j1.layout.resource_writer.proc ] [ skip processing on parameter: {{parameter}} ] -->
55
- {% continue %}
56
- {% endif %}
57
- ------------------------------------------------------------------------
58
- {% endcomment %}
59
-
60
- {% assign data_type = parameter | is_type %}
61
- {% if data_type == 'array' %}
62
- {% assign key = parameter[0] %}
63
- {% assign value = parameter[1] %}
64
-
65
- {% if page.debug %}
66
- <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ process parameter: {{key}} ] -->
67
- {% endif %}
68
-
69
- {% if key == 'enabled' %} {% assign enabled = value %} {% endif %}
70
- {% if key == 'id' %} {% assign id = value %} {% endif %}
71
- {% if key == 'comment' %} {% assign comment = value %} {% endif %}
72
- {% if key == 'layout' %} {% assign layouts = value %} {% endif %}
73
- {% if key == 'region' %} {% assign region = value %} {% endif %}
74
- {% if key == 'required' %} {% assign required = value %} {% endif %}
75
- {% if key == 'script_load' %} {% assign script_load = value %} {% endif %}
76
- {% if key == 'pass_init_data' %} {% assign pass_init_data = value %} {% endif %}
77
- {% if key == 'data' %} {% assign data = value %} {% endif %}
78
- {% endif %}
79
- {% endfor %}
80
- {% endfor %}
81
-
82
- {% assign is_placed = false %}
83
-
84
- {% if page.debug %}
85
- <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ placement detected as: {{is_placed}} ] -->
86
- {% endif %}
87
-
88
- {% if script_load == 'sync' %} {% assign script_load = '' %} {% endif %}
47
+ {% if page.debug %}
48
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ placement detected as: {{is_placed}} ] -->
49
+ {% endif %}
89
50
 
90
- {% if enabled and placement == 'head' %}
91
-
92
- {% assign layout_valid = false %}
93
- {% for layout in layouts %}
94
- {% assign layout = layout | downcase %}
95
- {% if layout == page.layout or layout == "all" %} {% assign layout_valid = true %} {% endif %}
96
- {% endfor %}
97
-
98
- {% assign resource_valid = false %}
99
- {% if required == 'always' %}
100
- {% assign resource_valid = true %}
101
- {% else %}
102
- {% for page_resource in page.resources %}
103
- {% if page_resource == id %} {% assign resource_valid = true %} {% endif %}
104
- {% endfor %}
105
- {% endif %}
51
+ {% if resource_settings.script_load == 'sync' %} {% assign resource_settings.script_load = '' %} {% endif %}
106
52
 
53
+ {% if resource_settings.enabled and placement == 'head' %}
107
54
 
108
- {% if layout_valid and resource_valid and is_placed == false %}
55
+ {% assign layout_valid = false %}
56
+ {% for layout in resource_settings.layout %}
57
+ {% assign layout = layout|downcase %}
58
+ {% if layout == page.layout or layout == "all" %} {% assign layout_valid = true %} {% endif %}
59
+ {% endfor %}
109
60
 
110
- {% comment %} Process all data keys
111
- ------------------------------------------------------------------------ {% endcomment %}
112
- {% for data_var in data %}
61
+ {% assign resource_valid = false %}
62
+ {% if resource_settings.required == 'always' %}
63
+ {% assign resource_valid = true %}
64
+ {% else %}
65
+ {% for resource in page.resources %}
66
+ {% if resource == resource_settings.id %} {% assign resource_valid = true %} {% endif %}
67
+ {% endfor %}
68
+ {% endif %}
113
69
 
114
- {% assign data_key = data_var[0] %}
115
- {% assign data_value = data_var[1] %}
70
+ {% comment %} resource placement
71
+ ------------------------------------------------------------------------------ {% endcomment %}
72
+ {% if layout_valid and resource_valid and is_placed == false %}
116
73
 
74
+ {% comment %} process all data keys
75
+ ---------------------------------------------------------------------------- {% endcomment %}
76
+ {% for data_var in resource_settings.data %}
117
77
 
118
- {% if page.debug %}
119
- <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ placement detected as: {{is_placed}} ] -->
120
- <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ process data_key: {{data_key}} ] -->
121
- {% endif %}
78
+ {% assign data_key = data_var[0] %}
79
+ {% assign data_value = data_var[1] %}
122
80
 
123
- {% if page.debug %}
124
- <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ process data_value: {{data_value}} ] -->
125
- {% endif %}
81
+ {% if page.debug %}
82
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ placement detected as: {{is_placed}} ] -->
83
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ process data_key: {{data_key}} ] -->
84
+ {% endif %}
126
85
 
86
+ {% if page.debug %}
87
+ <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ process data_value: {{data_value}} ] -->
88
+ {% endif %}
127
89
 
128
- {% if data_key == 'files' %}
90
+ {% comment %} process data key 'files'
91
+ -------------------------------------------------------------------------- {% endcomment %}
92
+ {% if data_key == 'files' %}
129
93
 
130
- <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, {{comment}} ] -->
131
- <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, place general file resources for ID: {{id}} ] -->
94
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, {{resource_settings.comment}} ] -->
95
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, place general file resources for resource_settings.id: {{resource_settings.id}} ] -->
132
96
 
133
- {% for file in data_value %}
97
+ {% for file in data_value %}
134
98
 
135
- {% assign splitted_resource = file | split: ":" %}
136
- {% assign url_detected = splitted_resource | size %}
99
+ {% assign splitted_resource = file | split: ":" %}
100
+ {% assign url_detected = splitted_resource | size %}
137
101
 
138
- {% assign splitted_resource = file | split: "." %}
139
- {% assign split_count = splitted_resource | size %}
102
+ {% assign splitted_resource = file | split: "." %}
103
+ {% assign split_count = splitted_resource | size %}
140
104
 
141
- {% if split_count > 1 %}
142
- {% assign resource_ext = splitted_resource | last %}
105
+ {% if split_count > 1 %}
106
+ {% assign resource_ext = splitted_resource | last %}
143
107
 
144
- {% case resource_ext %}
145
- {% when 'json' %}
146
- {% if url_detected > 1 %}
147
- <script {{script_load}} type="application/json" src="{{file}}"></script>
148
- {% else %}
149
- <script {{script_load}} type="application/json" src="{{base_path}}/{{file}}"></script>
150
- {% endif %}
151
- {% when 'js' %}
152
- {% if url_detected > 1 %}
153
- <script {{script_load}} src="{{file}}"></script>
154
- {% else %}
155
- <script {{script_load}} src="{{base_path}}/{{file}}"></script>
156
- {% endif %}
157
- {% when 'css' %}
158
- {% if url_detected > 1 %}
159
- <link rel="stylesheet" type="text/css" href="{{file}}" />
160
- {% else %}
161
- <link rel="stylesheet" type="text/css" href="{{base_path}}/{{file}}" />
162
- {% endif %}
108
+ {% case resource_ext %}
109
+ {% when 'json' %}
110
+ {% if url_detected > 1 %}
111
+ <script {{resource_settings.script_load}} type="application/json" src="{{file}}"></script>
112
+ {% else %}
113
+ <script {{resource_settings.script_load}} type="application/json" src="{{base_path}}/{{file}}"></script>
114
+ {% endif %}
115
+ {% when 'js' %}
116
+ {% if url_detected > 1 %}
117
+ <script {{resource_settings.script_load}} src="{{file}}"></script>
163
118
  {% else %}
164
- <--! UNKNOWN resource type detected for: "{{file}}" -->
165
- {% endcase %}
166
- {% else %}
119
+ <script {{resource_settings.script_load}} src="{{base_path}}/{{file}}"></script>
120
+ {% endif %}
121
+ {% when 'css' %}
167
122
  {% if url_detected > 1 %}
168
123
  <link rel="stylesheet" type="text/css" href="{{file}}" />
169
124
  {% else %}
170
125
  <link rel="stylesheet" type="text/css" href="{{base_path}}/{{file}}" />
171
126
  {% endif %}
172
- {% endif %}
127
+ {% else %}
128
+ <--! UNKNOWN resource type detected for: "{{file}}" -->
129
+ {% endcase %}
130
+ {% else %}
131
+ {% if url_detected > 1 %}
132
+ <link rel="stylesheet" type="text/css" href="{{file}}" />
133
+ {% else %}
134
+ <link rel="stylesheet" type="text/css" href="{{base_path}}/{{file}}" />
135
+ {% endif %}
136
+ {% endif %}
173
137
 
174
- {% endfor %}
175
- {% endif %}
176
-
177
- {% if data_key == 'css' %}
178
- {% for locator in data_value %}
138
+ {% endfor %}
139
+ {% endif %}
179
140
 
180
- <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, {{comment}} ] -->
181
- <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, place {{data_key}} files for resource ID: {{id}} ] -->
141
+ {% comment %} process data key 'css'
142
+ -------------------------------------------------------------------------- {% endcomment %}
143
+ {% if data_key == 'css' %}
144
+ {% for locator in data_value %}
182
145
 
183
- {% include {{select_location}} location=location locator=locator %}
184
- {% assign my_location = {{location_source}} %}
146
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, {{resource_settings.comment}} ] -->
147
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}}, place {{data_key}} files for resource ID: {{resource_settings.id}} ] -->
185
148
 
186
- {% if environment == 'development' %}
187
- {% if location == 'remote' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.css" /> {% endif %}
188
- {% if location == 'local' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.css" /> {% endif %}
189
- {% else %}
190
- {% if location == 'remote' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.min.css" /> {% endif %}
191
- {% if location == 'local' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.min.css" /> {% endif %}
192
- {% endif %}
149
+ {% include {{select_location}} location=location locator=locator %}
150
+ {% assign my_location = {{location_source}} %}
193
151
 
194
- {% endfor %}
152
+ {% if environment == 'development' %}
153
+ {% if location == 'remote' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.css" /> {% endif %}
154
+ {% if location == 'local' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.css" /> {% endif %}
155
+ {% else %}
156
+ {% if location == 'remote' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.min.css" /> {% endif %}
157
+ {% if location == 'local' %} <link rel="stylesheet" type="text/css" href="{{my_location}}.min.css" /> {% endif %}
195
158
  {% endif %}
196
159
 
197
- {% if data_key == 'js' %}
198
- {% for locator in data_value %}
160
+ {% endfor %}
161
+ {% endif %}
199
162
 
200
- <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}} {{comment}} ] -->
201
- <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout {{layout}}, place {{data_key}} files for resource ID: {{id}} ] -->
163
+ {% comment %} process data key 'js'
164
+ -------------------------------------------------------------------------- {% endcomment %}
165
+ {% if data_key == 'js' %}
166
+ {% for locator in data_value %}
202
167
 
203
- {% include {{select_location}} location=location locator=locator %}
204
- {% assign my_location = {{location_source}} %}
168
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout: {{layout}} {{resource_settings.comment}} ] -->
169
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ layout {{layout}}, place {{data_key}} files for resource ID: {{resource_settings.id}} ] -->
205
170
 
206
- {% if environment == 'development' %}
207
- {% if location == 'remote' %} <script {{script_load}} src="{{my_location}}.js"></script> {% endif %}
208
- {% if location == 'local' %} <script {{script_load}} src="{{my_location}}.js"></script> {% endif %}
209
- {% else %}
210
- {% if location == 'remote' %} <script {{script_load}} src="{{my_location}}.min.js"></script> {% endif %}
211
- {% if location == 'local' %} <script {{script_load}} src="{{my_location}}.min.js"></script> {% endif %}
212
- {% endif %}
171
+ {% include {{select_location}} location=location locator=locator %}
172
+ {% assign my_location = {{location_source}} %}
213
173
 
214
- {% endfor %}
174
+ {% if environment == 'development' %}
175
+ {% if location == 'remote' %} <script {{resource_settings.script_load}} src="{{my_location}}.js"></script> {% endif %}
176
+ {% if location == 'local' %} <script {{resource_settings.script_load}} src="{{my_location}}.js"></script> {% endif %}
177
+ {% else %}
178
+ {% if location == 'remote' %} <script {{resource_settings.script_load}} src="{{my_location}}.min.js"></script> {% endif %}
179
+ {% if location == 'local' %} <script {{resource_settings.script_load}} src="{{my_location}}.min.js"></script> {% endif %}
215
180
  {% endif %}
216
181
 
217
182
  {% endfor %}
183
+ {% endif %}
218
184
 
219
- {% comment %} END Process all data keys
220
- ------------------------------------------------------------------------ {% endcomment %}
221
- <!-- [INFO ] [j1.layout.resource_writer.proc ] [ placement for all data_keys finished ] -->
222
- <!-- [DEBUG ] [j1.layout.resource_writer.proc ] [ reset all data_keys ] -->
223
- {% assign is_placed = true %}
224
- {% assign name = nil %}
225
- {% assign enabled = nil %}
226
- {% assign id = nil %}
227
- {% assign comment = nil %}
228
- {% assign layouts = nil %}
229
- {% assign region = nil %}
230
- {% assign required = nil %}
231
- {% assign script_load = nil %}
232
- {% assign pass_init_data = nil %}
233
- {% assign data = nil %}
185
+ {% endfor %}
234
186
 
235
- {% endif %}
236
- {% endif %}
237
- {% endfor %}
238
- {% endfor %}
187
+ {% comment %} END process all data keys
188
+ ---------------------------------------------------------------------------- {% endcomment %}
189
+ {% assign is_placed = true %}
239
190
 
191
+ <!-- [INFO ] [j1.layout.resource_writer.proc ] [ placement for all data_keys finished ] -->
240
192
 
193
+ {% endif %}
194
+ {% endif %}